summaryrefslogtreecommitdiffstats
path: root/lib/oeqa/selftest/cases/testutils.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oeqa/selftest/cases/testutils.py')
-rw-r--r--lib/oeqa/selftest/cases/testutils.py25
1 files changed, 11 insertions, 14 deletions
diff --git a/lib/oeqa/selftest/cases/testutils.py b/lib/oeqa/selftest/cases/testutils.py
index f8b1904..900d15c 100644
--- a/lib/oeqa/selftest/cases/testutils.py
+++ b/lib/oeqa/selftest/cases/testutils.py
@@ -1,4 +1,5 @@
1import os 1import os
2import oe.path
2import logging 3import logging
3import re 4import re
4import subprocess 5import subprocess
@@ -72,20 +73,16 @@ def akt_native_run(testInst, cmd, **kwargs):
72 # run a command supplied by aktualizr-native and checks that: 73 # run a command supplied by aktualizr-native and checks that:
73 # - the executable exists 74 # - the executable exists
74 # - the command runs without error 75 # - the command runs without error
75 # NOTE: the base test class must have built aktualizr-native (in 76 #
76 # setUpClass, for example) 77 # Requirements in base test class (setUpClass for example):
77 bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'base_prefix', 'libdir', 'bindir'], 78 # bitbake aktualizr-native
78 'aktualizr-native') 79 # bitbake build-sysroots -c build_native_sysroot
79 sysroot = bb_vars['SYSROOT_DESTDIR'] + bb_vars['base_prefix'] 80 #
80 sysrootbin = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] 81 # (technique found in poky/meta/lib/oeqa/selftest/cases/package.py)
81 libdir = bb_vars['libdir'] 82 bb_vars = get_bb_vars(['STAGING_DIR', 'BUILD_ARCH'])
82 83 sysroot = oe.path.join(bb_vars['STAGING_DIR'], bb_vars['BUILD_ARCH'])
83 program, *_ = cmd.split(' ') 84
84 p = '{}/{}'.format(sysrootbin, program) 85 result = runCmd(cmd, native_sysroot=sysroot, ignore_status=True, **kwargs)
85 testInst.assertTrue(os.path.isfile(p), msg="No {} found ({})".format(program, p))
86 env = dict(os.environ)
87 env['LD_LIBRARY_PATH'] = libdir
88 result = runCmd(cmd, env=env, native_sysroot=sysroot, ignore_status=True, **kwargs)
89 testInst.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) 86 testInst.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output)
90 87
91 88