diff options
author | Ola x Nilsson <ola.x.nilsson@axis.com> | 2016-10-25 13:03:32 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-12-13 22:55:20 +0000 |
commit | 9170a88cbddd510e2cf93049af8825f20cb61426 (patch) | |
tree | 7471369b6966e912938ac4b35bafa30a3f4971dd /meta/lib | |
parent | 2b7abbb383aad1f7ce6d392756b0c1b7666db95a (diff) | |
download | poky-9170a88cbddd510e2cf93049af8825f20cb61426.tar.gz |
devtool: selftest: add test for devtool plugin loading
Test that devtool plugins are loaded in a well defined order.
(From OE-Core rev: 0de81f0c8b29d8b442b3d099c3bec3fd345b6bfe)
Signed-off-by: Ola x Nilsson <ola.x.nilsson@axis.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/selftest/devtool.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py index 7db286fc15..3abba0805e 100644 --- a/meta/lib/oeqa/selftest/devtool.py +++ b/meta/lib/oeqa/selftest/devtool.py | |||
@@ -1263,6 +1263,49 @@ class DevtoolTests(DevtoolBase): | |||
1263 | result = runCmd("devtool --quiet selftest-reverse \"%s\"" % s) | 1263 | result = runCmd("devtool --quiet selftest-reverse \"%s\"" % s) |
1264 | self.assertEqual(result.output, s[::-1]) | 1264 | self.assertEqual(result.output, s[::-1]) |
1265 | 1265 | ||
1266 | def _copy_file_with_cleanup(self, srcfile, basedstdir, *paths): | ||
1267 | dstdir = basedstdir | ||
1268 | self.assertTrue(os.path.exists(dstdir)) | ||
1269 | for p in paths: | ||
1270 | dstdir = os.path.join(dstdir, p) | ||
1271 | if not os.path.exists(dstdir): | ||
1272 | os.makedirs(dstdir) | ||
1273 | self.track_for_cleanup(dstdir) | ||
1274 | dstfile = os.path.join(dstdir, os.path.basename(srcfile)) | ||
1275 | if srcfile != dstfile: | ||
1276 | shutil.copy(srcfile, dstfile) | ||
1277 | self.track_for_cleanup(dstfile) | ||
1278 | |||
1279 | def test_devtool_load_plugin(self): | ||
1280 | """Test that devtool loads only the first found plugin in BBPATH.""" | ||
1281 | |||
1282 | self.track_for_cleanup(self.workspacedir) | ||
1283 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | ||
1284 | |||
1285 | devtool = runCmd("which devtool") | ||
1286 | fromname = runCmd("devtool --quiet pluginfile") | ||
1287 | srcfile = fromname.output | ||
1288 | bbpath = get_bb_var('BBPATH') | ||
1289 | searchpath = bbpath.split(':') + [os.path.dirname(devtool.output)] | ||
1290 | plugincontent = [] | ||
1291 | with open(srcfile) as fh: | ||
1292 | plugincontent = fh.readlines() | ||
1293 | try: | ||
1294 | self.assertIn('meta-selftest', srcfile, 'wrong bbpath plugin found') | ||
1295 | for path in searchpath: | ||
1296 | self._copy_file_with_cleanup(srcfile, path, 'lib', 'devtool') | ||
1297 | result = runCmd("devtool --quiet count") | ||
1298 | self.assertEqual(result.output, '1') | ||
1299 | result = runCmd("devtool --quiet multiloaded") | ||
1300 | self.assertEqual(result.output, "no") | ||
1301 | for path in searchpath: | ||
1302 | result = runCmd("devtool --quiet bbdir") | ||
1303 | self.assertEqual(result.output, path) | ||
1304 | os.unlink(os.path.join(result.output, 'lib', 'devtool', 'bbpath.py')) | ||
1305 | finally: | ||
1306 | with open(srcfile, 'w') as fh: | ||
1307 | fh.writelines(plugincontent) | ||
1308 | |||
1266 | def _setup_test_devtool_finish_upgrade(self): | 1309 | def _setup_test_devtool_finish_upgrade(self): |
1267 | # Check preconditions | 1310 | # Check preconditions |
1268 | self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory') | 1311 | self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory') |