diff options
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/devtool.py | 24 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/cases/recipetool.py | 14 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/cases/recipeutils.py | 4 | ||||
-rw-r--r-- | meta/lib/oeqa/utils/commands.py | 15 |
4 files changed, 35 insertions, 22 deletions
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index 0155ee62ee..74a7727cc0 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py | |||
@@ -469,7 +469,7 @@ class DevtoolAddTests(DevtoolBase): | |||
469 | checkvars = {} | 469 | checkvars = {} |
470 | checkvars['LICENSE'] = 'GPL-2.0-only' | 470 | checkvars['LICENSE'] = 'GPL-2.0-only' |
471 | checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263' | 471 | checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263' |
472 | checkvars['S'] = '${WORKDIR}/git' | 472 | checkvars['S'] = None |
473 | checkvars['PV'] = '0.1+git' | 473 | checkvars['PV'] = '0.1+git' |
474 | checkvars['SRC_URI'] = 'git://git.yoctoproject.org/git/dbus-wait;protocol=https;branch=master' | 474 | checkvars['SRC_URI'] = 'git://git.yoctoproject.org/git/dbus-wait;protocol=https;branch=master' |
475 | checkvars['SRCREV'] = srcrev | 475 | checkvars['SRCREV'] = srcrev |
@@ -565,7 +565,7 @@ class DevtoolAddTests(DevtoolBase): | |||
565 | recipefile = get_bb_var('FILE', testrecipe) | 565 | recipefile = get_bb_var('FILE', testrecipe) |
566 | self.assertIn('%s_%s.bb' % (testrecipe, testver), recipefile, 'Recipe file incorrectly named') | 566 | self.assertIn('%s_%s.bb' % (testrecipe, testver), recipefile, 'Recipe file incorrectly named') |
567 | checkvars = {} | 567 | checkvars = {} |
568 | checkvars['S'] = '${WORKDIR}/MarkupSafe-${PV}' | 568 | checkvars['S'] = '${UNPACKDIR}/MarkupSafe-${PV}' |
569 | checkvars['SRC_URI'] = url.replace(testver, '${PV}') | 569 | checkvars['SRC_URI'] = url.replace(testver, '${PV}') |
570 | self._test_recipe_contents(recipefile, checkvars, []) | 570 | self._test_recipe_contents(recipefile, checkvars, []) |
571 | # Try with version specified | 571 | # Try with version specified |
@@ -582,7 +582,7 @@ class DevtoolAddTests(DevtoolBase): | |||
582 | recipefile = get_bb_var('FILE', testrecipe) | 582 | recipefile = get_bb_var('FILE', testrecipe) |
583 | self.assertIn('%s_%s.bb' % (testrecipe, fakever), recipefile, 'Recipe file incorrectly named') | 583 | self.assertIn('%s_%s.bb' % (testrecipe, fakever), recipefile, 'Recipe file incorrectly named') |
584 | checkvars = {} | 584 | checkvars = {} |
585 | checkvars['S'] = '${WORKDIR}/MarkupSafe-%s' % testver | 585 | checkvars['S'] = '${UNPACKDIR}/MarkupSafe-%s' % testver |
586 | checkvars['SRC_URI'] = url | 586 | checkvars['SRC_URI'] = url |
587 | self._test_recipe_contents(recipefile, checkvars, []) | 587 | self._test_recipe_contents(recipefile, checkvars, []) |
588 | 588 | ||
@@ -609,7 +609,7 @@ class DevtoolAddTests(DevtoolBase): | |||
609 | recipefile = get_bb_var('FILE', testrecipe) | 609 | recipefile = get_bb_var('FILE', testrecipe) |
610 | self.assertIn('_git.bb', recipefile, 'Recipe file incorrectly named') | 610 | self.assertIn('_git.bb', recipefile, 'Recipe file incorrectly named') |
611 | checkvars = {} | 611 | checkvars = {} |
612 | checkvars['S'] = '${WORKDIR}/git' | 612 | checkvars['S'] = None |
613 | checkvars['PV'] = '1.0+git' | 613 | checkvars['PV'] = '1.0+git' |
614 | checkvars['SRC_URI'] = url_branch | 614 | checkvars['SRC_URI'] = url_branch |
615 | checkvars['SRCREV'] = '${AUTOREV}' | 615 | checkvars['SRCREV'] = '${AUTOREV}' |
@@ -628,7 +628,7 @@ class DevtoolAddTests(DevtoolBase): | |||
628 | recipefile = get_bb_var('FILE', testrecipe) | 628 | recipefile = get_bb_var('FILE', testrecipe) |
629 | self.assertIn('_git.bb', recipefile, 'Recipe file incorrectly named') | 629 | self.assertIn('_git.bb', recipefile, 'Recipe file incorrectly named') |
630 | checkvars = {} | 630 | checkvars = {} |
631 | checkvars['S'] = '${WORKDIR}/git' | 631 | checkvars['S'] = None |
632 | checkvars['PV'] = '1.5+git' | 632 | checkvars['PV'] = '1.5+git' |
633 | checkvars['SRC_URI'] = url_branch | 633 | checkvars['SRC_URI'] = url_branch |
634 | checkvars['SRCREV'] = checkrev | 634 | checkvars['SRCREV'] = checkrev |
@@ -1627,12 +1627,12 @@ class DevtoolUpdateTests(DevtoolBase): | |||
1627 | # Check preconditions | 1627 | # Check preconditions |
1628 | testrecipe = 'dos2unix' | 1628 | testrecipe = 'dos2unix' |
1629 | self.append_config('ERROR_QA:remove:pn-dos2unix = "patch-status"\n') | 1629 | self.append_config('ERROR_QA:remove:pn-dos2unix = "patch-status"\n') |
1630 | bb_vars = get_bb_vars(['SRC_URI', 'S', 'WORKDIR', 'FILE'], testrecipe) | 1630 | bb_vars = get_bb_vars(['SRC_URI', 'S', 'UNPACKDIR', 'FILE', 'BB_GIT_DEFAULT_DESTSUFFIX'], testrecipe) |
1631 | self.assertIn('git://', bb_vars['SRC_URI'], 'This test expects the %s recipe to be a git recipe' % testrecipe) | 1631 | self.assertIn('git://', bb_vars['SRC_URI'], 'This test expects the %s recipe to be a git recipe' % testrecipe) |
1632 | workdir_git = '%s/git/' % bb_vars['WORKDIR'] | 1632 | unpackdir_git = '%s/%s/' % (bb_vars['UNPACKDIR'], bb_vars['BB_GIT_DEFAULT_DESTSUFFIX']) |
1633 | if not bb_vars['S'].startswith(workdir_git): | 1633 | if not bb_vars['S'].startswith(unpackdir_git): |
1634 | self.fail('This test expects the %s recipe to be building from a subdirectory of the git repo' % testrecipe) | 1634 | self.fail('This test expects the %s recipe to be building from a subdirectory of the git repo' % testrecipe) |
1635 | subdir = bb_vars['S'].split(workdir_git, 1)[1] | 1635 | subdir = bb_vars['S'].split(unpackdir_git, 1)[1] |
1636 | # Clean up anything in the workdir/sysroot/sstate cache | 1636 | # Clean up anything in the workdir/sysroot/sstate cache |
1637 | bitbake('%s -c cleansstate' % testrecipe) | 1637 | bitbake('%s -c cleansstate' % testrecipe) |
1638 | # Try modifying a recipe | 1638 | # Try modifying a recipe |
@@ -2414,7 +2414,7 @@ class DevtoolUpgradeTests(DevtoolBase): | |||
2414 | newsrctree = os.path.join(self.workspacedir, 'sources', newrecipename) | 2414 | newsrctree = os.path.join(self.workspacedir, 'sources', newrecipename) |
2415 | self.assertExists(newsrctree, 'Source directory not renamed') | 2415 | self.assertExists(newsrctree, 'Source directory not renamed') |
2416 | checkvars = {} | 2416 | checkvars = {} |
2417 | checkvars['S'] = '${WORKDIR}/%s-%s' % (recipename, recipever) | 2417 | checkvars['S'] = '${UNPACKDIR}/%s-%s' % (recipename, recipever) |
2418 | checkvars['SRC_URI'] = url | 2418 | checkvars['SRC_URI'] = url |
2419 | self._test_recipe_contents(newrecipefile, checkvars, []) | 2419 | self._test_recipe_contents(newrecipefile, checkvars, []) |
2420 | # Try again - change just name this time | 2420 | # Try again - change just name this time |
@@ -2426,7 +2426,7 @@ class DevtoolUpgradeTests(DevtoolBase): | |||
2426 | self.assertNotExists(os.path.join(self.workspacedir, 'recipes', recipename), 'Old recipe directory still exists') | 2426 | self.assertNotExists(os.path.join(self.workspacedir, 'recipes', recipename), 'Old recipe directory still exists') |
2427 | self.assertExists(os.path.join(self.workspacedir, 'sources', newrecipename), 'Source directory not renamed') | 2427 | self.assertExists(os.path.join(self.workspacedir, 'sources', newrecipename), 'Source directory not renamed') |
2428 | checkvars = {} | 2428 | checkvars = {} |
2429 | checkvars['S'] = '${WORKDIR}/%s-${PV}' % recipename | 2429 | checkvars['S'] = '${UNPACKDIR}/%s-${PV}' % recipename |
2430 | checkvars['SRC_URI'] = url.replace(recipever, '${PV}') | 2430 | checkvars['SRC_URI'] = url.replace(recipever, '${PV}') |
2431 | self._test_recipe_contents(newrecipefile, checkvars, []) | 2431 | self._test_recipe_contents(newrecipefile, checkvars, []) |
2432 | # Try again - change just version this time | 2432 | # Try again - change just version this time |
@@ -2437,7 +2437,7 @@ class DevtoolUpgradeTests(DevtoolBase): | |||
2437 | self.assertExists(newrecipefile, 'Recipe file not renamed') | 2437 | self.assertExists(newrecipefile, 'Recipe file not renamed') |
2438 | self.assertExists(os.path.join(self.workspacedir, 'sources', recipename), 'Source directory no longer exists') | 2438 | self.assertExists(os.path.join(self.workspacedir, 'sources', recipename), 'Source directory no longer exists') |
2439 | checkvars = {} | 2439 | checkvars = {} |
2440 | checkvars['S'] = '${WORKDIR}/${BPN}-%s' % recipever | 2440 | checkvars['S'] = '${UNPACKDIR}/${BPN}-%s' % recipever |
2441 | checkvars['SRC_URI'] = url | 2441 | checkvars['SRC_URI'] = url |
2442 | self._test_recipe_contents(newrecipefile, checkvars, []) | 2442 | self._test_recipe_contents(newrecipefile, checkvars, []) |
2443 | 2443 | ||
diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py index 36557f270f..2a91f6c7ae 100644 --- a/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/meta/lib/oeqa/selftest/cases/recipetool.py | |||
@@ -385,7 +385,7 @@ class RecipetoolCreateTests(RecipetoolBase): | |||
385 | checkvars = {} | 385 | checkvars = {} |
386 | checkvars['LICENSE'] = 'LGPL-2.1-only' | 386 | checkvars['LICENSE'] = 'LGPL-2.1-only' |
387 | checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34' | 387 | checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34' |
388 | checkvars['S'] = '${WORKDIR}/git' | 388 | checkvars['S'] = None |
389 | checkvars['PV'] = '1.11+git' | 389 | checkvars['PV'] = '1.11+git' |
390 | checkvars['SRC_URI'] = srcuri + ';branch=master' | 390 | checkvars['SRC_URI'] = srcuri + ';branch=master' |
391 | checkvars['DEPENDS'] = set(['libcheck', 'libjpeg-turbo', 'libpng', 'libx11', 'libxext', 'pango']) | 391 | checkvars['DEPENDS'] = set(['libcheck', 'libjpeg-turbo', 'libpng', 'libx11', 'libxext', 'pango']) |
@@ -1144,10 +1144,10 @@ class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase): | |||
1144 | 1144 | ||
1145 | def test_recipetool_appendsrcfile_srcdir_basic(self): | 1145 | def test_recipetool_appendsrcfile_srcdir_basic(self): |
1146 | testrecipe = 'bash' | 1146 | testrecipe = 'bash' |
1147 | bb_vars = get_bb_vars(['S', 'WORKDIR'], testrecipe) | 1147 | bb_vars = get_bb_vars(['S', 'UNPACKDIR'], testrecipe) |
1148 | srcdir = bb_vars['S'] | 1148 | srcdir = bb_vars['S'] |
1149 | workdir = bb_vars['WORKDIR'] | 1149 | unpackdir = bb_vars['UNPACKDIR'] |
1150 | subdir = os.path.relpath(srcdir, workdir) | 1150 | subdir = os.path.relpath(srcdir, unpackdir) |
1151 | self._test_appendsrcfile(testrecipe, 'a-file', srcdir=subdir) | 1151 | self._test_appendsrcfile(testrecipe, 'a-file', srcdir=subdir) |
1152 | 1152 | ||
1153 | def test_recipetool_appendsrcfile_existing_in_src_uri(self): | 1153 | def test_recipetool_appendsrcfile_existing_in_src_uri(self): |
@@ -1196,10 +1196,10 @@ class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase): | |||
1196 | def test_recipetool_appendsrcfile_replace_file_srcdir(self): | 1196 | def test_recipetool_appendsrcfile_replace_file_srcdir(self): |
1197 | testrecipe = 'bash' | 1197 | testrecipe = 'bash' |
1198 | filepath = 'Makefile.in' | 1198 | filepath = 'Makefile.in' |
1199 | bb_vars = get_bb_vars(['S', 'WORKDIR'], testrecipe) | 1199 | bb_vars = get_bb_vars(['S', 'UNPACKDIR'], testrecipe) |
1200 | srcdir = bb_vars['S'] | 1200 | srcdir = bb_vars['S'] |
1201 | workdir = bb_vars['WORKDIR'] | 1201 | unpackdir = bb_vars['UNPACKDIR'] |
1202 | subdir = os.path.relpath(srcdir, workdir) | 1202 | subdir = os.path.relpath(srcdir, unpackdir) |
1203 | 1203 | ||
1204 | self._test_appendsrcfile(testrecipe, filepath, srcdir=subdir) | 1204 | self._test_appendsrcfile(testrecipe, filepath, srcdir=subdir) |
1205 | bitbake('%s:do_unpack' % testrecipe) | 1205 | bitbake('%s:do_unpack' % testrecipe) |
diff --git a/meta/lib/oeqa/selftest/cases/recipeutils.py b/meta/lib/oeqa/selftest/cases/recipeutils.py index 9949737172..e697fd2920 100644 --- a/meta/lib/oeqa/selftest/cases/recipeutils.py +++ b/meta/lib/oeqa/selftest/cases/recipeutils.py | |||
@@ -72,7 +72,7 @@ class RecipeUtilsTests(OESelftestTestCase): | |||
72 | expected_patch = """ | 72 | expected_patch = """ |
73 | --- a/recipes-test/recipeutils/recipeutils-test_1.2.bb | 73 | --- a/recipes-test/recipeutils/recipeutils-test_1.2.bb |
74 | +++ b/recipes-test/recipeutils/recipeutils-test_1.2.bb | 74 | +++ b/recipes-test/recipeutils/recipeutils-test_1.2.bb |
75 | @@ -11,6 +11,4 @@ | 75 | @@ -10,6 +10,4 @@ |
76 | 76 | ||
77 | BBCLASSEXTEND = "native nativesdk" | 77 | BBCLASSEXTEND = "native nativesdk" |
78 | 78 | ||
@@ -97,7 +97,7 @@ class RecipeUtilsTests(OESelftestTestCase): | |||
97 | expected_patch = """ | 97 | expected_patch = """ |
98 | --- a/recipes-test/recipeutils/recipeutils-test_1.2.bb | 98 | --- a/recipes-test/recipeutils/recipeutils-test_1.2.bb |
99 | +++ b/recipes-test/recipeutils/recipeutils-test_1.2.bb | 99 | +++ b/recipes-test/recipeutils/recipeutils-test_1.2.bb |
100 | @@ -11,6 +11,3 @@ | 100 | @@ -10,6 +10,3 @@ |
101 | 101 | ||
102 | BBCLASSEXTEND = "native nativesdk" | 102 | BBCLASSEXTEND = "native nativesdk" |
103 | 103 | ||
diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py index 2a47f90e32..b60a6e6c38 100644 --- a/meta/lib/oeqa/utils/commands.py +++ b/meta/lib/oeqa/utils/commands.py | |||
@@ -285,7 +285,20 @@ def get_bb_vars(variables=None, target=None, postconfig=None): | |||
285 | return values | 285 | return values |
286 | 286 | ||
287 | def get_bb_var(var, target=None, postconfig=None): | 287 | def get_bb_var(var, target=None, postconfig=None): |
288 | return get_bb_vars([var], target, postconfig)[var] | 288 | if postconfig: |
289 | return bitbake("-e %s" % target or "", postconfig=postconfig).output | ||
290 | else: | ||
291 | # Fast-path for the non-postconfig case | ||
292 | cmd = ["bitbake-getvar", "--quiet", "--value", var] | ||
293 | if target: | ||
294 | cmd.extend(["--recipe", target]) | ||
295 | try: | ||
296 | return subprocess.run(cmd, check=True, text=True, stdout=subprocess.PIPE).stdout.strip() | ||
297 | except subprocess.CalledProcessError as e: | ||
298 | # We need to return None not the empty string if the variable hasn't been set. | ||
299 | if e.returncode == 1: | ||
300 | return None | ||
301 | raise | ||
289 | 302 | ||
290 | def get_test_layer(bblayers=None): | 303 | def get_test_layer(bblayers=None): |
291 | if bblayers is None: | 304 | if bblayers is None: |