diff options
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/devtool.py')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/devtool.py | 138 |
1 files changed, 112 insertions, 26 deletions
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index c8bf7d9e44..05f228f03e 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py | |||
@@ -64,11 +64,15 @@ def setUpModule(): | |||
64 | # under COREBASE and we don't want to copy that, so we have | 64 | # under COREBASE and we don't want to copy that, so we have |
65 | # to be selective. | 65 | # to be selective. |
66 | result = runCmd('git status --porcelain', cwd=oldreporoot) | 66 | result = runCmd('git status --porcelain', cwd=oldreporoot) |
67 | |||
68 | # Also copy modifications to the 'scripts/' directory | ||
69 | canonical_layerpath_scripts = os.path.normpath(canonical_layerpath + "../scripts") | ||
70 | |||
67 | for line in result.output.splitlines(): | 71 | for line in result.output.splitlines(): |
68 | if line.startswith(' M ') or line.startswith('?? '): | 72 | if line.startswith(' M ') or line.startswith('?? '): |
69 | relpth = line.split()[1] | 73 | relpth = line.split()[1] |
70 | pth = os.path.join(oldreporoot, relpth) | 74 | pth = os.path.join(oldreporoot, relpth) |
71 | if pth.startswith(canonical_layerpath): | 75 | if pth.startswith(canonical_layerpath) or pth.startswith(canonical_layerpath_scripts): |
72 | if relpth.endswith('/'): | 76 | if relpth.endswith('/'): |
73 | destdir = os.path.join(corecopydir, relpth) | 77 | destdir = os.path.join(corecopydir, relpth) |
74 | # avoid race condition by not copying .pyc files YPBZ#13421,13803 | 78 | # avoid race condition by not copying .pyc files YPBZ#13421,13803 |
@@ -150,7 +154,7 @@ class DevtoolTestCase(OESelftestTestCase): | |||
150 | value = invalue | 154 | value = invalue |
151 | invar = None | 155 | invar = None |
152 | elif '=' in line: | 156 | elif '=' in line: |
153 | splitline = line.split('=', 1) | 157 | splitline = re.split(r"[?+:]*=[+]?", line, 1) |
154 | var = splitline[0].rstrip() | 158 | var = splitline[0].rstrip() |
155 | value = splitline[1].strip().strip('"') | 159 | value = splitline[1].strip().strip('"') |
156 | if value.endswith('\\'): | 160 | if value.endswith('\\'): |
@@ -317,7 +321,7 @@ class DevtoolBase(DevtoolTestCase): | |||
317 | cls.sstate_conf = 'SSTATE_DIR = "%s"\n' % cls.devtool_sstate | 321 | cls.sstate_conf = 'SSTATE_DIR = "%s"\n' % cls.devtool_sstate |
318 | cls.sstate_conf += ('SSTATE_MIRRORS += "file://.* file:///%s/PATH"\n' | 322 | cls.sstate_conf += ('SSTATE_MIRRORS += "file://.* file:///%s/PATH"\n' |
319 | % cls.original_sstate) | 323 | % cls.original_sstate) |
320 | cls.sstate_conf += ('BB_HASHSERVE_UPSTREAM = "hashserv.yocto.io:8687"\n') | 324 | cls.sstate_conf += ('BB_HASHSERVE_UPSTREAM = "hashserv.yoctoproject.org:8686"\n') |
321 | 325 | ||
322 | @classmethod | 326 | @classmethod |
323 | def tearDownClass(cls): | 327 | def tearDownClass(cls): |
@@ -465,7 +469,7 @@ class DevtoolAddTests(DevtoolBase): | |||
465 | checkvars = {} | 469 | checkvars = {} |
466 | checkvars['LICENSE'] = 'GPL-2.0-only' | 470 | checkvars['LICENSE'] = 'GPL-2.0-only' |
467 | checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263' | 471 | checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263' |
468 | checkvars['S'] = '${WORKDIR}/git' | 472 | checkvars['S'] = None |
469 | checkvars['PV'] = '0.1+git' | 473 | checkvars['PV'] = '0.1+git' |
470 | 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' |
471 | checkvars['SRCREV'] = srcrev | 475 | checkvars['SRCREV'] = srcrev |
@@ -561,7 +565,7 @@ class DevtoolAddTests(DevtoolBase): | |||
561 | recipefile = get_bb_var('FILE', testrecipe) | 565 | recipefile = get_bb_var('FILE', testrecipe) |
562 | 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') |
563 | checkvars = {} | 567 | checkvars = {} |
564 | checkvars['S'] = '${WORKDIR}/MarkupSafe-${PV}' | 568 | checkvars['S'] = '${UNPACKDIR}/MarkupSafe-${PV}' |
565 | checkvars['SRC_URI'] = url.replace(testver, '${PV}') | 569 | checkvars['SRC_URI'] = url.replace(testver, '${PV}') |
566 | self._test_recipe_contents(recipefile, checkvars, []) | 570 | self._test_recipe_contents(recipefile, checkvars, []) |
567 | # Try with version specified | 571 | # Try with version specified |
@@ -578,7 +582,7 @@ class DevtoolAddTests(DevtoolBase): | |||
578 | recipefile = get_bb_var('FILE', testrecipe) | 582 | recipefile = get_bb_var('FILE', testrecipe) |
579 | 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') |
580 | checkvars = {} | 584 | checkvars = {} |
581 | checkvars['S'] = '${WORKDIR}/MarkupSafe-%s' % testver | 585 | checkvars['S'] = '${UNPACKDIR}/MarkupSafe-%s' % testver |
582 | checkvars['SRC_URI'] = url | 586 | checkvars['SRC_URI'] = url |
583 | self._test_recipe_contents(recipefile, checkvars, []) | 587 | self._test_recipe_contents(recipefile, checkvars, []) |
584 | 588 | ||
@@ -605,7 +609,7 @@ class DevtoolAddTests(DevtoolBase): | |||
605 | recipefile = get_bb_var('FILE', testrecipe) | 609 | recipefile = get_bb_var('FILE', testrecipe) |
606 | self.assertIn('_git.bb', recipefile, 'Recipe file incorrectly named') | 610 | self.assertIn('_git.bb', recipefile, 'Recipe file incorrectly named') |
607 | checkvars = {} | 611 | checkvars = {} |
608 | checkvars['S'] = '${WORKDIR}/git' | 612 | checkvars['S'] = None |
609 | checkvars['PV'] = '1.0+git' | 613 | checkvars['PV'] = '1.0+git' |
610 | checkvars['SRC_URI'] = url_branch | 614 | checkvars['SRC_URI'] = url_branch |
611 | checkvars['SRCREV'] = '${AUTOREV}' | 615 | checkvars['SRCREV'] = '${AUTOREV}' |
@@ -624,7 +628,7 @@ class DevtoolAddTests(DevtoolBase): | |||
624 | recipefile = get_bb_var('FILE', testrecipe) | 628 | recipefile = get_bb_var('FILE', testrecipe) |
625 | self.assertIn('_git.bb', recipefile, 'Recipe file incorrectly named') | 629 | self.assertIn('_git.bb', recipefile, 'Recipe file incorrectly named') |
626 | checkvars = {} | 630 | checkvars = {} |
627 | checkvars['S'] = '${WORKDIR}/git' | 631 | checkvars['S'] = None |
628 | checkvars['PV'] = '1.5+git' | 632 | checkvars['PV'] = '1.5+git' |
629 | checkvars['SRC_URI'] = url_branch | 633 | checkvars['SRC_URI'] = url_branch |
630 | checkvars['SRCREV'] = checkrev | 634 | checkvars['SRCREV'] = checkrev |
@@ -753,6 +757,25 @@ class DevtoolModifyTests(DevtoolBase): | |||
753 | result = runCmd('devtool status') | 757 | result = runCmd('devtool status') |
754 | self.assertNotIn('mdadm', result.output) | 758 | self.assertNotIn('mdadm', result.output) |
755 | 759 | ||
760 | def test_devtool_modify_go(self): | ||
761 | import oe.path | ||
762 | from tempfile import TemporaryDirectory | ||
763 | with TemporaryDirectory(prefix='devtoolqa') as tempdir: | ||
764 | self.track_for_cleanup(self.workspacedir) | ||
765 | self.add_command_to_tearDown('bitbake -c clean go-helloworld') | ||
766 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | ||
767 | result = runCmd('devtool modify go-helloworld -x %s' % tempdir) | ||
768 | self.assertExists( | ||
769 | oe.path.join(tempdir, 'src', 'golang.org', 'x', 'example', 'go.mod'), | ||
770 | 'Extracted source could not be found' | ||
771 | ) | ||
772 | self.assertExists( | ||
773 | oe.path.join(self.workspacedir, 'conf', 'layer.conf'), | ||
774 | 'Workspace directory not created' | ||
775 | ) | ||
776 | matches = glob.glob(oe.path.join(self.workspacedir, 'appends', 'go-helloworld_*.bbappend')) | ||
777 | self.assertTrue(matches, 'bbappend not created %s' % result.output) | ||
778 | |||
756 | def test_devtool_buildclean(self): | 779 | def test_devtool_buildclean(self): |
757 | def assertFile(path, *paths): | 780 | def assertFile(path, *paths): |
758 | f = os.path.join(path, *paths) | 781 | f = os.path.join(path, *paths) |
@@ -1004,7 +1027,7 @@ class DevtoolModifyTests(DevtoolBase): | |||
1004 | # Configure the recipe to check that the git dependencies are correctly patched in cargo config | 1027 | # Configure the recipe to check that the git dependencies are correctly patched in cargo config |
1005 | bitbake('-c configure %s' % testrecipe) | 1028 | bitbake('-c configure %s' % testrecipe) |
1006 | 1029 | ||
1007 | cargo_config_path = os.path.join(cargo_home, 'config') | 1030 | cargo_config_path = os.path.join(cargo_home, 'config.toml') |
1008 | with open(cargo_config_path, "r") as f: | 1031 | with open(cargo_config_path, "r") as f: |
1009 | cargo_config_contents = [line.strip('\n') for line in f.readlines()] | 1032 | cargo_config_contents = [line.strip('\n') for line in f.readlines()] |
1010 | 1033 | ||
@@ -1162,13 +1185,16 @@ class DevtoolUpdateTests(DevtoolBase): | |||
1162 | result = runCmd('echo "A new file" > devtool-new-file', cwd=tempdir) | 1185 | result = runCmd('echo "A new file" > devtool-new-file', cwd=tempdir) |
1163 | result = runCmd('git add devtool-new-file', cwd=tempdir) | 1186 | result = runCmd('git add devtool-new-file', cwd=tempdir) |
1164 | result = runCmd('git commit -m "Add a new file"', cwd=tempdir) | 1187 | result = runCmd('git commit -m "Add a new file"', cwd=tempdir) |
1165 | self.add_command_to_tearDown('cd %s; rm %s/*.patch; git checkout %s %s' % (os.path.dirname(recipefile), testrecipe, testrecipe, os.path.basename(recipefile))) | 1188 | cleanup_cmd = 'cd %s; rm %s/*.patch; git add %s; git checkout %s' % (os.path.dirname(recipefile), testrecipe, testrecipe, os.path.basename(recipefile)) |
1189 | self.add_command_to_tearDown(cleanup_cmd) | ||
1166 | result = runCmd('devtool update-recipe %s' % testrecipe) | 1190 | result = runCmd('devtool update-recipe %s' % testrecipe) |
1167 | result = runCmd('git add minicom', cwd=os.path.dirname(recipefile)) | 1191 | result = runCmd('git add minicom', cwd=os.path.dirname(recipefile)) |
1168 | expected_status = [(' M', '.*/%s$' % os.path.basename(recipefile)), | 1192 | expected_status = [(' M', '.*/%s$' % os.path.basename(recipefile)), |
1169 | ('A ', '.*/0001-Change-the-README.patch$'), | 1193 | ('A ', '.*/0001-Change-the-README.patch$'), |
1170 | ('A ', '.*/0002-Add-a-new-file.patch$')] | 1194 | ('A ', '.*/0002-Add-a-new-file.patch$')] |
1171 | self._check_repo_status(os.path.dirname(recipefile), expected_status) | 1195 | self._check_repo_status(os.path.dirname(recipefile), expected_status) |
1196 | result = runCmd(cleanup_cmd) | ||
1197 | self._check_repo_status(os.path.dirname(recipefile), []) | ||
1172 | 1198 | ||
1173 | def test_devtool_update_recipe_git(self): | 1199 | def test_devtool_update_recipe_git(self): |
1174 | # Check preconditions | 1200 | # Check preconditions |
@@ -1225,7 +1251,7 @@ class DevtoolUpdateTests(DevtoolBase): | |||
1225 | 1251 | ||
1226 | def test_devtool_update_recipe_append(self): | 1252 | def test_devtool_update_recipe_append(self): |
1227 | # Check preconditions | 1253 | # Check preconditions |
1228 | testrecipe = 'mdadm' | 1254 | testrecipe = 'minicom' |
1229 | bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe) | 1255 | bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe) |
1230 | recipefile = bb_vars['FILE'] | 1256 | recipefile = bb_vars['FILE'] |
1231 | src_uri = bb_vars['SRC_URI'] | 1257 | src_uri = bb_vars['SRC_URI'] |
@@ -1243,7 +1269,7 @@ class DevtoolUpdateTests(DevtoolBase): | |||
1243 | # Check git repo | 1269 | # Check git repo |
1244 | self._check_src_repo(tempsrcdir) | 1270 | self._check_src_repo(tempsrcdir) |
1245 | # Add a commit | 1271 | # Add a commit |
1246 | result = runCmd("sed 's!\\(#define VERSION\\W*\"[^\"]*\\)\"!\\1-custom\"!' -i ReadMe.c", cwd=tempsrcdir) | 1272 | result = runCmd('echo "Additional line" >> README', cwd=tempsrcdir) |
1247 | result = runCmd('git commit -a -m "Add our custom version"', cwd=tempsrcdir) | 1273 | result = runCmd('git commit -a -m "Add our custom version"', cwd=tempsrcdir) |
1248 | self.add_command_to_tearDown('cd %s; rm -f %s/*.patch; git checkout .' % (os.path.dirname(recipefile), testrecipe)) | 1274 | self.add_command_to_tearDown('cd %s; rm -f %s/*.patch; git checkout .' % (os.path.dirname(recipefile), testrecipe)) |
1249 | # Create a temporary layer and add it to bblayers.conf | 1275 | # Create a temporary layer and add it to bblayers.conf |
@@ -1282,7 +1308,7 @@ class DevtoolUpdateTests(DevtoolBase): | |||
1282 | self.assertEqual(expectedlines2, f.readlines()) | 1308 | self.assertEqual(expectedlines2, f.readlines()) |
1283 | # Put commit back and check we can run it if layer isn't in bblayers.conf | 1309 | # Put commit back and check we can run it if layer isn't in bblayers.conf |
1284 | os.remove(bbappendfile) | 1310 | os.remove(bbappendfile) |
1285 | result = runCmd("sed 's!\\(#define VERSION\\W*\"[^\"]*\\)\"!\\1-custom\"!' -i ReadMe.c", cwd=tempsrcdir) | 1311 | result = runCmd('echo "Additional line" >> README', cwd=tempsrcdir) |
1286 | result = runCmd('git commit -a -m "Add our custom version"', cwd=tempsrcdir) | 1312 | result = runCmd('git commit -a -m "Add our custom version"', cwd=tempsrcdir) |
1287 | result = runCmd('bitbake-layers remove-layer %s' % templayerdir, cwd=self.builddir) | 1313 | result = runCmd('bitbake-layers remove-layer %s' % templayerdir, cwd=self.builddir) |
1288 | result = runCmd('devtool update-recipe %s -a %s' % (testrecipe, templayerdir)) | 1314 | result = runCmd('devtool update-recipe %s -a %s' % (testrecipe, templayerdir)) |
@@ -1601,12 +1627,12 @@ class DevtoolUpdateTests(DevtoolBase): | |||
1601 | # Check preconditions | 1627 | # Check preconditions |
1602 | testrecipe = 'dos2unix' | 1628 | testrecipe = 'dos2unix' |
1603 | self.append_config('ERROR_QA:remove:pn-dos2unix = "patch-status"\n') | 1629 | self.append_config('ERROR_QA:remove:pn-dos2unix = "patch-status"\n') |
1604 | 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) |
1605 | 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) |
1606 | workdir_git = '%s/git/' % bb_vars['WORKDIR'] | 1632 | unpackdir_git = '%s/%s/' % (bb_vars['UNPACKDIR'], bb_vars['BB_GIT_DEFAULT_DESTSUFFIX']) |
1607 | if not bb_vars['S'].startswith(workdir_git): | 1633 | if not bb_vars['S'].startswith(unpackdir_git): |
1608 | 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) |
1609 | subdir = bb_vars['S'].split(workdir_git, 1)[1] | 1635 | subdir = bb_vars['S'].split(unpackdir_git, 1)[1] |
1610 | # Clean up anything in the workdir/sysroot/sstate cache | 1636 | # Clean up anything in the workdir/sysroot/sstate cache |
1611 | bitbake('%s -c cleansstate' % testrecipe) | 1637 | bitbake('%s -c cleansstate' % testrecipe) |
1612 | # Try modifying a recipe | 1638 | # Try modifying a recipe |
@@ -1734,6 +1760,8 @@ class DevtoolExtractTests(DevtoolBase): | |||
1734 | self.assertExists(os.path.join(tempdir, 'Makefile.am'), 'Extracted source could not be found') | 1760 | self.assertExists(os.path.join(tempdir, 'Makefile.am'), 'Extracted source could not be found') |
1735 | self._check_src_repo(tempdir) | 1761 | self._check_src_repo(tempdir) |
1736 | 1762 | ||
1763 | class DevtoolResetTests(DevtoolBase): | ||
1764 | |||
1737 | def test_devtool_reset_all(self): | 1765 | def test_devtool_reset_all(self): |
1738 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | 1766 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') |
1739 | self.track_for_cleanup(tempdir) | 1767 | self.track_for_cleanup(tempdir) |
@@ -1760,6 +1788,21 @@ class DevtoolExtractTests(DevtoolBase): | |||
1760 | matches2 = glob.glob(stampprefix2 + '*') | 1788 | matches2 = glob.glob(stampprefix2 + '*') |
1761 | self.assertFalse(matches2, 'Stamp files exist for recipe %s that should have been cleaned' % testrecipe2) | 1789 | self.assertFalse(matches2, 'Stamp files exist for recipe %s that should have been cleaned' % testrecipe2) |
1762 | 1790 | ||
1791 | def test_devtool_reset_re_plus_plus(self): | ||
1792 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | ||
1793 | self.track_for_cleanup(tempdir) | ||
1794 | self.track_for_cleanup(self.workspacedir) | ||
1795 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | ||
1796 | testrecipe = 'devtool-test-reset-re++' | ||
1797 | result = runCmd('devtool modify %s' % testrecipe) | ||
1798 | result = runCmd('devtool reset -n %s' % testrecipe) | ||
1799 | self.assertIn(testrecipe, result.output) | ||
1800 | result = runCmd('devtool status') | ||
1801 | self.assertNotIn(testrecipe, result.output) | ||
1802 | self.assertNotExists(os.path.join(self.workspacedir, 'recipes', testrecipe), 'Recipe directory should not exist after resetting') | ||
1803 | |||
1804 | class DevtoolDeployTargetTests(DevtoolBase): | ||
1805 | |||
1763 | @OETestTag("runqemu") | 1806 | @OETestTag("runqemu") |
1764 | def test_devtool_deploy_target(self): | 1807 | def test_devtool_deploy_target(self): |
1765 | self._check_runqemu_prerequisites() | 1808 | self._check_runqemu_prerequisites() |
@@ -1827,6 +1870,8 @@ class DevtoolExtractTests(DevtoolBase): | |||
1827 | result = runCmd('ssh %s root@%s %s' % (sshargs, qemu.ip, testcommand), ignore_status=True) | 1870 | result = runCmd('ssh %s root@%s %s' % (sshargs, qemu.ip, testcommand), ignore_status=True) |
1828 | self.assertNotEqual(result, 0, 'undeploy-target did not remove command as it should have') | 1871 | self.assertNotEqual(result, 0, 'undeploy-target did not remove command as it should have') |
1829 | 1872 | ||
1873 | class DevtoolBuildImageTests(DevtoolBase): | ||
1874 | |||
1830 | def test_devtool_build_image(self): | 1875 | def test_devtool_build_image(self): |
1831 | """Test devtool build-image plugin""" | 1876 | """Test devtool build-image plugin""" |
1832 | # Check preconditions | 1877 | # Check preconditions |
@@ -1998,6 +2043,52 @@ class DevtoolUpgradeTests(DevtoolBase): | |||
1998 | newlines = f.readlines() | 2043 | newlines = f.readlines() |
1999 | self.assertEqual(desiredlines, newlines) | 2044 | self.assertEqual(desiredlines, newlines) |
2000 | 2045 | ||
2046 | def test_devtool_upgrade_recipe_upgrade_extra_tasks(self): | ||
2047 | # Check preconditions | ||
2048 | self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory') | ||
2049 | self.track_for_cleanup(self.workspacedir) | ||
2050 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | ||
2051 | recipe = 'python3-guessing-game' | ||
2052 | version = '0.2.0' | ||
2053 | commit = '40cf004c2772ffa20ea803fa3be1528a75be3e98' | ||
2054 | oldrecipefile = get_bb_var('FILE', recipe) | ||
2055 | oldcratesincfile = os.path.join(os.path.dirname(oldrecipefile), os.path.basename(oldrecipefile).strip('_git.bb') + '-crates.inc') | ||
2056 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | ||
2057 | self.track_for_cleanup(tempdir) | ||
2058 | # Check that recipe is not already under devtool control | ||
2059 | result = runCmd('devtool status') | ||
2060 | self.assertNotIn(recipe, result.output) | ||
2061 | # Check upgrade | ||
2062 | result = runCmd('devtool upgrade %s %s --version %s --srcrev %s' % (recipe, tempdir, version, commit)) | ||
2063 | # Check if srctree at least is populated | ||
2064 | self.assertTrue(len(os.listdir(tempdir)) > 0, 'srctree (%s) should be populated with new (%s) source code' % (tempdir, commit)) | ||
2065 | # Check new recipe file and new -crates.inc files are present | ||
2066 | newrecipefile = os.path.join(self.workspacedir, 'recipes', recipe, os.path.basename(oldrecipefile)) | ||
2067 | newcratesincfile = os.path.join(self.workspacedir, 'recipes', recipe, os.path.basename(oldcratesincfile)) | ||
2068 | self.assertExists(newrecipefile, 'Recipe file should exist after upgrade') | ||
2069 | self.assertExists(newcratesincfile, 'Recipe crates.inc file should exist after upgrade') | ||
2070 | # Check devtool status and make sure recipe is present | ||
2071 | result = runCmd('devtool status') | ||
2072 | self.assertIn(recipe, result.output) | ||
2073 | self.assertIn(tempdir, result.output) | ||
2074 | # Check recipe got changed as expected | ||
2075 | with open(oldrecipefile + '.upgraded', 'r') as f: | ||
2076 | desiredlines = f.readlines() | ||
2077 | with open(newrecipefile, 'r') as f: | ||
2078 | newlines = f.readlines() | ||
2079 | self.assertEqual(desiredlines, newlines) | ||
2080 | # Check crates.inc got changed as expected | ||
2081 | with open(oldcratesincfile + '.upgraded', 'r') as f: | ||
2082 | desiredlines = f.readlines() | ||
2083 | with open(newcratesincfile, 'r') as f: | ||
2084 | newlines = f.readlines() | ||
2085 | self.assertEqual(desiredlines, newlines) | ||
2086 | # Check devtool reset recipe | ||
2087 | result = runCmd('devtool reset %s -n' % recipe) | ||
2088 | result = runCmd('devtool status') | ||
2089 | self.assertNotIn(recipe, result.output) | ||
2090 | self.assertNotExists(os.path.join(self.workspacedir, 'recipes', recipe), 'Recipe directory should not exist after resetting') | ||
2091 | |||
2001 | def test_devtool_layer_plugins(self): | 2092 | def test_devtool_layer_plugins(self): |
2002 | """Test that devtool can use plugins from other layers. | 2093 | """Test that devtool can use plugins from other layers. |
2003 | 2094 | ||
@@ -2323,7 +2414,7 @@ class DevtoolUpgradeTests(DevtoolBase): | |||
2323 | newsrctree = os.path.join(self.workspacedir, 'sources', newrecipename) | 2414 | newsrctree = os.path.join(self.workspacedir, 'sources', newrecipename) |
2324 | self.assertExists(newsrctree, 'Source directory not renamed') | 2415 | self.assertExists(newsrctree, 'Source directory not renamed') |
2325 | checkvars = {} | 2416 | checkvars = {} |
2326 | checkvars['S'] = '${WORKDIR}/%s-%s' % (recipename, recipever) | 2417 | checkvars['S'] = '${UNPACKDIR}/%s-%s' % (recipename, recipever) |
2327 | checkvars['SRC_URI'] = url | 2418 | checkvars['SRC_URI'] = url |
2328 | self._test_recipe_contents(newrecipefile, checkvars, []) | 2419 | self._test_recipe_contents(newrecipefile, checkvars, []) |
2329 | # Try again - change just name this time | 2420 | # Try again - change just name this time |
@@ -2335,7 +2426,7 @@ class DevtoolUpgradeTests(DevtoolBase): | |||
2335 | 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') |
2336 | 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') |
2337 | checkvars = {} | 2428 | checkvars = {} |
2338 | checkvars['S'] = '${WORKDIR}/%s-${PV}' % recipename | 2429 | checkvars['S'] = '${UNPACKDIR}/%s-${PV}' % recipename |
2339 | checkvars['SRC_URI'] = url.replace(recipever, '${PV}') | 2430 | checkvars['SRC_URI'] = url.replace(recipever, '${PV}') |
2340 | self._test_recipe_contents(newrecipefile, checkvars, []) | 2431 | self._test_recipe_contents(newrecipefile, checkvars, []) |
2341 | # Try again - change just version this time | 2432 | # Try again - change just version this time |
@@ -2346,7 +2437,7 @@ class DevtoolUpgradeTests(DevtoolBase): | |||
2346 | self.assertExists(newrecipefile, 'Recipe file not renamed') | 2437 | self.assertExists(newrecipefile, 'Recipe file not renamed') |
2347 | 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') |
2348 | checkvars = {} | 2439 | checkvars = {} |
2349 | checkvars['S'] = '${WORKDIR}/${BPN}-%s' % recipever | 2440 | checkvars['S'] = '${UNPACKDIR}/${BPN}-%s' % recipever |
2350 | checkvars['SRC_URI'] = url | 2441 | checkvars['SRC_URI'] = url |
2351 | self._test_recipe_contents(newrecipefile, checkvars, []) | 2442 | self._test_recipe_contents(newrecipefile, checkvars, []) |
2352 | 2443 | ||
@@ -2468,7 +2559,7 @@ class DevtoolIdeSdkTests(DevtoolBase): | |||
2468 | self.track_for_cleanup(tempdir) | 2559 | self.track_for_cleanup(tempdir) |
2469 | self.add_command_to_tearDown('bitbake -c clean %s' % recipe_name) | 2560 | self.add_command_to_tearDown('bitbake -c clean %s' % recipe_name) |
2470 | 2561 | ||
2471 | result = runCmd('devtool modify %s -x %s' % (recipe_name, tempdir)) | 2562 | result = runCmd('devtool modify %s -x %s --debug-build' % (recipe_name, tempdir)) |
2472 | self.assertExists(os.path.join(tempdir, build_file), | 2563 | self.assertExists(os.path.join(tempdir, build_file), |
2473 | 'Extracted source could not be found') | 2564 | 'Extracted source could not be found') |
2474 | self.assertExists(os.path.join(self.workspacedir, 'conf', | 2565 | self.assertExists(os.path.join(self.workspacedir, 'conf', |
@@ -2520,11 +2611,6 @@ class DevtoolIdeSdkTests(DevtoolBase): | |||
2520 | i_and_d_script_path = os.path.join( | 2611 | i_and_d_script_path = os.path.join( |
2521 | self._workspace_scripts_dir(recipe_name), i_and_d_script) | 2612 | self._workspace_scripts_dir(recipe_name), i_and_d_script) |
2522 | self.assertExists(i_and_d_script_path) | 2613 | self.assertExists(i_and_d_script_path) |
2523 | del_script = "delete_package_dirs_" + recipe_id | ||
2524 | del_script_path = os.path.join( | ||
2525 | self._workspace_scripts_dir(recipe_name), del_script) | ||
2526 | self.assertExists(del_script_path) | ||
2527 | runCmd(del_script_path, cwd=tempdir) | ||
2528 | 2614 | ||
2529 | def _devtool_ide_sdk_qemu(self, tempdir, qemu, recipe_name, example_exe): | 2615 | def _devtool_ide_sdk_qemu(self, tempdir, qemu, recipe_name, example_exe): |
2530 | """Verify deployment and execution in Qemu system work for one recipe. | 2616 | """Verify deployment and execution in Qemu system work for one recipe. |