tests: Widely switch to new commit/branch syntax

Lift most test cases to the new syntax, just with few exceptions:
 - tests/test_refspec/test2.yml actually stresses the mixed usage
   (but clean per repo)
 - tests/test_repo_includes references kas as external repo at a point
   where there was no new syntax yet; this needs to be migrated
   differently later on

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Jan Kiszka 2023-05-29 19:25:29 +02:00
parent 13f87ecb19
commit 716937b028
16 changed files with 51 additions and 50 deletions

View File

@ -1,7 +1,7 @@
# #
# kas - setup tool for bitbake based projects # kas - setup tool for bitbake based projects
# #
# Copyright (c) Siemens AG, 2022 # Copyright (c) Siemens AG, 2022-2023
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@ -23,7 +23,7 @@
# #
header: header:
version: 11 version: 14
build_system: isar build_system: isar
@ -35,7 +35,7 @@ target: mc:qemuamd64-bullseye:cowsay
repos: repos:
isar: isar:
url: https://github.com/ilbers/isar.git url: https://github.com/ilbers/isar.git
refspec: 8dfa97cf6e25a7adec2e02c50c5ef6329f31931b commit: 8dfa97cf6e25a7adec2e02c50c5ef6329f31931b
layers: layers:
meta: meta:
meta-isar: meta-isar:

View File

@ -1,7 +1,7 @@
# #
# kas - setup tool for bitbake based projects # kas - setup tool for bitbake based projects
# #
# Copyright (c) Siemens AG, 2022 # Copyright (c) Siemens AG, 2022-2023
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@ -23,14 +23,14 @@
# #
header: header:
version: 11 version: 14
target: zlib-native target: zlib-native
repos: repos:
poky: poky:
url: https://git.yoctoproject.org/poky.git url: https://git.yoctoproject.org/poky.git
refspec: 387ab5f18b17c3af3e9e30dc58584641a70f359f commit: 387ab5f18b17c3af3e9e30dc58584641a70f359f
layers: layers:
meta: meta:
meta-poky: meta-poky:

View File

@ -113,7 +113,7 @@ def test_dump(changedir, tmpdir, capsys):
with open(outfile, 'r') as cf: with open(outfile, 'r') as cf:
flatconf = json.load(cf) if f == 'json' else yaml.safe_load(cf) flatconf = json.load(cf) if f == 'json' else yaml.safe_load(cf)
refspec = flatconf['repos']['kas3']['refspec'] refspec = flatconf['repos']['kas3'].get('refspec', None)
envvar = flatconf['env']['TESTVAR_FOO'] envvar = flatconf['env']['TESTVAR_FOO']
if r == '--resolve-refs': if r == '--resolve-refs':
assert refspec != 'master' assert refspec != 'master'
@ -156,9 +156,9 @@ def test_lockfile(changedir, tmpdir, capsys):
assert lockspec['overrides']['repos']['externalrepo']['commit'] \ assert lockspec['overrides']['repos']['externalrepo']['commit'] \
== expected_commit == expected_commit
# insert older refspec into lockfile (kas 3.2 tag) # insert older commit into lockfile (kas 3.2 tag)
test_refspec = 'dc44638cd87c4d0045ea2ca441e682f3525d8b91' test_commit = 'dc44638cd87c4d0045ea2ca441e682f3525d8b91'
lockspec['overrides']['repos']['externalrepo']['commit'] = test_refspec lockspec['overrides']['repos']['externalrepo']['commit'] = test_commit
with open('test.lock.yml', 'w') as f: with open('test.lock.yml', 'w') as f:
yaml.safe_dump(lockspec, f) yaml.safe_dump(lockspec, f)
@ -166,11 +166,11 @@ def test_lockfile(changedir, tmpdir, capsys):
kas.kas('dump test.yml'.split()) kas.kas('dump test.yml'.split())
lockspec = yaml.safe_load(capsys.readouterr().out) lockspec = yaml.safe_load(capsys.readouterr().out)
assert lockspec['overrides']['repos']['externalrepo']['commit'] \ assert lockspec['overrides']['repos']['externalrepo']['commit'] \
== test_refspec == test_commit
# update lockfile, check if repo is pinned to other commit # update lockfile, check if repo is pinned to other commit
kas.kas('dump --lock --inplace --update test.yml'.split()) kas.kas('dump --lock --inplace --update test.yml'.split())
with open('test.lock.yml', 'r') as f: with open('test.lock.yml', 'r') as f:
lockspec = yaml.safe_load(f) lockspec = yaml.safe_load(f)
assert lockspec['overrides']['repos']['externalrepo']['commit'] \ assert lockspec['overrides']['repos']['externalrepo']['commit'] \
!= test_refspec != test_commit

View File

@ -1,7 +1,7 @@
header: header:
version: 8 version: 14
repos: repos:
kas_invalid: kas_invalid:
url: https://example.com/kas.git url: https://example.com/kas.git
refspec: this-ref-is-invalid branch: this-ref-is-invalid

View File

@ -1,13 +1,13 @@
header: header:
version: 8 version: 14
repos: repos:
this: this:
kas_1.0: kas_1.0:
url: https://github.com/siemens/kas.git url: https://github.com/siemens/kas.git
refspec: 907816a5c4094b59a36aec12226e71c461c05b77 commit: 907816a5c4094b59a36aec12226e71c461c05b77
kas_1.1: kas_1.1:
url: https://github.com/siemens/kas.git url: https://github.com/siemens/kas.git
refspec: e9ca55a239caa1a2098e1d48773a29ea53c6cab2 commit: e9ca55a239caa1a2098e1d48773a29ea53c6cab2

View File

@ -1,5 +1,5 @@
header: header:
version: 13 version: 14
env: env:
TESTVAR_DEFAULT_VAL: "BAR" TESTVAR_DEFAULT_VAL: "BAR"
@ -13,13 +13,13 @@ repos:
# Testing new BB_ENV_PASSTHROUGH_ADDITIONS # Testing new BB_ENV_PASSTHROUGH_ADDITIONS
bitbake_new: bitbake_new:
url: https://git.openembedded.org/bitbake url: https://git.openembedded.org/bitbake
refspec: 87104b6a167188921da157c7dba45938849fb22a commit: 87104b6a167188921da157c7dba45938849fb22a
layers: layers:
.: excluded .: excluded
# Testing deprecated BB_ENV_WHITELIST # Testing deprecated BB_ENV_WHITELIST
bitbake_old: bitbake_old:
url: https://git.openembedded.org/bitbake url: https://git.openembedded.org/bitbake
refspec: efaafc9ec2e8c0475e3fb27e877a1c0a5532a0e5 commit: efaafc9ec2e8c0475e3fb27e877a1c0a5532a0e5
layers: layers:
.: excluded .: excluded

View File

@ -1,29 +1,29 @@
header: header:
version: 8 version: 14
repos: repos:
this: this:
kas: kas:
url: https://github.com/siemens/kas.git url: https://github.com/siemens/kas.git
refspec: master branch: master
kas1: kas1:
url: https://github.com/siemens/kas.git url: https://github.com/siemens/kas.git
refspec: master branch: master
layers: layers:
meta-foo: meta-foo:
meta-bar: meta-bar:
kas2: kas2:
url: https://github.com/siemens/kas.git url: https://github.com/siemens/kas.git
refspec: master branch: master
layers: layers:
.: excluded .: excluded
kas3: kas3:
url: https://github.com/siemens/kas.git url: https://github.com/siemens/kas.git
refspec: master branch: master
layers: layers:
.: .:
meta-bar: meta-bar:

View File

@ -42,7 +42,7 @@ def test_patch(changedir, tmpdir):
def test_patch_update(changedir, tmpdir): def test_patch_update(changedir, tmpdir):
""" """
Test that patches are applied correctly after switching refspec from Test that patches are applied correctly after switching a repo from
a branch to a commit hash and vice-versa with both git and mercurial a branch to a commit hash and vice-versa with both git and mercurial
repositories. repositories.
""" """

View File

@ -1,12 +1,12 @@
header: header:
version: 8 version: 14
repos: repos:
this: this:
kas: kas:
url: https://github.com/siemens/kas.git url: https://github.com/siemens/kas.git
refspec: 907816a5c4094b59a36aec12226e71c461c05b77 commit: 907816a5c4094b59a36aec12226e71c461c05b77
patches: patches:
plain: plain:
repo: this repo: this

View File

@ -1,10 +1,10 @@
header: header:
version: 8 version: 14
repos: repos:
kas: kas:
url: https://github.com/siemens/kas.git url: https://github.com/siemens/kas.git
refspec: 907816a5c4094b59a36aec12226e71c461c05b77 commit: 907816a5c4094b59a36aec12226e71c461c05b77
patches: patches:
plain: plain:
repo: non-existent repo: non-existent

View File

@ -1,12 +1,12 @@
header: header:
version: 8 version: 14
repos: repos:
this: this:
kas: kas:
url: https://github.com/ilbers/isar.git url: https://github.com/ilbers/isar.git
refspec: 47aaeedecd0ea6f754da36be1d10717b04eb8275 commit: 47aaeedecd0ea6f754da36be1d10717b04eb8275
patches: patches:
plain: plain:
repo: this repo: this

View File

@ -1,12 +1,12 @@
header: header:
version: 8 version: 14
repos: repos:
this: this:
kas: kas:
url: https://github.com/siemens/kas.git url: https://github.com/siemens/kas.git
refspec: 907816a5c4094b59a36aec12226e71c461c05b77 commit: 907816a5c4094b59a36aec12226e71c461c05b77
patches: patches:
plain: plain:
repo: this repo: this
@ -17,7 +17,7 @@ repos:
kas-branch: kas-branch:
url: https://github.com/siemens/kas.git url: https://github.com/siemens/kas.git
refspec: master branch: master
patches: patches:
plain: plain:
repo: this repo: this
@ -25,7 +25,7 @@ repos:
hello: hello:
url: https://www.mercurial-scm.org/repo/hello/ url: https://www.mercurial-scm.org/repo/hello/
refspec: 82e55d328c8c commit: 82e55d328c8c
type: hg type: hg
patches: patches:
plain: plain:
@ -37,7 +37,7 @@ repos:
hello-branch: hello-branch:
url: https://www.mercurial-scm.org/repo/hello/ url: https://www.mercurial-scm.org/repo/hello/
refspec: default branch: default
type: hg type: hg
patches: patches:
plain: plain:

View File

@ -1,12 +1,12 @@
header: header:
version: 8 version: 14
repos: repos:
this: this:
kas: kas:
url: https://github.com/siemens/kas.git url: https://github.com/siemens/kas.git
refspec: master branch: master
patches: patches:
plain: plain:
repo: this repo: this
@ -14,7 +14,7 @@ repos:
kas-branch: kas-branch:
url: https://github.com/siemens/kas.git url: https://github.com/siemens/kas.git
refspec: 907816a5c4094b59a36aec12226e71c461c05b77 commit: 907816a5c4094b59a36aec12226e71c461c05b77
patches: patches:
plain: plain:
repo: this repo: this
@ -25,7 +25,7 @@ repos:
hello: hello:
url: https://www.mercurial-scm.org/repo/hello/ url: https://www.mercurial-scm.org/repo/hello/
refspec: default branch: default
type: hg type: hg
patches: patches:
plain: plain:
@ -37,7 +37,7 @@ repos:
hello-branch: hello-branch:
url: https://www.mercurial-scm.org/repo/hello/ url: https://www.mercurial-scm.org/repo/hello/
refspec: 0a04b987be5a commit: 0a04b987be5a
type: hg type: hg
patches: patches:
plain: plain:

View File

@ -1,13 +1,13 @@
header: header:
version: 8 version: 14
repos: repos:
this: this:
kas: kas:
url: https://github.com/siemens/kas.git url: https://github.com/siemens/kas.git
refspec: 907816a5c4094b59a36aec12226e71c461c05b77 commit: 907816a5c4094b59a36aec12226e71c461c05b77
kas2: kas2:
url: https://github.com/siemens/kas.git url: https://github.com/siemens/kas.git
refspec: master branch: master

View File

@ -1,13 +1,14 @@
header: header:
version: 8 version: 14
repos: repos:
this: this:
kas: kas:
url: https://github.com/siemens/kas.git url: https://github.com/siemens/kas.git
refspec: master branch: master
kas2: kas2:
url: https://github.com/siemens/kas.git url: https://github.com/siemens/kas.git
# keep legacy refspec here for testing purposes
refspec: 907816a5c4094b59a36aec12226e71c461c05b77 refspec: 907816a5c4094b59a36aec12226e71c461c05b77

View File

@ -1,13 +1,13 @@
header: header:
version: 8 version: 14
repos: repos:
this: this:
kas_abs: kas_abs:
url: https://github.com/siemens/kas.git url: https://github.com/siemens/kas.git
refspec: refs/heads/master branch: refs/heads/master
kas_rel: kas_rel:
url: https://github.com/siemens/kas.git url: https://github.com/siemens/kas.git
refspec: master branch: master