summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/devtool.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/selftest/devtool.py')
-rw-r--r--meta/lib/oeqa/selftest/devtool.py43
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')