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 <Peter.Hoyes@arm.com>
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Felix Moessbauer 2023-05-26 06:39:41 +02:00 committed by Jan Kiszka
parent 76db0706f3
commit e274886ab0

View File

@ -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'])