summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/lib/oeqa/selftest/archiver.py7
-rw-r--r--meta/lib/oeqa/selftest/bbtests.py24
-rw-r--r--meta/lib/oeqa/selftest/buildhistory.py5
-rw-r--r--meta/lib/oeqa/selftest/buildoptions.py10
-rw-r--r--meta/lib/oeqa/selftest/devtool.py57
-rw-r--r--meta/lib/oeqa/selftest/eSDK.py15
-rw-r--r--meta/lib/oeqa/selftest/liboe.py21
-rw-r--r--meta/lib/oeqa/selftest/manifest.py7
-rw-r--r--meta/lib/oeqa/selftest/pkgdata.py11
-rw-r--r--meta/lib/oeqa/selftest/prservice.py9
-rw-r--r--meta/lib/oeqa/selftest/recipetool.py34
-rw-r--r--meta/lib/oeqa/selftest/runtime-test.py15
-rw-r--r--meta/lib/oeqa/selftest/signing.py12
-rw-r--r--meta/lib/oeqa/selftest/sstate.py20
-rw-r--r--meta/lib/oeqa/selftest/sstatetests.py92
-rw-r--r--meta/lib/oeqa/selftest/tinfoil.py2
-rw-r--r--meta/lib/oeqa/selftest/wic.py39
17 files changed, 206 insertions, 174 deletions
diff --git a/meta/lib/oeqa/selftest/archiver.py b/meta/lib/oeqa/selftest/archiver.py
index 97b6f5b212..d7f215cbf6 100644
--- a/meta/lib/oeqa/selftest/archiver.py
+++ b/meta/lib/oeqa/selftest/archiver.py
@@ -1,5 +1,5 @@
1from oeqa.selftest.base import oeSelfTest 1from oeqa.selftest.base import oeSelfTest
2from oeqa.utils.commands import bitbake, get_bb_var 2from oeqa.utils.commands import bitbake, get_bb_vars
3from oeqa.utils.decorators import testcase 3from oeqa.utils.decorators import testcase
4import glob 4import glob
5import os 5import os
@@ -28,10 +28,11 @@ class Archiver(oeSelfTest):
28 features += 'COPYLEFT_PN_EXCLUDE = "%s"\n' % exclude_recipe 28 features += 'COPYLEFT_PN_EXCLUDE = "%s"\n' % exclude_recipe
29 self.write_config(features) 29 self.write_config(features)
30 30
31 shutil.rmtree(get_bb_var('TMPDIR')) 31 bitbake('-c clean %s %s' % (include_recipe, exclude_recipe))
32 bitbake("%s %s" % (include_recipe, exclude_recipe)) 32 bitbake("%s %s" % (include_recipe, exclude_recipe))
33 33
34 src_path = os.path.join(get_bb_var('DEPLOY_DIR_SRC'), get_bb_var('TARGET_SYS')) 34 bb_vars = get_bb_vars(['DEPLOY_DIR_SRC', 'TARGET_SYS'])
35 src_path = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['TARGET_SYS'])
35 36
36 # Check that include_recipe was included 37 # Check that include_recipe was included
37 included_present = len(glob.glob(src_path + '/%s-*' % include_recipe)) 38 included_present = len(glob.glob(src_path + '/%s-*' % include_recipe))
diff --git a/meta/lib/oeqa/selftest/bbtests.py b/meta/lib/oeqa/selftest/bbtests.py
index 7675563b45..4d9eec130a 100644
--- a/meta/lib/oeqa/selftest/bbtests.py
+++ b/meta/lib/oeqa/selftest/bbtests.py
@@ -3,7 +3,7 @@ import re
3 3
4import oeqa.utils.ftools as ftools 4import oeqa.utils.ftools as ftools
5from oeqa.selftest.base import oeSelfTest 5from oeqa.selftest.base import oeSelfTest
6from oeqa.utils.commands import runCmd, bitbake, get_bb_var 6from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars
7from oeqa.utils.decorators import testcase 7from oeqa.utils.decorators import testcase
8 8
9class BitbakeTests(oeSelfTest): 9class BitbakeTests(oeSelfTest):
@@ -78,9 +78,10 @@ class BitbakeTests(oeSelfTest):
78 # test 1 from bug 5875 78 # test 1 from bug 5875
79 test_recipe = 'zlib' 79 test_recipe = 'zlib'
80 test_data = "Microsoft Made No Profit From Anyone's Zunes Yo" 80 test_data = "Microsoft Made No Profit From Anyone's Zunes Yo"
81 image_dir = get_bb_var('D', test_recipe) 81 bb_vars = get_bb_vars(['D', 'PKGDEST', 'mandir'], test_recipe)
82 pkgsplit_dir = get_bb_var('PKGDEST', test_recipe) 82 image_dir = bb_vars['D']
83 man_dir = get_bb_var('mandir', test_recipe) 83 pkgsplit_dir = bb_vars['PKGDEST']
84 man_dir = bb_vars['mandir']
84 85
85 bitbake('-c clean %s' % test_recipe) 86 bitbake('-c clean %s' % test_recipe)
86 bitbake('-c package -f %s' % test_recipe) 87 bitbake('-c package -f %s' % test_recipe)
@@ -121,8 +122,9 @@ class BitbakeTests(oeSelfTest):
121 @testcase(899) 122 @testcase(899)
122 def test_image_manifest(self): 123 def test_image_manifest(self):
123 bitbake('core-image-minimal') 124 bitbake('core-image-minimal')
124 deploydir = get_bb_var("DEPLOY_DIR_IMAGE", target="core-image-minimal") 125 bb_vars = get_bb_vars(["DEPLOY_DIR_IMAGE", "IMAGE_LINK_NAME"], "core-image-minimal")
125 imagename = get_bb_var("IMAGE_LINK_NAME", target="core-image-minimal") 126 deploydir = bb_vars["DEPLOY_DIR_IMAGE"]
127 imagename = bb_vars["IMAGE_LINK_NAME"]
126 manifest = os.path.join(deploydir, imagename + ".manifest") 128 manifest = os.path.join(deploydir, imagename + ".manifest")
127 self.assertTrue(os.path.islink(manifest), msg="No manifest file created for image. It should have been created in %s" % manifest) 129 self.assertTrue(os.path.islink(manifest), msg="No manifest file created for image. It should have been created in %s" % manifest)
128 130
@@ -160,8 +162,9 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\"
160 result = bitbake('-c fetch aspell', ignore_status=True) 162 result = bitbake('-c fetch aspell', ignore_status=True)
161 self.delete_recipeinc('aspell') 163 self.delete_recipeinc('aspell')
162 self.assertEqual(result.status, 0, msg = "Couldn't fetch aspell. %s" % result.output) 164 self.assertEqual(result.status, 0, msg = "Couldn't fetch aspell. %s" % result.output)
163 self.assertTrue(os.path.isfile(os.path.join(get_bb_var("DL_DIR"), 'test-aspell.tar.gz')), msg = "File rename failed. No corresponding test-aspell.tar.gz file found under %s" % str(get_bb_var("DL_DIR"))) 165 dl_dir = get_bb_var("DL_DIR")
164 self.assertTrue(os.path.isfile(os.path.join(get_bb_var("DL_DIR"), 'test-aspell.tar.gz.done')), "File rename failed. No corresponding test-aspell.tar.gz.done file found under %s" % str(get_bb_var("DL_DIR"))) 166 self.assertTrue(os.path.isfile(os.path.join(dl_dir, 'test-aspell.tar.gz')), msg = "File rename failed. No corresponding test-aspell.tar.gz file found under %s" % dl_dir)
167 self.assertTrue(os.path.isfile(os.path.join(dl_dir, 'test-aspell.tar.gz.done')), "File rename failed. No corresponding test-aspell.tar.gz.done file found under %s" % dl_dir)
165 168
166 @testcase(1028) 169 @testcase(1028)
167 def test_environment(self): 170 def test_environment(self):
@@ -253,8 +256,9 @@ INHERIT_remove = \"report-error\"
253 def test_bbappend_order(self): 256 def test_bbappend_order(self):
254 """ Bitbake should bbappend to recipe in a predictable order """ 257 """ Bitbake should bbappend to recipe in a predictable order """
255 test_recipe = 'ed' 258 test_recipe = 'ed'
256 test_recipe_summary_before = get_bb_var('SUMMARY', test_recipe) 259 bb_vars = get_bb_vars(['SUMMARY', 'PV'], test_recipe)
257 test_recipe_pv = get_bb_var('PV', test_recipe) 260 test_recipe_summary_before = bb_vars['SUMMARY']
261 test_recipe_pv = bb_vars['PV']
258 recipe_append_file = test_recipe + '_' + test_recipe_pv + '.bbappend' 262 recipe_append_file = test_recipe + '_' + test_recipe_pv + '.bbappend'
259 expected_recipe_summary = test_recipe_summary_before 263 expected_recipe_summary = test_recipe_summary_before
260 264
diff --git a/meta/lib/oeqa/selftest/buildhistory.py b/meta/lib/oeqa/selftest/buildhistory.py
index 674da6205a..008c39c956 100644
--- a/meta/lib/oeqa/selftest/buildhistory.py
+++ b/meta/lib/oeqa/selftest/buildhistory.py
@@ -3,14 +3,15 @@ import re
3import datetime 3import datetime
4 4
5from oeqa.selftest.base import oeSelfTest 5from oeqa.selftest.base import oeSelfTest
6from oeqa.utils.commands import bitbake, get_bb_var 6from oeqa.utils.commands import bitbake, get_bb_vars
7from oeqa.utils.decorators import testcase 7from oeqa.utils.decorators import testcase
8 8
9 9
10class BuildhistoryBase(oeSelfTest): 10class BuildhistoryBase(oeSelfTest):
11 11
12 def config_buildhistory(self, tmp_bh_location=False): 12 def config_buildhistory(self, tmp_bh_location=False):
13 if (not 'buildhistory' in get_bb_var('USER_CLASSES')) and (not 'buildhistory' in get_bb_var('INHERIT')): 13 bb_vars = get_bb_vars(['USER_CLASSES', 'INHERIT'])
14 if (not 'buildhistory' in bb_vars['USER_CLASSES']) and (not 'buildhistory' in bb_vars['INHERIT']):
14 add_buildhistory_config = 'INHERIT += "buildhistory"\nBUILDHISTORY_COMMIT = "1"' 15 add_buildhistory_config = 'INHERIT += "buildhistory"\nBUILDHISTORY_COMMIT = "1"'
15 self.append_config(add_buildhistory_config) 16 self.append_config(add_buildhistory_config)
16 17
diff --git a/meta/lib/oeqa/selftest/buildoptions.py b/meta/lib/oeqa/selftest/buildoptions.py
index 28734fd1f0..568882ba8f 100644
--- a/meta/lib/oeqa/selftest/buildoptions.py
+++ b/meta/lib/oeqa/selftest/buildoptions.py
@@ -5,7 +5,7 @@ import shutil
5import tempfile 5import tempfile
6from oeqa.selftest.base import oeSelfTest 6from oeqa.selftest.base import oeSelfTest
7from oeqa.selftest.buildhistory import BuildhistoryBase 7from oeqa.selftest.buildhistory import BuildhistoryBase
8from oeqa.utils.commands import runCmd, bitbake, get_bb_var 8from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars
9import oeqa.utils.ftools as ftools 9import oeqa.utils.ftools as ftools
10from oeqa.utils.decorators import testcase 10from oeqa.utils.decorators import testcase
11 11
@@ -33,13 +33,15 @@ class ImageOptionsTests(oeSelfTest):
33 @testcase(286) 33 @testcase(286)
34 def test_ccache_tool(self): 34 def test_ccache_tool(self):
35 bitbake("ccache-native") 35 bitbake("ccache-native")
36 p = get_bb_var('SYSROOT_DESTDIR', 'ccache-native') + get_bb_var('bindir', 'ccache-native') + "/" + "ccache" 36 bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'ccache-native')
37 p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "ccache"
37 self.assertTrue(os.path.isfile(p), msg = "No ccache found (%s)" % p) 38 self.assertTrue(os.path.isfile(p), msg = "No ccache found (%s)" % p)
38 self.write_config('INHERIT += "ccache"') 39 self.write_config('INHERIT += "ccache"')
39 self.add_command_to_tearDown('bitbake -c clean m4') 40 self.add_command_to_tearDown('bitbake -c clean m4')
40 bitbake("m4 -f -c compile") 41 bitbake("m4 -f -c compile")
41 res = runCmd("grep ccache %s" % (os.path.join(get_bb_var("WORKDIR","m4"),"temp/log.do_compile")), ignore_status=True) 42 log_compile = os.path.join(get_bb_var("WORKDIR","m4"), "temp/log.do_compile")
42 self.assertEqual(0, res.status, msg="No match for ccache in m4 log.do_compile. For further details: %s" % os.path.join(get_bb_var("WORKDIR","m4"),"temp/log.do_compile")) 43 res = runCmd("grep ccache %s" % log_compile, ignore_status=True)
44 self.assertEqual(0, res.status, msg="No match for ccache in m4 log.do_compile. For further details: %s" % log_compile)
43 45
44 @testcase(1435) 46 @testcase(1435)
45 def test_read_only_image(self): 47 def test_read_only_image(self):
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py
index 8bf9f05bb9..f1661efeb1 100644
--- a/meta/lib/oeqa/selftest/devtool.py
+++ b/meta/lib/oeqa/selftest/devtool.py
@@ -213,9 +213,10 @@ class DevtoolTests(DevtoolBase):
213 bitbake('pv -c cleansstate') 213 bitbake('pv -c cleansstate')
214 # Test devtool build 214 # Test devtool build
215 result = runCmd('devtool build pv') 215 result = runCmd('devtool build pv')
216 installdir = get_bb_var('D', 'pv') 216 bb_vars = get_bb_vars(['D', 'bindir'], 'pv')
217 installdir = bb_vars['D']
217 self.assertTrue(installdir, 'Could not query installdir variable') 218 self.assertTrue(installdir, 'Could not query installdir variable')
218 bindir = get_bb_var('bindir', 'pv') 219 bindir = bb_vars['bindir']
219 self.assertTrue(bindir, 'Could not query bindir variable') 220 self.assertTrue(bindir, 'Could not query bindir variable')
220 if bindir[0] == '/': 221 if bindir[0] == '/':
221 bindir = bindir[1:] 222 bindir = bindir[1:]
@@ -296,11 +297,12 @@ class DevtoolTests(DevtoolBase):
296 f.write('\nTESTLIBOUTPUT = "${STAGING_DIR}-components/${TUNE_PKGARCH}/${PN}/${libdir}"\n') 297 f.write('\nTESTLIBOUTPUT = "${STAGING_DIR}-components/${TUNE_PKGARCH}/${PN}/${libdir}"\n')
297 # Test devtool build 298 # Test devtool build
298 result = runCmd('devtool build libftdi') 299 result = runCmd('devtool build libftdi')
299 staging_libdir = get_bb_var('TESTLIBOUTPUT', 'libftdi') 300 bb_vars = get_bb_vars(['TESTLIBOUTPUT', 'STAMP'], 'libftdi')
301 staging_libdir = bb_vars['TESTLIBOUTPUT']
300 self.assertTrue(staging_libdir, 'Could not query TESTLIBOUTPUT variable') 302 self.assertTrue(staging_libdir, 'Could not query TESTLIBOUTPUT variable')
301 self.assertTrue(os.path.isfile(os.path.join(staging_libdir, 'libftdi1.so.2.1.0')), "libftdi binary not found in STAGING_LIBDIR. Output of devtool build libftdi %s" % result.output) 303 self.assertTrue(os.path.isfile(os.path.join(staging_libdir, 'libftdi1.so.2.1.0')), "libftdi binary not found in STAGING_LIBDIR. Output of devtool build libftdi %s" % result.output)
302 # Test devtool reset 304 # Test devtool reset
303 stampprefix = get_bb_var('STAMP', 'libftdi') 305 stampprefix = bb_vars['STAMP']
304 result = runCmd('devtool reset libftdi') 306 result = runCmd('devtool reset libftdi')
305 result = runCmd('devtool status') 307 result = runCmd('devtool status')
306 self.assertNotIn('libftdi', result.output) 308 self.assertNotIn('libftdi', result.output)
@@ -463,9 +465,10 @@ class DevtoolTests(DevtoolBase):
463 self.assertNotIn(expected + '\n', f, message) 465 self.assertNotIn(expected + '\n', f, message)
464 466
465 modfile = os.path.join(tempdir, 'mdadm.8.in') 467 modfile = os.path.join(tempdir, 'mdadm.8.in')
466 pkgd = get_bb_var('PKGD', 'mdadm') 468 bb_vars = get_bb_vars(['PKGD', 'mandir'], 'mdadm')
469 pkgd = bb_vars['PKGD']
467 self.assertTrue(pkgd, 'Could not query PKGD variable') 470 self.assertTrue(pkgd, 'Could not query PKGD variable')
468 mandir = get_bb_var('mandir', 'mdadm') 471 mandir = bb_vars['mandir']
469 self.assertTrue(mandir, 'Could not query mandir variable') 472 self.assertTrue(mandir, 'Could not query mandir variable')
470 manfile = oe.path.join(pkgd, mandir, 'man8', 'mdadm.8') 473 manfile = oe.path.join(pkgd, mandir, 'man8', 'mdadm.8')
471 474
@@ -679,8 +682,9 @@ class DevtoolTests(DevtoolBase):
679 def test_devtool_update_recipe(self): 682 def test_devtool_update_recipe(self):
680 # Check preconditions 683 # Check preconditions
681 testrecipe = 'minicom' 684 testrecipe = 'minicom'
682 recipefile = get_bb_var('FILE', testrecipe) 685 bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe)
683 src_uri = get_bb_var('SRC_URI', testrecipe) 686 recipefile = bb_vars['FILE']
687 src_uri = bb_vars['SRC_URI']
684 self.assertNotIn('git://', src_uri, 'This test expects the %s recipe to NOT be a git recipe' % testrecipe) 688 self.assertNotIn('git://', src_uri, 'This test expects the %s recipe to NOT be a git recipe' % testrecipe)
685 self._check_repo_status(os.path.dirname(recipefile), []) 689 self._check_repo_status(os.path.dirname(recipefile), [])
686 # First, modify a recipe 690 # First, modify a recipe
@@ -711,8 +715,9 @@ class DevtoolTests(DevtoolBase):
711 def test_devtool_update_recipe_git(self): 715 def test_devtool_update_recipe_git(self):
712 # Check preconditions 716 # Check preconditions
713 testrecipe = 'mtd-utils' 717 testrecipe = 'mtd-utils'
714 recipefile = get_bb_var('FILE', testrecipe) 718 bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe)
715 src_uri = get_bb_var('SRC_URI', testrecipe) 719 recipefile = bb_vars['FILE']
720 src_uri = bb_vars['SRC_URI']
716 self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe) 721 self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe)
717 patches = [] 722 patches = []
718 for entry in src_uri.split(): 723 for entry in src_uri.split():
@@ -780,8 +785,9 @@ class DevtoolTests(DevtoolBase):
780 def test_devtool_update_recipe_append(self): 785 def test_devtool_update_recipe_append(self):
781 # Check preconditions 786 # Check preconditions
782 testrecipe = 'mdadm' 787 testrecipe = 'mdadm'
783 recipefile = get_bb_var('FILE', testrecipe) 788 bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe)
784 src_uri = get_bb_var('SRC_URI', testrecipe) 789 recipefile = bb_vars['FILE']
790 src_uri = bb_vars['SRC_URI']
785 self.assertNotIn('git://', src_uri, 'This test expects the %s recipe to NOT be a git recipe' % testrecipe) 791 self.assertNotIn('git://', src_uri, 'This test expects the %s recipe to NOT be a git recipe' % testrecipe)
786 self._check_repo_status(os.path.dirname(recipefile), []) 792 self._check_repo_status(os.path.dirname(recipefile), [])
787 # First, modify a recipe 793 # First, modify a recipe
@@ -848,8 +854,9 @@ class DevtoolTests(DevtoolBase):
848 def test_devtool_update_recipe_append_git(self): 854 def test_devtool_update_recipe_append_git(self):
849 # Check preconditions 855 # Check preconditions
850 testrecipe = 'mtd-utils' 856 testrecipe = 'mtd-utils'
851 recipefile = get_bb_var('FILE', testrecipe) 857 bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe)
852 src_uri = get_bb_var('SRC_URI', testrecipe) 858 recipefile = bb_vars['FILE']
859 src_uri = bb_vars['SRC_URI']
853 self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe) 860 self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe)
854 for entry in src_uri.split(): 861 for entry in src_uri.split():
855 if entry.startswith('git://'): 862 if entry.startswith('git://'):
@@ -1009,8 +1016,9 @@ class DevtoolTests(DevtoolBase):
1009 def test_devtool_update_recipe_local_files_3(self): 1016 def test_devtool_update_recipe_local_files_3(self):
1010 # First, modify the recipe 1017 # First, modify the recipe
1011 testrecipe = 'devtool-test-localonly' 1018 testrecipe = 'devtool-test-localonly'
1012 recipefile = get_bb_var('FILE', testrecipe) 1019 bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe)
1013 src_uri = get_bb_var('SRC_URI', testrecipe) 1020 recipefile = bb_vars['FILE']
1021 src_uri = bb_vars['SRC_URI']
1014 tempdir = tempfile.mkdtemp(prefix='devtoolqa') 1022 tempdir = tempfile.mkdtemp(prefix='devtoolqa')
1015 self.track_for_cleanup(tempdir) 1023 self.track_for_cleanup(tempdir)
1016 self.track_for_cleanup(self.workspacedir) 1024 self.track_for_cleanup(self.workspacedir)
@@ -1027,8 +1035,9 @@ class DevtoolTests(DevtoolBase):
1027 def test_devtool_update_recipe_local_patch_gz(self): 1035 def test_devtool_update_recipe_local_patch_gz(self):
1028 # First, modify the recipe 1036 # First, modify the recipe
1029 testrecipe = 'devtool-test-patch-gz' 1037 testrecipe = 'devtool-test-patch-gz'
1030 recipefile = get_bb_var('FILE', testrecipe) 1038 bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe)
1031 src_uri = get_bb_var('SRC_URI', testrecipe) 1039 recipefile = bb_vars['FILE']
1040 src_uri = bb_vars['SRC_URI']
1032 tempdir = tempfile.mkdtemp(prefix='devtoolqa') 1041 tempdir = tempfile.mkdtemp(prefix='devtoolqa')
1033 self.track_for_cleanup(tempdir) 1042 self.track_for_cleanup(tempdir)
1034 self.track_for_cleanup(self.workspacedir) 1043 self.track_for_cleanup(self.workspacedir)
@@ -1054,8 +1063,9 @@ class DevtoolTests(DevtoolBase):
1054 # was also in SRC_URI 1063 # was also in SRC_URI
1055 # First, modify the recipe 1064 # First, modify the recipe
1056 testrecipe = 'devtool-test-subdir' 1065 testrecipe = 'devtool-test-subdir'
1057 recipefile = get_bb_var('FILE', testrecipe) 1066 bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe)
1058 src_uri = get_bb_var('SRC_URI', testrecipe) 1067 recipefile = bb_vars['FILE']
1068 src_uri = bb_vars['SRC_URI']
1059 tempdir = tempfile.mkdtemp(prefix='devtoolqa') 1069 tempdir = tempfile.mkdtemp(prefix='devtoolqa')
1060 self.track_for_cleanup(tempdir) 1070 self.track_for_cleanup(tempdir)
1061 self.track_for_cleanup(self.workspacedir) 1071 self.track_for_cleanup(self.workspacedir)
@@ -1184,9 +1194,10 @@ class DevtoolTests(DevtoolBase):
1184 result = runCmd('ssh %s root@%s %s' % (sshargs, qemu.ip, testcommand)) 1194 result = runCmd('ssh %s root@%s %s' % (sshargs, qemu.ip, testcommand))
1185 # Check if it deployed all of the files with the right ownership/perms 1195 # Check if it deployed all of the files with the right ownership/perms
1186 # First look on the host - need to do this under pseudo to get the correct ownership/perms 1196 # First look on the host - need to do this under pseudo to get the correct ownership/perms
1187 installdir = get_bb_var('D', testrecipe) 1197 bb_vars = get_bb_vars(['D', 'FAKEROOTENV', 'FAKEROOTCMD'], testrecipe)
1188 fakerootenv = get_bb_var('FAKEROOTENV', testrecipe) 1198 installdir = bb_vars['D']
1189 fakerootcmd = get_bb_var('FAKEROOTCMD', testrecipe) 1199 fakerootenv = bb_vars['FAKEROOTENV']
1200 fakerootcmd = bb_vars['FAKEROOTCMD']
1190 result = runCmd('%s %s find . -type f -exec ls -l {} \;' % (fakerootenv, fakerootcmd), cwd=installdir) 1201 result = runCmd('%s %s find . -type f -exec ls -l {} \;' % (fakerootenv, fakerootcmd), cwd=installdir)
1191 filelist1 = self._process_ls_output(result.output) 1202 filelist1 = self._process_ls_output(result.output)
1192 1203
diff --git a/meta/lib/oeqa/selftest/eSDK.py b/meta/lib/oeqa/selftest/eSDK.py
index b68e997ba9..a66ff92140 100644
--- a/meta/lib/oeqa/selftest/eSDK.py
+++ b/meta/lib/oeqa/selftest/eSDK.py
@@ -6,9 +6,9 @@ import glob
6import logging 6import logging
7import subprocess 7import subprocess
8import oeqa.utils.ftools as ftools 8import oeqa.utils.ftools as ftools
9from oeqa.utils.decorators import testcase 9from oeqa.utils.decorators import testcase
10from oeqa.selftest.base import oeSelfTest 10from oeqa.selftest.base import oeSelfTest
11from oeqa.utils.commands import runCmd, bitbake, get_bb_var 11from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars
12from oeqa.utils.httpserver import HTTPService 12from oeqa.utils.httpserver import HTTPService
13 13
14class oeSDKExtSelfTest(oeSelfTest): 14class oeSDKExtSelfTest(oeSelfTest):
@@ -24,7 +24,7 @@ class oeSDKExtSelfTest(oeSelfTest):
24 # what environment load oe-selftest, i586, x86_64 24 # what environment load oe-selftest, i586, x86_64
25 pattern = os.path.join(tmpdir_eSDKQA, 'environment-setup-*') 25 pattern = os.path.join(tmpdir_eSDKQA, 'environment-setup-*')
26 return glob.glob(pattern)[0] 26 return glob.glob(pattern)[0]
27 27
28 @staticmethod 28 @staticmethod
29 def run_esdk_cmd(env_eSDK, tmpdir_eSDKQA, cmd, postconfig=None, **options): 29 def run_esdk_cmd(env_eSDK, tmpdir_eSDKQA, cmd, postconfig=None, **options):
30 if postconfig: 30 if postconfig:
@@ -47,10 +47,11 @@ class oeSDKExtSelfTest(oeSelfTest):
47 def get_eSDK_toolchain(image): 47 def get_eSDK_toolchain(image):
48 pn_task = '%s -c populate_sdk_ext' % image 48 pn_task = '%s -c populate_sdk_ext' % image
49 49
50 sdk_deploy = get_bb_var('SDK_DEPLOY', pn_task) 50 bb_vars = get_bb_vars(['SDK_DEPLOY', 'TOOLCHAINEXT_OUTPUTNAME'], pn_task)
51 toolchain_name = get_bb_var('TOOLCHAINEXT_OUTPUTNAME', pn_task) 51 sdk_deploy = bb_vars['SDK_DEPLOY']
52 toolchain_name = bb_vars['TOOLCHAINEXT_OUTPUTNAME']
52 return os.path.join(sdk_deploy, toolchain_name + '.sh') 53 return os.path.join(sdk_deploy, toolchain_name + '.sh')
53 54
54 @staticmethod 55 @staticmethod
55 def update_configuration(cls, image, tmpdir_eSDKQA, env_eSDK, ext_sdk_path): 56 def update_configuration(cls, image, tmpdir_eSDKQA, env_eSDK, ext_sdk_path):
56 sstate_dir = os.path.join(os.environ['BUILDDIR'], 'sstate-cache') 57 sstate_dir = os.path.join(os.environ['BUILDDIR'], 'sstate-cache')
@@ -119,7 +120,7 @@ SSTATE_MIRRORS = "file://.* http://%s/PATH"
119 bitbake(pn_sstate) 120 bitbake(pn_sstate)
120 cmd = "devtool sdk-install %s " % pn_sstate 121 cmd = "devtool sdk-install %s " % pn_sstate
121 oeSDKExtSelfTest.run_esdk_cmd(self.env_eSDK, self.tmpdir_eSDKQA, cmd) 122 oeSDKExtSelfTest.run_esdk_cmd(self.env_eSDK, self.tmpdir_eSDKQA, cmd)
122 123
123 @testcase(1603) 124 @testcase(1603)
124 def test_image_generation_binary_feeds(self): 125 def test_image_generation_binary_feeds(self):
125 image = 'core-image-minimal' 126 image = 'core-image-minimal'
diff --git a/meta/lib/oeqa/selftest/liboe.py b/meta/lib/oeqa/selftest/liboe.py
index cd12cd25b3..0b0301def6 100644
--- a/meta/lib/oeqa/selftest/liboe.py
+++ b/meta/lib/oeqa/selftest/liboe.py
@@ -1,11 +1,16 @@
1from oeqa.selftest.base import oeSelfTest 1from oeqa.selftest.base import oeSelfTest
2from oeqa.utils.commands import get_bb_var, bitbake, runCmd 2from oeqa.utils.commands import get_bb_var, get_bb_vars, bitbake, runCmd
3import oe.path 3import oe.path
4import glob 4import glob
5import os 5import os
6import os.path 6import os.path
7 7
8class LibOE(oeSelfTest): 8class LibOE(oeSelfTest):
9
10 @classmethod
11 def setUpClass(cls):
12 cls.tmp_dir = get_bb_var('TMPDIR')
13
9 def test_copy_tree_special(self): 14 def test_copy_tree_special(self):
10 """ 15 """
11 Summary: oe.path.copytree() should copy files with special character 16 Summary: oe.path.copytree() should copy files with special character
@@ -14,8 +19,7 @@ class LibOE(oeSelfTest):
14 Product: OE-Core 19 Product: OE-Core
15 Author: Joshua Lock <joshua.g.lock@intel.com> 20 Author: Joshua Lock <joshua.g.lock@intel.com>
16 """ 21 """
17 tmp_dir = get_bb_var('TMPDIR') 22 testloc = oe.path.join(self.tmp_dir, 'liboetests')
18 testloc = oe.path.join(tmp_dir, 'liboetests')
19 src = oe.path.join(testloc, 'src') 23 src = oe.path.join(testloc, 'src')
20 dst = oe.path.join(testloc, 'dst') 24 dst = oe.path.join(testloc, 'dst')
21 bb.utils.mkdirhier(testloc) 25 bb.utils.mkdirhier(testloc)
@@ -40,8 +44,7 @@ class LibOE(oeSelfTest):
40 Product: OE-Core 44 Product: OE-Core
41 Author: Joshua Lock <joshua.g.lock@intel.com> 45 Author: Joshua Lock <joshua.g.lock@intel.com>
42 """ 46 """
43 tmp_dir = get_bb_var('TMPDIR') 47 testloc = oe.path.join(self.tmp_dir, 'liboetests')
44 testloc = oe.path.join(tmp_dir, 'liboetests')
45 src = oe.path.join(testloc, 'src') 48 src = oe.path.join(testloc, 'src')
46 dst = oe.path.join(testloc, 'dst') 49 dst = oe.path.join(testloc, 'dst')
47 bb.utils.mkdirhier(testloc) 50 bb.utils.mkdirhier(testloc)
@@ -51,8 +54,9 @@ class LibOE(oeSelfTest):
51 # ensure we have setfattr available 54 # ensure we have setfattr available
52 bitbake("attr-native") 55 bitbake("attr-native")
53 56
54 destdir = get_bb_var('SYSROOT_DESTDIR', 'attr-native') 57 bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'attr-native')
55 bindir = get_bb_var('bindir', 'attr-native') 58 destdir = bb_vars['SYSROOT_DESTDIR']
59 bindir = bb_vars['bindir']
56 bindir = destdir + bindir 60 bindir = destdir + bindir
57 61
58 # create a file with xattr and copy it 62 # create a file with xattr and copy it
@@ -73,8 +77,7 @@ class LibOE(oeSelfTest):
73 Product: OE-Core 77 Product: OE-Core
74 Author: Joshua Lock <joshua.g.lock@intel.com> 78 Author: Joshua Lock <joshua.g.lock@intel.com>
75 """ 79 """
76 tmp_dir = get_bb_var('TMPDIR') 80 testloc = oe.path.join(self.tmp_dir, 'liboetests')
77 testloc = oe.path.join(tmp_dir, 'liboetests')
78 src = oe.path.join(testloc, 'src') 81 src = oe.path.join(testloc, 'src')
79 dst = oe.path.join(testloc, 'dst') 82 dst = oe.path.join(testloc, 'dst')
80 bb.utils.mkdirhier(testloc) 83 bb.utils.mkdirhier(testloc)
diff --git a/meta/lib/oeqa/selftest/manifest.py b/meta/lib/oeqa/selftest/manifest.py
index 44d0404c5d..fe6f949644 100644
--- a/meta/lib/oeqa/selftest/manifest.py
+++ b/meta/lib/oeqa/selftest/manifest.py
@@ -2,7 +2,7 @@ import unittest
2import os 2import os
3 3
4from oeqa.selftest.base import oeSelfTest 4from oeqa.selftest.base import oeSelfTest
5from oeqa.utils.commands import get_bb_var, bitbake 5from oeqa.utils.commands import get_bb_var, get_bb_vars, bitbake
6from oeqa.utils.decorators import testcase 6from oeqa.utils.decorators import testcase
7 7
8class ManifestEntry: 8class ManifestEntry:
@@ -84,9 +84,10 @@ class VerifyManifest(oeSelfTest):
84 try: 84 try:
85 mdir = self.get_dir_from_bb_var('SDK_DEPLOY', self.buildtarget) 85 mdir = self.get_dir_from_bb_var('SDK_DEPLOY', self.buildtarget)
86 for k in d_target.keys(): 86 for k in d_target.keys():
87 bb_vars = get_bb_vars(['SDK_NAME', 'SDK_VERSION'], self.buildtarget)
87 mfilename[k] = "{}-toolchain-{}.{}.manifest".format( 88 mfilename[k] = "{}-toolchain-{}.{}.manifest".format(
88 get_bb_var("SDK_NAME", self.buildtarget), 89 bb_vars['SDK_NAME'],
89 get_bb_var("SDK_VERSION", self.buildtarget), 90 bb_vars['SDK_VERSION'],
90 k) 91 k)
91 mpath[k] = os.path.join(mdir, mfilename[k]) 92 mpath[k] = os.path.join(mdir, mfilename[k])
92 if not os.path.isfile(mpath[k]): 93 if not os.path.isfile(mpath[k]):
diff --git a/meta/lib/oeqa/selftest/pkgdata.py b/meta/lib/oeqa/selftest/pkgdata.py
index 3512ce3531..36d8b346d0 100644
--- a/meta/lib/oeqa/selftest/pkgdata.py
+++ b/meta/lib/oeqa/selftest/pkgdata.py
@@ -6,7 +6,7 @@ import fnmatch
6 6
7import oeqa.utils.ftools as ftools 7import oeqa.utils.ftools as ftools
8from oeqa.selftest.base import oeSelfTest 8from oeqa.selftest.base import oeSelfTest
9from oeqa.utils.commands import runCmd, bitbake, get_bb_var 9from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars
10from oeqa.utils.decorators import testcase 10from oeqa.utils.decorators import testcase
11 11
12class OePkgdataUtilTests(oeSelfTest): 12class OePkgdataUtilTests(oeSelfTest):
@@ -126,10 +126,11 @@ class OePkgdataUtilTests(oeSelfTest):
126 curpkg = line.split(':')[0] 126 curpkg = line.split(':')[0]
127 files[curpkg] = [] 127 files[curpkg] = []
128 return files 128 return files
129 base_libdir = get_bb_var('base_libdir') 129 bb_vars = get_bb_vars(['base_libdir', 'libdir', 'includedir', 'mandir'])
130 libdir = get_bb_var('libdir') 130 base_libdir = bb_vars['base_libdir']
131 includedir = get_bb_var('includedir') 131 libdir = bb_vars['libdir']
132 mandir = get_bb_var('mandir') 132 includedir = bb_vars['includedir']
133 mandir = bb_vars['mandir']
133 # Test recipe-space package name 134 # Test recipe-space package name
134 result = runCmd('oe-pkgdata-util list-pkg-files zlib-dev zlib-doc') 135 result = runCmd('oe-pkgdata-util list-pkg-files zlib-dev zlib-doc')
135 files = splitoutput(result.output) 136 files = splitoutput(result.output)
diff --git a/meta/lib/oeqa/selftest/prservice.py b/meta/lib/oeqa/selftest/prservice.py
index 0b2dfe6494..34d419762c 100644
--- a/meta/lib/oeqa/selftest/prservice.py
+++ b/meta/lib/oeqa/selftest/prservice.py
@@ -12,10 +12,13 @@ from oeqa.utils.decorators import testcase
12from oeqa.utils.network import get_free_port 12from oeqa.utils.network import get_free_port
13 13
14class BitbakePrTests(oeSelfTest): 14class BitbakePrTests(oeSelfTest):
15 15
16 @classmethod
17 def setUpClass(cls):
18 cls.pkgdata_dir = get_bb_var('PKGDATA_DIR')
19
16 def get_pr_version(self, package_name): 20 def get_pr_version(self, package_name):
17 pkgdata_dir = get_bb_var('PKGDATA_DIR') 21 package_data_file = os.path.join(self.pkgdata_dir, 'runtime', package_name)
18 package_data_file = os.path.join(pkgdata_dir, 'runtime', package_name)
19 package_data = ftools.read_file(package_data_file) 22 package_data = ftools.read_file(package_data_file)
20 find_pr = re.search("PKGR: r[0-9]+\.([0-9]+)", package_data) 23 find_pr = re.search("PKGR: r[0-9]+\.([0-9]+)", package_data)
21 self.assertTrue(find_pr, "No PKG revision found in %s" % package_data_file) 24 self.assertTrue(find_pr, "No PKG revision found in %s" % package_data_file)
diff --git a/meta/lib/oeqa/selftest/recipetool.py b/meta/lib/oeqa/selftest/recipetool.py
index e8348233ec..d62c8bb603 100644
--- a/meta/lib/oeqa/selftest/recipetool.py
+++ b/meta/lib/oeqa/selftest/recipetool.py
@@ -4,7 +4,8 @@ import shutil
4import tempfile 4import tempfile
5import urllib.parse 5import urllib.parse
6 6
7from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer 7from oeqa.utils.commands import runCmd, bitbake, get_bb_var
8from oeqa.utils.commands import get_bb_vars, create_temp_layer
8from oeqa.utils.decorators import testcase 9from oeqa.utils.decorators import testcase
9from oeqa.selftest import devtool 10from oeqa.selftest import devtool
10 11
@@ -25,6 +26,7 @@ def tearDownModule():
25 26
26 27
27class RecipetoolBase(devtool.DevtoolBase): 28class RecipetoolBase(devtool.DevtoolBase):
29
28 def setUpLocal(self): 30 def setUpLocal(self):
29 self.templayerdir = templayerdir 31 self.templayerdir = templayerdir
30 self.tempdir = tempfile.mkdtemp(prefix='recipetoolqa') 32 self.tempdir = tempfile.mkdtemp(prefix='recipetoolqa')
@@ -65,12 +67,16 @@ class RecipetoolBase(devtool.DevtoolBase):
65 67
66 68
67class RecipetoolTests(RecipetoolBase): 69class RecipetoolTests(RecipetoolBase):
70
68 @classmethod 71 @classmethod
69 def setUpClass(cls): 72 def setUpClass(cls):
70 # Ensure we have the right data in shlibs/pkgdata 73 # Ensure we have the right data in shlibs/pkgdata
71 logger = logging.getLogger("selftest") 74 logger = logging.getLogger("selftest")
72 logger.info('Running bitbake to generate pkgdata') 75 logger.info('Running bitbake to generate pkgdata')
73 bitbake('-c packagedata base-files coreutils busybox selftest-recipetool-appendfile') 76 bitbake('-c packagedata base-files coreutils busybox selftest-recipetool-appendfile')
77 bb_vars = get_bb_vars(['COREBASE', 'BBPATH'])
78 cls.corebase = bb_vars['COREBASE']
79 cls.bbpath = bb_vars['BBPATH']
74 80
75 def _try_recipetool_appendfile(self, testrecipe, destfile, newfile, options, expectedlines, expectedfiles): 81 def _try_recipetool_appendfile(self, testrecipe, destfile, newfile, options, expectedlines, expectedfiles):
76 cmd = 'recipetool appendfile %s %s %s %s' % (self.templayerdir, destfile, newfile, options) 82 cmd = 'recipetool appendfile %s %s %s %s' % (self.templayerdir, destfile, newfile, options)
@@ -104,9 +110,8 @@ class RecipetoolTests(RecipetoolBase):
104 # Now try with a file we know should be an alternative 110 # Now try with a file we know should be an alternative
105 # (this is very much a fake example, but one we know is reliably an alternative) 111 # (this is very much a fake example, but one we know is reliably an alternative)
106 self._try_recipetool_appendfile_fail('/bin/ls', self.testfile, ['ERROR: File /bin/ls is an alternative possibly provided by the following recipes:', 'coreutils', 'busybox']) 112 self._try_recipetool_appendfile_fail('/bin/ls', self.testfile, ['ERROR: File /bin/ls is an alternative possibly provided by the following recipes:', 'coreutils', 'busybox'])
107 corebase = get_bb_var('COREBASE')
108 # Need a test file - should be executable 113 # Need a test file - should be executable
109 testfile2 = os.path.join(corebase, 'oe-init-build-env') 114 testfile2 = os.path.join(self.corebase, 'oe-init-build-env')
110 testfile2name = os.path.basename(testfile2) 115 testfile2name = os.path.basename(testfile2)
111 expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', 116 expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n',
112 '\n', 117 '\n',
@@ -135,7 +140,6 @@ class RecipetoolTests(RecipetoolBase):
135 140
136 @testcase(1173) 141 @testcase(1173)
137 def test_recipetool_appendfile_add(self): 142 def test_recipetool_appendfile_add(self):
138 corebase = get_bb_var('COREBASE')
139 # Try arbitrary file add to a recipe 143 # Try arbitrary file add to a recipe
140 expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', 144 expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n',
141 '\n', 145 '\n',
@@ -148,7 +152,7 @@ class RecipetoolTests(RecipetoolBase):
148 self._try_recipetool_appendfile('netbase', '/usr/share/something', self.testfile, '-r netbase', expectedlines, ['testfile']) 152 self._try_recipetool_appendfile('netbase', '/usr/share/something', self.testfile, '-r netbase', expectedlines, ['testfile'])
149 # Try adding another file, this time where the source file is executable 153 # Try adding another file, this time where the source file is executable
150 # (so we're testing that, plus modifying an existing bbappend) 154 # (so we're testing that, plus modifying an existing bbappend)
151 testfile2 = os.path.join(corebase, 'oe-init-build-env') 155 testfile2 = os.path.join(self.corebase, 'oe-init-build-env')
152 testfile2name = os.path.basename(testfile2) 156 testfile2name = os.path.basename(testfile2)
153 expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', 157 expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n',
154 '\n', 158 '\n',
@@ -500,8 +504,7 @@ class RecipetoolTests(RecipetoolBase):
500 recipetool = runCmd("which recipetool") 504 recipetool = runCmd("which recipetool")
501 fromname = runCmd("recipetool --quiet pluginfile") 505 fromname = runCmd("recipetool --quiet pluginfile")
502 srcfile = fromname.output 506 srcfile = fromname.output
503 bbpath = get_bb_var('BBPATH') 507 searchpath = self.bbpath.split(':') + [os.path.dirname(recipetool.output)]
504 searchpath = bbpath.split(':') + [os.path.dirname(recipetool.output)]
505 plugincontent = [] 508 plugincontent = []
506 with open(srcfile) as fh: 509 with open(srcfile) as fh:
507 plugincontent = fh.readlines() 510 plugincontent = fh.readlines()
@@ -597,17 +600,18 @@ class RecipetoolAppendsrcBase(RecipetoolBase):
597 600
598 self._try_recipetool_appendsrcfiles(testrecipe, newfiles, expectedfiles=expectedfiles, destdir=destdir, options=options) 601 self._try_recipetool_appendsrcfiles(testrecipe, newfiles, expectedfiles=expectedfiles, destdir=destdir, options=options)
599 602
600 src_uri = get_bb_var('SRC_URI', testrecipe).split() 603 bb_vars = get_bb_vars(['SRC_URI', 'FILE', 'FILESEXTRAPATHS'], testrecipe)
604 src_uri = bb_vars['SRC_URI'].split()
601 for f in expectedfiles: 605 for f in expectedfiles:
602 if destdir: 606 if destdir:
603 self.assertIn('file://%s;subdir=%s' % (f, destdir), src_uri) 607 self.assertIn('file://%s;subdir=%s' % (f, destdir), src_uri)
604 else: 608 else:
605 self.assertIn('file://%s' % f, src_uri) 609 self.assertIn('file://%s' % f, src_uri)
606 610
607 recipefile = get_bb_var('FILE', testrecipe) 611 recipefile = bb_vars['FILE']
608 bbappendfile = self._check_bbappend(testrecipe, recipefile, self.templayerdir) 612 bbappendfile = self._check_bbappend(testrecipe, recipefile, self.templayerdir)
609 filesdir = os.path.join(os.path.dirname(bbappendfile), testrecipe) 613 filesdir = os.path.join(os.path.dirname(bbappendfile), testrecipe)
610 filesextrapaths = get_bb_var('FILESEXTRAPATHS', testrecipe).split(':') 614 filesextrapaths = bb_vars['FILESEXTRAPATHS'].split(':')
611 self.assertIn(filesdir, filesextrapaths) 615 self.assertIn(filesdir, filesextrapaths)
612 616
613 617
@@ -638,8 +642,9 @@ class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase):
638 @testcase(1280) 642 @testcase(1280)
639 def test_recipetool_appendsrcfile_srcdir_basic(self): 643 def test_recipetool_appendsrcfile_srcdir_basic(self):
640 testrecipe = 'bash' 644 testrecipe = 'bash'
641 srcdir = get_bb_var('S', testrecipe) 645 bb_vars = get_bb_vars(['S', 'WORKDIR'], testrecipe)
642 workdir = get_bb_var('WORKDIR', testrecipe) 646 srcdir = bb_vars['S']
647 workdir = bb_vars['WORKDIR']
643 subdir = os.path.relpath(srcdir, workdir) 648 subdir = os.path.relpath(srcdir, workdir)
644 self._test_appendsrcfile(testrecipe, 'a-file', srcdir=subdir) 649 self._test_appendsrcfile(testrecipe, 'a-file', srcdir=subdir)
645 650
@@ -664,8 +669,9 @@ class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase):
664 def test_recipetool_appendsrcfile_replace_file_srcdir(self): 669 def test_recipetool_appendsrcfile_replace_file_srcdir(self):
665 testrecipe = 'bash' 670 testrecipe = 'bash'
666 filepath = 'Makefile.in' 671 filepath = 'Makefile.in'
667 srcdir = get_bb_var('S', testrecipe) 672 bb_vars = get_bb_vars(['S', 'WORKDIR'], testrecipe)
668 workdir = get_bb_var('WORKDIR', testrecipe) 673 srcdir = bb_vars['S']
674 workdir = bb_vars['WORKDIR']
669 subdir = os.path.relpath(srcdir, workdir) 675 subdir = os.path.relpath(srcdir, workdir)
670 676
671 self._test_appendsrcfile(testrecipe, filepath, srcdir=subdir) 677 self._test_appendsrcfile(testrecipe, filepath, srcdir=subdir)
diff --git a/meta/lib/oeqa/selftest/runtime-test.py b/meta/lib/oeqa/selftest/runtime-test.py
index a673f36d39..e8b483d7f8 100644
--- a/meta/lib/oeqa/selftest/runtime-test.py
+++ b/meta/lib/oeqa/selftest/runtime-test.py
@@ -1,5 +1,5 @@
1from oeqa.selftest.base import oeSelfTest 1from oeqa.selftest.base import oeSelfTest
2from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu 2from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu
3from oeqa.utils.decorators import testcase 3from oeqa.utils.decorators import testcase
4import os 4import os
5import re 5import re
@@ -31,8 +31,9 @@ class TestExport(oeSelfTest):
31 bitbake('core-image-minimal') 31 bitbake('core-image-minimal')
32 bitbake('-c testexport core-image-minimal') 32 bitbake('-c testexport core-image-minimal')
33 33
34 # Verify if TEST_EXPORT_DIR was created
35 testexport_dir = get_bb_var('TEST_EXPORT_DIR', 'core-image-minimal') 34 testexport_dir = get_bb_var('TEST_EXPORT_DIR', 'core-image-minimal')
35
36 # Verify if TEST_EXPORT_DIR was created
36 isdir = os.path.isdir(testexport_dir) 37 isdir = os.path.isdir(testexport_dir)
37 self.assertEqual(True, isdir, 'Failed to create testexport dir: %s' % testexport_dir) 38 self.assertEqual(True, isdir, 'Failed to create testexport dir: %s' % testexport_dir)
38 39
@@ -73,10 +74,14 @@ class TestExport(oeSelfTest):
73 bitbake('core-image-minimal') 74 bitbake('core-image-minimal')
74 bitbake('-c testexport core-image-minimal') 75 bitbake('-c testexport core-image-minimal')
75 76
77 needed_vars = ['TEST_EXPORT_DIR', 'TEST_EXPORT_SDK_DIR', 'TEST_EXPORT_SDK_NAME']
78 bb_vars = get_bb_vars(needed_vars, 'core-image-minimal')
79 testexport_dir = bb_vars['TEST_EXPORT_DIR']
80 sdk_dir = bb_vars['TEST_EXPORT_SDK_DIR']
81 sdk_name = bb_vars['TEST_EXPORT_SDK_NAME']
82
76 # Check for SDK 83 # Check for SDK
77 testexport_dir = get_bb_var('TEST_EXPORT_DIR', 'core-image-minimal') 84 tarball_name = "%s.sh" % sdk_name
78 sdk_dir = get_bb_var('TEST_EXPORT_SDK_DIR', 'core-image-minimal')
79 tarball_name = "%s.sh" % get_bb_var('TEST_EXPORT_SDK_NAME', 'core-image-minimal')
80 tarball_path = os.path.join(testexport_dir, sdk_dir, tarball_name) 85 tarball_path = os.path.join(testexport_dir, sdk_dir, tarball_name)
81 msg = "Couldn't find SDK tarball: %s" % tarball_path 86 msg = "Couldn't find SDK tarball: %s" % tarball_path
82 self.assertEqual(os.path.isfile(tarball_path), True, msg) 87 self.assertEqual(os.path.isfile(tarball_path), True, msg)
diff --git a/meta/lib/oeqa/selftest/signing.py b/meta/lib/oeqa/selftest/signing.py
index 35c2dc12ab..006afbef15 100644
--- a/meta/lib/oeqa/selftest/signing.py
+++ b/meta/lib/oeqa/selftest/signing.py
@@ -1,5 +1,5 @@
1from oeqa.selftest.base import oeSelfTest 1from oeqa.selftest.base import oeSelfTest
2from oeqa.utils.commands import runCmd, bitbake, get_bb_var 2from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars
3import os 3import os
4import glob 4import glob
5import re 5import re
@@ -59,15 +59,17 @@ class Signing(oeSelfTest):
59 59
60 self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe) 60 self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe)
61 61
62 pkgdatadir = get_bb_var('PKGDATA_DIR', test_recipe) 62 needed_vars = ['PKGDATA_DIR', 'DEPLOY_DIR_RPM', 'PACKAGE_ARCH', 'STAGING_BINDIR_NATIVE']
63 bb_vars = get_bb_vars(needed_vars, test_recipe)
64 pkgdatadir = bb_vars['PKGDATA_DIR']
63 pkgdata = oe.packagedata.read_pkgdatafile(pkgdatadir + "/runtime/ed") 65 pkgdata = oe.packagedata.read_pkgdatafile(pkgdatadir + "/runtime/ed")
64 if 'PKGE' in pkgdata: 66 if 'PKGE' in pkgdata:
65 pf = pkgdata['PN'] + "-" + pkgdata['PKGE'] + pkgdata['PKGV'] + '-' + pkgdata['PKGR'] 67 pf = pkgdata['PN'] + "-" + pkgdata['PKGE'] + pkgdata['PKGV'] + '-' + pkgdata['PKGR']
66 else: 68 else:
67 pf = pkgdata['PN'] + "-" + pkgdata['PKGV'] + '-' + pkgdata['PKGR'] 69 pf = pkgdata['PN'] + "-" + pkgdata['PKGV'] + '-' + pkgdata['PKGR']
68 deploy_dir_rpm = get_bb_var('DEPLOY_DIR_RPM', test_recipe) 70 deploy_dir_rpm = bb_vars['DEPLOY_DIR_RPM']
69 package_arch = get_bb_var('PACKAGE_ARCH', test_recipe).replace('-', '_') 71 package_arch = bb_vars['PACKAGE_ARCH'].replace('-', '_')
70 staging_bindir_native = get_bb_var('STAGING_BINDIR_NATIVE', test_recipe) 72 staging_bindir_native = bb_vars['STAGING_BINDIR_NATIVE']
71 73
72 pkg_deploy = os.path.join(deploy_dir_rpm, package_arch, '.'.join((pf, package_arch, 'rpm'))) 74 pkg_deploy = os.path.join(deploy_dir_rpm, package_arch, '.'.join((pf, package_arch, 'rpm')))
73 75
diff --git a/meta/lib/oeqa/selftest/sstate.py b/meta/lib/oeqa/selftest/sstate.py
index 742f4d053b..f54bc41465 100644
--- a/meta/lib/oeqa/selftest/sstate.py
+++ b/meta/lib/oeqa/selftest/sstate.py
@@ -6,17 +6,24 @@ import shutil
6 6
7import oeqa.utils.ftools as ftools 7import oeqa.utils.ftools as ftools
8from oeqa.selftest.base import oeSelfTest 8from oeqa.selftest.base import oeSelfTest
9from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_test_layer 9from oeqa.utils.commands import runCmd, bitbake, get_bb_vars, get_test_layer
10 10
11 11
12class SStateBase(oeSelfTest): 12class SStateBase(oeSelfTest):
13 13
14 def setUpLocal(self): 14 def setUpLocal(self):
15 self.temp_sstate_location = None 15 self.temp_sstate_location = None
16 self.sstate_path = get_bb_var('SSTATE_DIR') 16 needed_vars = ['SSTATE_DIR', 'NATIVELSBSTRING', 'TCLIBC', 'TUNE_ARCH',
17 self.hostdistro = get_bb_var('NATIVELSBSTRING') 17 'TOPDIR', 'TARGET_VENDOR', 'TARGET_OS']
18 bb_vars = get_bb_vars(needed_vars)
19 self.sstate_path = bb_vars['SSTATE_DIR']
20 self.hostdistro = bb_vars['NATIVELSBSTRING']
21 self.tclibc = bb_vars['TCLIBC']
22 self.tune_arch = bb_vars['TUNE_ARCH']
23 self.topdir = bb_vars['TOPDIR']
24 self.target_vendor = bb_vars['TARGET_VENDOR']
25 self.target_os = bb_vars['TARGET_OS']
18 self.distro_specific_sstate = os.path.join(self.sstate_path, self.hostdistro) 26 self.distro_specific_sstate = os.path.join(self.sstate_path, self.hostdistro)
19 self.tclibc = get_bb_var('TCLIBC')
20 27
21 # Creates a special sstate configuration with the option to add sstate mirrors 28 # Creates a special sstate configuration with the option to add sstate mirrors
22 def config_sstate(self, temp_sstate_location=False, add_local_mirrors=[]): 29 def config_sstate(self, temp_sstate_location=False, add_local_mirrors=[]):
@@ -27,8 +34,9 @@ class SStateBase(oeSelfTest):
27 config_temp_sstate = "SSTATE_DIR = \"%s\"" % temp_sstate_path 34 config_temp_sstate = "SSTATE_DIR = \"%s\"" % temp_sstate_path
28 self.append_config(config_temp_sstate) 35 self.append_config(config_temp_sstate)
29 self.track_for_cleanup(temp_sstate_path) 36 self.track_for_cleanup(temp_sstate_path)
30 self.sstate_path = get_bb_var('SSTATE_DIR') 37 bb_vars = get_bb_vars(['SSTATE_DIR', 'NATIVELSBSTRING'])
31 self.hostdistro = get_bb_var('NATIVELSBSTRING') 38 self.sstate_path = bb_vars['SSTATE_DIR']
39 self.hostdistro = bb_vars['NATIVELSBSTRING']
32 self.distro_specific_sstate = os.path.join(self.sstate_path, self.hostdistro) 40 self.distro_specific_sstate = os.path.join(self.sstate_path, self.hostdistro)
33 41
34 if add_local_mirrors: 42 if add_local_mirrors:
diff --git a/meta/lib/oeqa/selftest/sstatetests.py b/meta/lib/oeqa/selftest/sstatetests.py
index 783d3d07b9..5814815fe3 100644
--- a/meta/lib/oeqa/selftest/sstatetests.py
+++ b/meta/lib/oeqa/selftest/sstatetests.py
@@ -41,13 +41,11 @@ class SStateTests(SStateBase):
41 41
42 @testcase(975) 42 @testcase(975)
43 def test_sstate_creation_distro_specific_pass(self): 43 def test_sstate_creation_distro_specific_pass(self):
44 targetarch = get_bb_var('TUNE_ARCH') 44 self.run_test_sstate_creation(['binutils-cross-'+ self.tune_arch, 'binutils-native'], distro_specific=True, distro_nonspecific=False, temp_sstate_location=True)
45 self.run_test_sstate_creation(['binutils-cross-'+ targetarch, 'binutils-native'], distro_specific=True, distro_nonspecific=False, temp_sstate_location=True)
46 45
47 @testcase(1374) 46 @testcase(1374)
48 def test_sstate_creation_distro_specific_fail(self): 47 def test_sstate_creation_distro_specific_fail(self):
49 targetarch = get_bb_var('TUNE_ARCH') 48 self.run_test_sstate_creation(['binutils-cross-'+ self.tune_arch, 'binutils-native'], distro_specific=False, distro_nonspecific=True, temp_sstate_location=True, should_pass=False)
50 self.run_test_sstate_creation(['binutils-cross-'+ targetarch, 'binutils-native'], distro_specific=False, distro_nonspecific=True, temp_sstate_location=True, should_pass=False)
51 49
52 @testcase(976) 50 @testcase(976)
53 def test_sstate_creation_distro_nonspecific_pass(self): 51 def test_sstate_creation_distro_nonspecific_pass(self):
@@ -80,8 +78,7 @@ class SStateTests(SStateBase):
80 78
81 @testcase(977) 79 @testcase(977)
82 def test_cleansstate_task_distro_specific_nonspecific(self): 80 def test_cleansstate_task_distro_specific_nonspecific(self):
83 targetarch = get_bb_var('TUNE_ARCH') 81 targets = ['binutils-cross-'+ self.tune_arch, 'binutils-native']
84 targets = ['binutils-cross-'+ targetarch, 'binutils-native']
85 # glibc-initial is intended only for the glibc C library 82 # glibc-initial is intended only for the glibc C library
86 if self.tclibc == 'glibc': 83 if self.tclibc == 'glibc':
87 targets.append('glibc-initial') 84 targets.append('glibc-initial')
@@ -95,8 +92,7 @@ class SStateTests(SStateBase):
95 92
96 @testcase(1377) 93 @testcase(1377)
97 def test_cleansstate_task_distro_specific(self): 94 def test_cleansstate_task_distro_specific(self):
98 targetarch = get_bb_var('TUNE_ARCH') 95 targets = ['binutils-cross-'+ self.tune_arch, 'binutils-native']
99 targets = ['binutils-cross-'+ targetarch, 'binutils-native']
100 # glibc-initial is intended only for the glibc C library 96 # glibc-initial is intended only for the glibc C library
101 if self.tclibc == 'glibc': 97 if self.tclibc == 'glibc':
102 targets.append('glibc-initial') 98 targets.append('glibc-initial')
@@ -137,13 +133,11 @@ class SStateTests(SStateBase):
137 133
138 @testcase(175) 134 @testcase(175)
139 def test_rebuild_distro_specific_sstate_cross_native_targets(self): 135 def test_rebuild_distro_specific_sstate_cross_native_targets(self):
140 targetarch = get_bb_var('TUNE_ARCH') 136 self.run_test_rebuild_distro_specific_sstate(['binutils-cross-' + self.tune_arch, 'binutils-native'], temp_sstate_location=True)
141 self.run_test_rebuild_distro_specific_sstate(['binutils-cross-' + targetarch, 'binutils-native'], temp_sstate_location=True)
142 137
143 @testcase(1372) 138 @testcase(1372)
144 def test_rebuild_distro_specific_sstate_cross_target(self): 139 def test_rebuild_distro_specific_sstate_cross_target(self):
145 targetarch = get_bb_var('TUNE_ARCH') 140 self.run_test_rebuild_distro_specific_sstate(['binutils-cross-' + self.tune_arch], temp_sstate_location=True)
146 self.run_test_rebuild_distro_specific_sstate(['binutils-cross-' + targetarch], temp_sstate_location=True)
147 141
148 @testcase(1373) 142 @testcase(1373)
149 def test_rebuild_distro_specific_sstate_native_target(self): 143 def test_rebuild_distro_specific_sstate_native_target(self):
@@ -158,10 +152,9 @@ class SStateTests(SStateBase):
158 self.assertTrue(len(global_config) == len(target_config), msg='Lists global_config and target_config should have the same number of elements') 152 self.assertTrue(len(global_config) == len(target_config), msg='Lists global_config and target_config should have the same number of elements')
159 self.config_sstate(temp_sstate_location=True, add_local_mirrors=[self.sstate_path]) 153 self.config_sstate(temp_sstate_location=True, add_local_mirrors=[self.sstate_path])
160 154
161 # If buildhistory is enabled, we need to disable version-going-backwards QA checks for this test. It may report errors otherwise. 155 # If buildhistory is enabled, we need to disable version-going-backwards
162 if ('buildhistory' in get_bb_var('USER_CLASSES')) or ('buildhistory' in get_bb_var('INHERIT')): 156 # QA checks for this test. It may report errors otherwise.
163 remove_errors_config = 'ERROR_QA_remove = "version-going-backwards"' 157 self.append_config('ERROR_QA_remove = "version-going-backwards"')
164 self.append_config(remove_errors_config)
165 158
166 # For not this only checks if random sstate tasks are handled correctly as a group. 159 # For not this only checks if random sstate tasks are handled correctly as a group.
167 # In the future we should add control over what tasks we check for. 160 # In the future we should add control over what tasks we check for.
@@ -242,8 +235,6 @@ class SStateTests(SStateBase):
242 manually and check using bitbake -S. 235 manually and check using bitbake -S.
243 """ 236 """
244 237
245 topdir = get_bb_var('TOPDIR')
246 targetvendor = get_bb_var('TARGET_VENDOR')
247 self.write_config(""" 238 self.write_config("""
248MACHINE = "qemux86" 239MACHINE = "qemux86"
249TMPDIR = "${TOPDIR}/tmp-sstatesamehash" 240TMPDIR = "${TOPDIR}/tmp-sstatesamehash"
@@ -252,7 +243,7 @@ BUILD_OS = "linux"
252SDKMACHINE = "x86_64" 243SDKMACHINE = "x86_64"
253PACKAGE_CLASSES = "package_rpm package_ipk package_deb" 244PACKAGE_CLASSES = "package_rpm package_ipk package_deb"
254""") 245""")
255 self.track_for_cleanup(topdir + "/tmp-sstatesamehash") 246 self.track_for_cleanup(self.topdir + "/tmp-sstatesamehash")
256 bitbake("core-image-sato -S none") 247 bitbake("core-image-sato -S none")
257 self.write_config(""" 248 self.write_config("""
258MACHINE = "qemux86" 249MACHINE = "qemux86"
@@ -262,7 +253,7 @@ BUILD_OS = "linux"
262SDKMACHINE = "i686" 253SDKMACHINE = "i686"
263PACKAGE_CLASSES = "package_rpm package_ipk package_deb" 254PACKAGE_CLASSES = "package_rpm package_ipk package_deb"
264""") 255""")
265 self.track_for_cleanup(topdir + "/tmp-sstatesamehash2") 256 self.track_for_cleanup(self.topdir + "/tmp-sstatesamehash2")
266 bitbake("core-image-sato -S none") 257 bitbake("core-image-sato -S none")
267 258
268 def get_files(d): 259 def get_files(d):
@@ -275,9 +266,9 @@ PACKAGE_CLASSES = "package_rpm package_ipk package_deb"
275 continue 266 continue
276 f.extend(os.path.join(root, name) for name in files) 267 f.extend(os.path.join(root, name) for name in files)
277 return f 268 return f
278 files1 = get_files(topdir + "/tmp-sstatesamehash/stamps/") 269 files1 = get_files(self.topdir + "/tmp-sstatesamehash/stamps/")
279 files2 = get_files(topdir + "/tmp-sstatesamehash2/stamps/") 270 files2 = get_files(self.topdir + "/tmp-sstatesamehash2/stamps/")
280 files2 = [x.replace("tmp-sstatesamehash2", "tmp-sstatesamehash").replace("i686-linux", "x86_64-linux").replace("i686" + targetvendor + "-linux", "x86_64" + targetvendor + "-linux", ) for x in files2] 271 files2 = [x.replace("tmp-sstatesamehash2", "tmp-sstatesamehash").replace("i686-linux", "x86_64-linux").replace("i686" + self.target_vendor + "-linux", "x86_64" + self.target_vendor + "-linux", ) for x in files2]
281 self.maxDiff = None 272 self.maxDiff = None
282 self.assertCountEqual(files1, files2) 273 self.assertCountEqual(files1, files2)
283 274
@@ -290,18 +281,17 @@ PACKAGE_CLASSES = "package_rpm package_ipk package_deb"
290 builds, override the variables manually and check using bitbake -S. 281 builds, override the variables manually and check using bitbake -S.
291 """ 282 """
292 283
293 topdir = get_bb_var('TOPDIR')
294 self.write_config(""" 284 self.write_config("""
295TMPDIR = \"${TOPDIR}/tmp-sstatesamehash\" 285TMPDIR = \"${TOPDIR}/tmp-sstatesamehash\"
296NATIVELSBSTRING = \"DistroA\" 286NATIVELSBSTRING = \"DistroA\"
297""") 287""")
298 self.track_for_cleanup(topdir + "/tmp-sstatesamehash") 288 self.track_for_cleanup(self.topdir + "/tmp-sstatesamehash")
299 bitbake("core-image-sato -S none") 289 bitbake("core-image-sato -S none")
300 self.write_config(""" 290 self.write_config("""
301TMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\" 291TMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\"
302NATIVELSBSTRING = \"DistroB\" 292NATIVELSBSTRING = \"DistroB\"
303""") 293""")
304 self.track_for_cleanup(topdir + "/tmp-sstatesamehash2") 294 self.track_for_cleanup(self.topdir + "/tmp-sstatesamehash2")
305 bitbake("core-image-sato -S none") 295 bitbake("core-image-sato -S none")
306 296
307 def get_files(d): 297 def get_files(d):
@@ -309,8 +299,8 @@ NATIVELSBSTRING = \"DistroB\"
309 for root, dirs, files in os.walk(d): 299 for root, dirs, files in os.walk(d):
310 f.extend(os.path.join(root, name) for name in files) 300 f.extend(os.path.join(root, name) for name in files)
311 return f 301 return f
312 files1 = get_files(topdir + "/tmp-sstatesamehash/stamps/") 302 files1 = get_files(self.topdir + "/tmp-sstatesamehash/stamps/")
313 files2 = get_files(topdir + "/tmp-sstatesamehash2/stamps/") 303 files2 = get_files(self.topdir + "/tmp-sstatesamehash2/stamps/")
314 files2 = [x.replace("tmp-sstatesamehash2", "tmp-sstatesamehash") for x in files2] 304 files2 = [x.replace("tmp-sstatesamehash2", "tmp-sstatesamehash") for x in files2]
315 self.maxDiff = None 305 self.maxDiff = None
316 self.assertCountEqual(files1, files2) 306 self.assertCountEqual(files1, files2)
@@ -359,14 +349,11 @@ MULTILIBS = \"\"
359 349
360 def sstate_allarch_samesigs(self, configA, configB): 350 def sstate_allarch_samesigs(self, configA, configB):
361 351
362 topdir = get_bb_var('TOPDIR')
363 targetos = get_bb_var('TARGET_OS')
364 targetvendor = get_bb_var('TARGET_VENDOR')
365 self.write_config(configA) 352 self.write_config(configA)
366 self.track_for_cleanup(topdir + "/tmp-sstatesamehash") 353 self.track_for_cleanup(self.topdir + "/tmp-sstatesamehash")
367 bitbake("world meta-toolchain -S none") 354 bitbake("world meta-toolchain -S none")
368 self.write_config(configB) 355 self.write_config(configB)
369 self.track_for_cleanup(topdir + "/tmp-sstatesamehash2") 356 self.track_for_cleanup(self.topdir + "/tmp-sstatesamehash2")
370 bitbake("world meta-toolchain -S none") 357 bitbake("world meta-toolchain -S none")
371 358
372 def get_files(d): 359 def get_files(d):
@@ -380,15 +367,15 @@ MULTILIBS = \"\"
380 (_, task, _, shash) = name.rsplit(".", 3) 367 (_, task, _, shash) = name.rsplit(".", 3)
381 f[os.path.join(os.path.basename(root), task)] = shash 368 f[os.path.join(os.path.basename(root), task)] = shash
382 return f 369 return f
383 files1 = get_files(topdir + "/tmp-sstatesamehash/stamps/all" + targetvendor + "-" + targetos) 370 files1 = get_files(self.topdir + "/tmp-sstatesamehash/stamps/all" + self.target_vendor + "-" + self.target_os)
384 files2 = get_files(topdir + "/tmp-sstatesamehash2/stamps/all" + targetvendor + "-" + targetos) 371 files2 = get_files(self.topdir + "/tmp-sstatesamehash2/stamps/all" + self.target_vendor + "-" + self.target_os)
385 self.maxDiff = None 372 self.maxDiff = None
386 self.assertEqual(files1, files2) 373 self.assertEqual(files1, files2)
387 374
388 nativesdkdir = os.path.basename(glob.glob(topdir + "/tmp-sstatesamehash/stamps/*-nativesdk*-linux")[0]) 375 nativesdkdir = os.path.basename(glob.glob(self.topdir + "/tmp-sstatesamehash/stamps/*-nativesdk*-linux")[0])
389 376
390 files1 = get_files(topdir + "/tmp-sstatesamehash/stamps/" + nativesdkdir) 377 files1 = get_files(self.topdir + "/tmp-sstatesamehash/stamps/" + nativesdkdir)
391 files2 = get_files(topdir + "/tmp-sstatesamehash2/stamps/" + nativesdkdir) 378 files2 = get_files(self.topdir + "/tmp-sstatesamehash2/stamps/" + nativesdkdir)
392 self.maxDiff = None 379 self.maxDiff = None
393 self.assertEqual(files1, files2) 380 self.assertEqual(files1, files2)
394 381
@@ -400,9 +387,6 @@ MULTILIBS = \"\"
400 qemux86copy machine to test this. Also include multilibs in the test. 387 qemux86copy machine to test this. Also include multilibs in the test.
401 """ 388 """
402 389
403 topdir = get_bb_var('TOPDIR')
404 targetos = get_bb_var('TARGET_OS')
405 targetvendor = get_bb_var('TARGET_VENDOR')
406 self.write_config(""" 390 self.write_config("""
407TMPDIR = \"${TOPDIR}/tmp-sstatesamehash\" 391TMPDIR = \"${TOPDIR}/tmp-sstatesamehash\"
408MACHINE = \"qemux86\" 392MACHINE = \"qemux86\"
@@ -410,7 +394,7 @@ require conf/multilib.conf
410MULTILIBS = "multilib:lib32" 394MULTILIBS = "multilib:lib32"
411DEFAULTTUNE_virtclass-multilib-lib32 = "x86" 395DEFAULTTUNE_virtclass-multilib-lib32 = "x86"
412""") 396""")
413 self.track_for_cleanup(topdir + "/tmp-sstatesamehash") 397 self.track_for_cleanup(self.topdir + "/tmp-sstatesamehash")
414 bitbake("world meta-toolchain -S none") 398 bitbake("world meta-toolchain -S none")
415 self.write_config(""" 399 self.write_config("""
416TMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\" 400TMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\"
@@ -419,7 +403,7 @@ require conf/multilib.conf
419MULTILIBS = "multilib:lib32" 403MULTILIBS = "multilib:lib32"
420DEFAULTTUNE_virtclass-multilib-lib32 = "x86" 404DEFAULTTUNE_virtclass-multilib-lib32 = "x86"
421""") 405""")
422 self.track_for_cleanup(topdir + "/tmp-sstatesamehash2") 406 self.track_for_cleanup(self.topdir + "/tmp-sstatesamehash2")
423 bitbake("world meta-toolchain -S none") 407 bitbake("world meta-toolchain -S none")
424 408
425 def get_files(d): 409 def get_files(d):
@@ -433,8 +417,8 @@ DEFAULTTUNE_virtclass-multilib-lib32 = "x86"
433 if "do_build" not in name and "do_populate_sdk" not in name: 417 if "do_build" not in name and "do_populate_sdk" not in name:
434 f.append(os.path.join(root, name)) 418 f.append(os.path.join(root, name))
435 return f 419 return f
436 files1 = get_files(topdir + "/tmp-sstatesamehash/stamps") 420 files1 = get_files(self.topdir + "/tmp-sstatesamehash/stamps")
437 files2 = get_files(topdir + "/tmp-sstatesamehash2/stamps") 421 files2 = get_files(self.topdir + "/tmp-sstatesamehash2/stamps")
438 files2 = [x.replace("tmp-sstatesamehash2", "tmp-sstatesamehash") for x in files2] 422 files2 = [x.replace("tmp-sstatesamehash2", "tmp-sstatesamehash") for x in files2]
439 self.maxDiff = None 423 self.maxDiff = None
440 self.assertCountEqual(files1, files2) 424 self.assertCountEqual(files1, files2)
@@ -446,8 +430,6 @@ DEFAULTTUNE_virtclass-multilib-lib32 = "x86"
446 classes inherits should be the same. 430 classes inherits should be the same.
447 """ 431 """
448 432
449 topdir = get_bb_var('TOPDIR')
450 targetvendor = get_bb_var('TARGET_VENDOR')
451 self.write_config(""" 433 self.write_config("""
452TMPDIR = "${TOPDIR}/tmp-sstatesamehash" 434TMPDIR = "${TOPDIR}/tmp-sstatesamehash"
453BB_NUMBER_THREADS = "1" 435BB_NUMBER_THREADS = "1"
@@ -458,8 +440,8 @@ DATE = "20161111"
458INHERIT_remove = "buildstats-summary buildhistory uninative" 440INHERIT_remove = "buildstats-summary buildhistory uninative"
459http_proxy = "" 441http_proxy = ""
460""") 442""")
461 self.track_for_cleanup(topdir + "/tmp-sstatesamehash") 443 self.track_for_cleanup(self.topdir + "/tmp-sstatesamehash")
462 self.track_for_cleanup(topdir + "/download1") 444 self.track_for_cleanup(self.topdir + "/download1")
463 bitbake("world meta-toolchain -S none") 445 bitbake("world meta-toolchain -S none")
464 self.write_config(""" 446 self.write_config("""
465TMPDIR = "${TOPDIR}/tmp-sstatesamehash2" 447TMPDIR = "${TOPDIR}/tmp-sstatesamehash2"
@@ -473,8 +455,8 @@ INHERIT_remove = "uninative"
473INHERIT += "buildstats-summary buildhistory" 455INHERIT += "buildstats-summary buildhistory"
474http_proxy = "http://example.com/" 456http_proxy = "http://example.com/"
475""") 457""")
476 self.track_for_cleanup(topdir + "/tmp-sstatesamehash2") 458 self.track_for_cleanup(self.topdir + "/tmp-sstatesamehash2")
477 self.track_for_cleanup(topdir + "/download2") 459 self.track_for_cleanup(self.topdir + "/download2")
478 bitbake("world meta-toolchain -S none") 460 bitbake("world meta-toolchain -S none")
479 461
480 def get_files(d): 462 def get_files(d):
@@ -486,8 +468,8 @@ http_proxy = "http://example.com/"
486 base = os.sep.join(root.rsplit(os.sep, 2)[-2:] + [name]) 468 base = os.sep.join(root.rsplit(os.sep, 2)[-2:] + [name])
487 f[base] = shash 469 f[base] = shash
488 return f 470 return f
489 files1 = get_files(topdir + "/tmp-sstatesamehash/stamps/") 471 files1 = get_files(self.topdir + "/tmp-sstatesamehash/stamps/")
490 files2 = get_files(topdir + "/tmp-sstatesamehash2/stamps/") 472 files2 = get_files(self.topdir + "/tmp-sstatesamehash2/stamps/")
491 # Remove items that are identical in both sets 473 # Remove items that are identical in both sets
492 for k,v in files1.items() & files2.items(): 474 for k,v in files1.items() & files2.items():
493 del files1[k] 475 del files1[k]
@@ -500,8 +482,8 @@ http_proxy = "http://example.com/"
500 if k in files1 and k in files2: 482 if k in files1 and k in files2:
501 print("%s differs:" % k) 483 print("%s differs:" % k)
502 print(subprocess.check_output(("bitbake-diffsigs", 484 print(subprocess.check_output(("bitbake-diffsigs",
503 topdir + "/tmp-sstatesamehash/stamps/" + k + "." + files1[k], 485 self.topdir + "/tmp-sstatesamehash/stamps/" + k + "." + files1[k],
504 topdir + "/tmp-sstatesamehash2/stamps/" + k + "." + files2[k]))) 486 self.topdir + "/tmp-sstatesamehash2/stamps/" + k + "." + files2[k])))
505 elif k in files1 and k not in files2: 487 elif k in files1 and k not in files2:
506 print("%s in files1" % k) 488 print("%s in files1" % k)
507 elif k not in files1 and k in files2: 489 elif k not in files1 and k in files2:
diff --git a/meta/lib/oeqa/selftest/tinfoil.py b/meta/lib/oeqa/selftest/tinfoil.py
index 6ad106cad8..38ec7a3bc5 100644
--- a/meta/lib/oeqa/selftest/tinfoil.py
+++ b/meta/lib/oeqa/selftest/tinfoil.py
@@ -4,7 +4,7 @@ import re
4import bb.tinfoil 4import bb.tinfoil
5 5
6from oeqa.selftest.base import oeSelfTest 6from oeqa.selftest.base import oeSelfTest
7from oeqa.utils.commands import runCmd, get_bb_var 7from oeqa.utils.commands import runCmd
8from oeqa.utils.decorators import testcase 8from oeqa.utils.decorators import testcase
9 9
10class TinfoilTests(oeSelfTest): 10class TinfoilTests(oeSelfTest):
diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index 0144d77a6f..b7fe52f45e 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -29,7 +29,7 @@ from glob import glob
29from shutil import rmtree 29from shutil import rmtree
30 30
31from oeqa.selftest.base import oeSelfTest 31from oeqa.selftest.base import oeSelfTest
32from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu 32from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu
33from oeqa.utils.decorators import testcase 33from oeqa.utils.decorators import testcase
34 34
35 35
@@ -212,12 +212,11 @@ class Wic(oeSelfTest):
212 @testcase(1212) 212 @testcase(1212)
213 def test_build_artifacts(self): 213 def test_build_artifacts(self):
214 """Test wic create directdisk providing all artifacts.""" 214 """Test wic create directdisk providing all artifacts."""
215 variables = (('STAGING_DATADIR', 'wic-tools'), 215 bb_vars = get_bb_vars(['STAGING_DATADIR', 'RECIPE_SYSROOT_NATIVE'],
216 ('RECIPE_SYSROOT_NATIVE', 'wic-tools'), 216 'wic-tools')
217 ('DEPLOY_DIR_IMAGE', 'core-image-minimal'), 217 bb_vars.update(get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS'],
218 ('IMAGE_ROOTFS', 'core-image-minimal')) 218 'core-image-minimal'))
219 bbvars = {var.lower(): get_bb_var(var, recipe) \ 219 bbvars = {key.lower(): value for key, value in bb_vars.items()}
220 for var, recipe in variables}
221 bbvars['resultdir'] = self.resultdir 220 bbvars['resultdir'] = self.resultdir
222 status = runCmd("wic create directdisk " 221 status = runCmd("wic create directdisk "
223 "-b %(staging_datadir)s " 222 "-b %(staging_datadir)s "
@@ -321,12 +320,11 @@ class Wic(oeSelfTest):
321 @testcase(1269) 320 @testcase(1269)
322 def test_rootfs_artifacts(self): 321 def test_rootfs_artifacts(self):
323 """Test usage of rootfs plugin with rootfs paths""" 322 """Test usage of rootfs plugin with rootfs paths"""
324 variables = (('STAGING_DATADIR', 'wic-tools'), 323 bb_vars = get_bb_vars(['STAGING_DATADIR', 'RECIPE_SYSROOT_NATIVE'],
325 ('RECIPE_SYSROOT_NATIVE', 'wic-tools'), 324 'wic-tools')
326 ('DEPLOY_DIR_IMAGE', 'core-image-minimal'), 325 bb_vars.update(get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS'],
327 ('IMAGE_ROOTFS', 'core-image-minimal')) 326 'core-image-minimal'))
328 bbvars = {var.lower(): get_bb_var(var, recipe) \ 327 bbvars = {key.lower(): value for key, value in bb_vars.items()}
329 for var, recipe in variables}
330 bbvars['wks'] = "directdisk-multi-rootfs" 328 bbvars['wks'] = "directdisk-multi-rootfs"
331 bbvars['resultdir'] = self.resultdir 329 bbvars['resultdir'] = self.resultdir
332 status = runCmd("wic create %(wks)s " 330 status = runCmd("wic create %(wks)s "
@@ -464,8 +462,9 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
464 """Generate and obtain the path to <image>.env""" 462 """Generate and obtain the path to <image>.env"""
465 if image not in self.wicenv_cache: 463 if image not in self.wicenv_cache:
466 self.assertEqual(0, bitbake('%s -c do_rootfs_wicenv' % image).status) 464 self.assertEqual(0, bitbake('%s -c do_rootfs_wicenv' % image).status)
467 stdir = get_bb_var('STAGING_DIR', image) 465 bb_vars = get_bb_vars(['STAGING_DIR', 'MACHINE'], image)
468 machine = get_bb_var('MACHINE', image) 466 stdir = bb_vars['STAGING_DIR']
467 machine = bb_vars['MACHINE']
469 self.wicenv_cache[image] = os.path.join(stdir, machine, 'imgdata') 468 self.wicenv_cache[image] = os.path.join(stdir, machine, 'imgdata')
470 return self.wicenv_cache[image] 469 return self.wicenv_cache[image]
471 470
@@ -475,12 +474,13 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
475 image = 'core-image-minimal' 474 image = 'core-image-minimal'
476 imgdatadir = self._get_image_env_path(image) 475 imgdatadir = self._get_image_env_path(image)
477 476
478 basename = get_bb_var('IMAGE_BASENAME', image) 477 bb_vars = get_bb_vars(['IMAGE_BASENAME', 'WICVARS'], image)
478 basename = bb_vars['IMAGE_BASENAME']
479 self.assertEqual(basename, image) 479 self.assertEqual(basename, image)
480 path = os.path.join(imgdatadir, basename) + '.env' 480 path = os.path.join(imgdatadir, basename) + '.env'
481 self.assertTrue(os.path.isfile(path)) 481 self.assertTrue(os.path.isfile(path))
482 482
483 wicvars = set(get_bb_var('WICVARS', image).split()) 483 wicvars = set(bb_vars['WICVARS'].split())
484 # filter out optional variables 484 # filter out optional variables
485 wicvars = wicvars.difference(('DEPLOY_DIR_IMAGE', 'IMAGE_BOOT_FILES', 485 wicvars = wicvars.difference(('DEPLOY_DIR_IMAGE', 'IMAGE_BOOT_FILES',
486 'INITRD', 'INITRD_LIVE', 'ISODIR')) 486 'INITRD', 'INITRD_LIVE', 'ISODIR'))
@@ -522,8 +522,9 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
522 self.assertEqual(0, bitbake('wic-image-minimal').status) 522 self.assertEqual(0, bitbake('wic-image-minimal').status)
523 self.remove_config(config) 523 self.remove_config(config)
524 524
525 deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE') 525 bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'MACHINE'])
526 machine = get_bb_var('MACHINE') 526 deploy_dir = bb_vars['DEPLOY_DIR_IMAGE']
527 machine = bb_vars['MACHINE']
527 prefix = os.path.join(deploy_dir, 'wic-image-minimal-%s.' % machine) 528 prefix = os.path.join(deploy_dir, 'wic-image-minimal-%s.' % machine)
528 # check if we have result image and manifests symlinks 529 # check if we have result image and manifests symlinks
529 # pointing to existing files 530 # pointing to existing files