tests: Add tests for new for-all-repos & checkout commands
Signed-off-by: Paul Barker <pbarker@konsulko.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
parent
a89b011b80
commit
9176d1f5b9
59
tests/test_commands.py
Normal file
59
tests/test_commands.py
Normal file
@ -0,0 +1,59 @@
|
||||
# kas - setup tool for bitbake based projects
|
||||
#
|
||||
# Copyright (c) Konsulko Group, 2020
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
import glob
|
||||
import os
|
||||
import shutil
|
||||
from kas import kas
|
||||
|
||||
|
||||
def test_for_all_repos(changedir, tmpdir):
|
||||
tdir = str(tmpdir.mkdir('test_commands'))
|
||||
shutil.rmtree(tdir, ignore_errors=True)
|
||||
shutil.copytree('tests/test_commands', tdir)
|
||||
os.chdir(tdir)
|
||||
kas.kas(['for-all-repos', 'test.yml',
|
||||
'git rev-parse HEAD >> %s/ref_${KAS_REPO_NAME}' % (tdir)])
|
||||
|
||||
with open('ref_kas_1.0', 'r') as f:
|
||||
assert(f.readline().strip()
|
||||
== '907816a5c4094b59a36aec12226e71c461c05b77')
|
||||
with open('ref_kas_1.1', 'r') as f:
|
||||
assert(f.readline().strip()
|
||||
== 'e9ca55a239caa1a2098e1d48773a29ea53c6cab2')
|
||||
|
||||
|
||||
def test_checkout(changedir, tmpdir):
|
||||
tdir = str(tmpdir.mkdir('test_commands'))
|
||||
shutil.rmtree(tdir, ignore_errors=True)
|
||||
shutil.copytree('tests/test_commands', tdir)
|
||||
os.chdir(tdir)
|
||||
kas.kas(['checkout', 'test.yml'])
|
||||
|
||||
# Ensure that local.conf and bblayers.conf are populated, check that no
|
||||
# build has been executed by ensuring that no tmp, sstate-cache or
|
||||
# downloads directories are present.
|
||||
assert(os.path.exists('build/conf/local.conf'))
|
||||
assert(os.path.exists('build/conf/bblayers.conf'))
|
||||
assert(not glob.glob('build/tmp*'))
|
||||
assert(not os.path.exists('build/downloads'))
|
||||
assert(not os.path.exists('build/sstate-cache'))
|
3
tests/test_commands/oe-init-build-env
Executable file
3
tests/test_commands/oe-init-build-env
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
true
|
13
tests/test_commands/test.yml
Normal file
13
tests/test_commands/test.yml
Normal file
@ -0,0 +1,13 @@
|
||||
header:
|
||||
version: 8
|
||||
|
||||
repos:
|
||||
this:
|
||||
|
||||
kas_1.0:
|
||||
url: https://github.com/siemens/kas.git
|
||||
refspec: 907816a5c4094b59a36aec12226e71c461c05b77
|
||||
|
||||
kas_1.1:
|
||||
url: https://github.com/siemens/kas.git
|
||||
refspec: e9ca55a239caa1a2098e1d48773a29ea53c6cab2
|
Loading…
Reference in New Issue
Block a user