From e274886ab0356f69294def8b0f1a1a2a28bb4a6d Mon Sep 17 00:00:00 2001 From: Felix Moessbauer Date: Fri, 26 May 2023 06:39:41 +0200 Subject: [PATCH] test combination of kas menu and KAS_WORK_DIR This patch adds two tests of the kas menu plugin in combination with KAS_WORK_DIR. Reported-by: Peter Hoyes Signed-off-by: Felix Moessbauer Signed-off-by: Jan Kiszka --- tests/test_menu.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/test_menu.py b/tests/test_menu.py index 98ad82b..11102e2 100644 --- a/tests/test_menu.py +++ b/tests/test_menu.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +import os import shutil import snack import pytest @@ -79,3 +80,23 @@ def test_menu(monkeypatch, tmpdir): kas.kas(['menu']) assert file_contains('build/conf/local.conf', 'OPT1 = "1"\n') assert check_bitbake_options('-c build target2\n') + + +def test_menu_inc_workdir(monkeypatch, tmpdir): + tdir = str(tmpdir / 'test_menu_inc') + kas_workdir = str(tmpdir / 'test_menu_inc' / 'out') + shutil.copytree('tests/test_menu', tdir) + monkeypatch.chdir(tdir) + os.mkdir(kas_workdir) + os.environ['KAS_WORK_DIR'] = kas_workdir + kas.kas(['menu']) + del os.environ['KAS_WORK_DIR'] + + +def test_menu_implicit_workdir(monkeypatch, tmpdir): + tdir = str(tmpdir / 'test_menu_iwd') + kas_workdir = str(tmpdir / 'test_menu_iwd_out') + shutil.copytree('tests/test_menu', tdir) + os.mkdir(kas_workdir) + monkeypatch.chdir(kas_workdir) + kas.kas(['menu', tdir + '/Kconfig'])