diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-02-24 16:51:30 +1300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-28 11:33:01 +0000 |
commit | 4bae2f25b8a55c80c3ca48b63d093c5a7594c636 (patch) | |
tree | 09f636bce4006e013f7868fc5a850337c91d3bb7 /meta/lib/oeqa | |
parent | 10290f2245cd95e95078e809a1b388d3573d73b8 (diff) | |
download | poky-4bae2f25b8a55c80c3ca48b63d093c5a7594c636.tar.gz |
oe-selftest: devtool: rework devtool upgrade test
* Use a more real-world test of a recipe pointing to a remote file
* The cleanup tracking / teardown commands need to be added towards the
top, or they won't have the desired effect of cleaning up if the test
fails.
* Check that a versioned subdirectory gets renamed to match the new
version
* Ensure the recipe contents gets changed as we expect it to
* Check that the recipe directory is deleted by devtool reset at the end
(From OE-Core rev: d0ae258e963f9bafffc4ca43c87497d27e57c127)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r-- | meta/lib/oeqa/selftest/devtool.py | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py index 036146425b..4d280bb4af 100644 --- a/meta/lib/oeqa/selftest/devtool.py +++ b/meta/lib/oeqa/selftest/devtool.py | |||
@@ -1095,14 +1095,18 @@ class DevtoolTests(DevtoolBase): | |||
1095 | def test_devtool_upgrade(self): | 1095 | def test_devtool_upgrade(self): |
1096 | # Check preconditions | 1096 | # Check preconditions |
1097 | self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory') | 1097 | self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory') |
1098 | self.track_for_cleanup(self.workspacedir) | ||
1099 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | ||
1098 | # Check parameters | 1100 | # Check parameters |
1099 | result = runCmd('devtool upgrade -h') | 1101 | result = runCmd('devtool upgrade -h') |
1100 | for param in 'recipename srctree --version -V --branch -b --keep-temp --no-patch'.split(): | 1102 | for param in 'recipename srctree --version -V --branch -b --keep-temp --no-patch'.split(): |
1101 | self.assertIn(param, result.output) | 1103 | self.assertIn(param, result.output) |
1102 | # For the moment, we are using a real recipe. | 1104 | # For the moment, we are using a real recipe. |
1103 | recipe='devtool-upgrade' | 1105 | recipe = 'devtool-upgrade-test1' |
1104 | version='0.2' | 1106 | version = '1.6.0' |
1107 | oldrecipefile = get_bb_var('FILE', recipe) | ||
1105 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | 1108 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') |
1109 | self.track_for_cleanup(tempdir) | ||
1106 | # Check that recipe is not already under devtool control | 1110 | # Check that recipe is not already under devtool control |
1107 | result = runCmd('devtool status') | 1111 | result = runCmd('devtool status') |
1108 | self.assertNotIn(recipe, result.output) | 1112 | self.assertNotIn(recipe, result.output) |
@@ -1110,22 +1114,27 @@ class DevtoolTests(DevtoolBase): | |||
1110 | # we are downgrading instead of upgrading. | 1114 | # we are downgrading instead of upgrading. |
1111 | result = runCmd('devtool upgrade %s %s -V %s' % (recipe, tempdir, version)) | 1115 | result = runCmd('devtool upgrade %s %s -V %s' % (recipe, tempdir, version)) |
1112 | # Check if srctree at least is populated | 1116 | # Check if srctree at least is populated |
1113 | self.assertTrue(len(os.listdir(tempdir)) > 0, 'scrtree (%s) should be populated with new (%s) source code' % (tempdir, version)) | 1117 | self.assertTrue(len(os.listdir(tempdir)) > 0, 'srctree (%s) should be populated with new (%s) source code' % (tempdir, version)) |
1114 | # Check new recipe folder is present | 1118 | # Check new recipe subdirectory is present |
1115 | self.assertTrue(os.path.exists(os.path.join(self.workspacedir,'recipes',recipe)), 'Recipe folder should exist') | 1119 | self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'recipes', recipe, '%s-%s' % (recipe, version))), 'Recipe folder should exist') |
1116 | # Check new recipe file is present | 1120 | # Check new recipe file is present |
1117 | self.assertTrue(os.path.exists(os.path.join(self.workspacedir,'recipes',recipe,"%s_%s.bb" % (recipe,version))), 'Recipe folder should exist') | 1121 | newrecipefile = os.path.join(self.workspacedir, 'recipes', recipe, '%s_%s.bb' % (recipe, version)) |
1122 | self.assertTrue(os.path.exists(newrecipefile), 'Recipe file should exist after upgrade') | ||
1118 | # Check devtool status and make sure recipe is present | 1123 | # Check devtool status and make sure recipe is present |
1119 | result = runCmd('devtool status') | 1124 | result = runCmd('devtool status') |
1120 | self.assertIn(recipe, result.output) | 1125 | self.assertIn(recipe, result.output) |
1121 | self.assertIn(tempdir, result.output) | 1126 | self.assertIn(tempdir, result.output) |
1127 | # Check recipe got changed as expected | ||
1128 | with open(oldrecipefile + '.upgraded', 'r') as f: | ||
1129 | desiredlines = f.readlines() | ||
1130 | with open(newrecipefile, 'r') as f: | ||
1131 | newlines = f.readlines() | ||
1132 | self.assertEqual(desiredlines, newlines) | ||
1122 | # Check devtool reset recipe | 1133 | # Check devtool reset recipe |
1123 | result = runCmd('devtool reset %s -n' % recipe) | 1134 | result = runCmd('devtool reset %s -n' % recipe) |
1124 | result = runCmd('devtool status') | 1135 | result = runCmd('devtool status') |
1125 | self.assertNotIn(recipe, result.output) | 1136 | self.assertNotIn(recipe, result.output) |
1126 | self.track_for_cleanup(tempdir) | 1137 | self.assertFalse(os.path.exists(os.path.join(self.workspacedir, 'recipes', recipe)), 'Recipe directory should not exist after resetting') |
1127 | self.track_for_cleanup(self.workspacedir) | ||
1128 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | ||
1129 | 1138 | ||
1130 | @testcase(1352) | 1139 | @testcase(1352) |
1131 | def test_devtool_layer_plugins(self): | 1140 | def test_devtool_layer_plugins(self): |