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

View File

@ -1,7 +1,7 @@
#
# 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
# of this software and associated documentation files (the "Software"), to deal
@ -23,14 +23,14 @@
#
header:
version: 11
version: 14
target: zlib-native
repos:
poky:
url: https://git.yoctoproject.org/poky.git
refspec: 387ab5f18b17c3af3e9e30dc58584641a70f359f
commit: 387ab5f18b17c3af3e9e30dc58584641a70f359f
layers:
meta:
meta-poky:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -42,7 +42,7 @@ def test_patch(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
repositories.
"""

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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