From 7647d7ad3e4167d4587c6c71da76e4d57d5ebd03 Mon Sep 17 00:00:00 2001 From: Peter Hoyes Date: Fri, 8 Jul 2022 16:45:10 +0200 Subject: [PATCH] tests: Add failing test with repository includes Add a new test to test_commands.py which: * Has an incomplete definition of externalrepo * Defines a local repository, subrepo * Includes a file from subrepo * The included file completes the definition of externalrepo * It also attempts to include a file from externalrepo This test previously failed with the error message "No such file or directory: '.../test_commands/tests/test_layers/test.yml'" Signed-off-by: Peter Hoyes Signed-off-by: Jan Kiszka --- tests/test_commands.py | 8 ++++++++ tests/test_repo_includes/oe-init-build-env | 3 +++ tests/test_repo_includes/subrepo/test.yml | 10 ++++++++++ tests/test_repo_includes/test.yml | 14 ++++++++++++++ 4 files changed, 35 insertions(+) create mode 100755 tests/test_repo_includes/oe-init-build-env create mode 100644 tests/test_repo_includes/subrepo/test.yml create mode 100644 tests/test_repo_includes/test.yml diff --git a/tests/test_commands.py b/tests/test_commands.py index 2d615b3..03f0b67 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -58,3 +58,11 @@ def test_checkout(changedir, tmpdir): assert(not glob.glob('build/tmp*')) assert(not os.path.exists('build/downloads')) assert(not os.path.exists('build/sstate-cache')) + + +def test_repo_includes(changedir, tmpdir): + tdir = str(tmpdir.mkdir('test_commands')) + shutil.rmtree(tdir, ignore_errors=True) + shutil.copytree('tests/test_repo_includes', tdir) + os.chdir(tdir) + kas.kas(['checkout', 'test.yml']) diff --git a/tests/test_repo_includes/oe-init-build-env b/tests/test_repo_includes/oe-init-build-env new file mode 100755 index 0000000..296ef78 --- /dev/null +++ b/tests/test_repo_includes/oe-init-build-env @@ -0,0 +1,3 @@ +#!/bin/sh + +true diff --git a/tests/test_repo_includes/subrepo/test.yml b/tests/test_repo_includes/subrepo/test.yml new file mode 100644 index 0000000..92b8020 --- /dev/null +++ b/tests/test_repo_includes/subrepo/test.yml @@ -0,0 +1,10 @@ +header: + version: 11 + includes: + - repo: externalrepo + file: tests/test_layers/test.yml + +repos: + externalrepo: + url: https://github.com/siemens/kas.git + path: externalrepo diff --git a/tests/test_repo_includes/test.yml b/tests/test_repo_includes/test.yml new file mode 100644 index 0000000..7f9200c --- /dev/null +++ b/tests/test_repo_includes/test.yml @@ -0,0 +1,14 @@ +header: + version: 11 + includes: + - repo: subrepo + file: test.yml + +repos: + this: + + subrepo: + path: subrepo + + externalrepo: + refspec: master