summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorOla x Nilsson <ola.x.nilsson@axis.com>2016-10-25 13:03:33 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-12-13 22:55:20 +0000
commit276523149914a75a939278b2e577383a2fdf3813 (patch)
tree3c321784a0902b290980562deeb93a1bf91a5d8e /meta/lib
parent9170a88cbddd510e2cf93049af8825f20cb61426 (diff)
downloadpoky-276523149914a75a939278b2e577383a2fdf3813.tar.gz
recipetool: selftest: Add test for recipetool plugin loading
Test that recipetool plugins are loaded in a well defined order. (From OE-Core rev: 044de8424a454a7057906e44eb56e2134ebb17e4) 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/recipetool.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/recipetool.py b/meta/lib/oeqa/selftest/recipetool.py
index db1f8deeb0..bcc2b46188 100644
--- a/meta/lib/oeqa/selftest/recipetool.py
+++ b/meta/lib/oeqa/selftest/recipetool.py
@@ -1,5 +1,6 @@
1import os 1import os
2import logging 2import logging
3import shutil
3import tempfile 4import tempfile
4import urllib.parse 5import urllib.parse
5 6
@@ -485,6 +486,47 @@ class RecipetoolTests(RecipetoolBase):
485 inherits = ['pkgconfig', 'autotools'] 486 inherits = ['pkgconfig', 'autotools']
486 self._test_recipe_contents(recipefile, checkvars, inherits) 487 self._test_recipe_contents(recipefile, checkvars, inherits)
487 488
489 def _copy_file_with_cleanup(self, srcfile, basedstdir, *paths):
490 dstdir = basedstdir
491 self.assertTrue(os.path.exists(dstdir))
492 for p in paths:
493 dstdir = os.path.join(dstdir, p)
494 if not os.path.exists(dstdir):
495 os.makedirs(dstdir)
496 self.track_for_cleanup(dstdir)
497 dstfile = os.path.join(dstdir, os.path.basename(srcfile))
498 if srcfile != dstfile:
499 shutil.copy(srcfile, dstfile)
500 self.track_for_cleanup(dstfile)
501
502 def test_recipetool_load_plugin(self):
503 """Test that recipetool loads only the first found plugin in BBPATH."""
504
505 recipetool = runCmd("which recipetool")
506 fromname = runCmd("recipetool --quiet pluginfile")
507 srcfile = fromname.output
508 bbpath = get_bb_var('BBPATH')
509 searchpath = bbpath.split(':') + [os.path.dirname(recipetool.output)]
510 plugincontent = []
511 with open(srcfile) as fh:
512 plugincontent = fh.readlines()
513 try:
514 self.assertIn('meta-selftest', srcfile, 'wrong bbpath plugin found')
515 for path in searchpath:
516 self._copy_file_with_cleanup(srcfile, path, 'lib', 'recipetool')
517 result = runCmd("recipetool --quiet count")
518 self.assertEqual(result.output, '1')
519 result = runCmd("recipetool --quiet multiloaded")
520 self.assertEqual(result.output, "no")
521 for path in searchpath:
522 result = runCmd("recipetool --quiet bbdir")
523 self.assertEqual(result.output, path)
524 os.unlink(os.path.join(result.output, 'lib', 'recipetool', 'bbpath.py'))
525 finally:
526 with open(srcfile, 'w') as fh:
527 fh.writelines(plugincontent)
528
529
488class RecipetoolAppendsrcBase(RecipetoolBase): 530class RecipetoolAppendsrcBase(RecipetoolBase):
489 def _try_recipetool_appendsrcfile(self, testrecipe, newfile, destfile, options, expectedlines, expectedfiles): 531 def _try_recipetool_appendsrcfile(self, testrecipe, newfile, destfile, options, expectedlines, expectedfiles):
490 cmd = 'recipetool appendsrcfile %s %s %s %s %s' % (options, self.templayerdir, testrecipe, newfile, destfile) 532 cmd = 'recipetool appendsrcfile %s %s %s %s %s' % (options, self.templayerdir, testrecipe, newfile, destfile)
@@ -574,6 +616,8 @@ class RecipetoolAppendsrcBase(RecipetoolBase):
574 self.assertIn(filesdir, filesextrapaths) 616 self.assertIn(filesdir, filesextrapaths)
575 617
576 618
619
620
577class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase): 621class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase):
578 622
579 @testcase(1273) 623 @testcase(1273)