oeqa: Split configuration from the code
cover oeqa: Split configuration from the code
Improve oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
Configuration file reading is done through a new library in oeqa.utils and specific configuration files for each test are stored in a separate directory.
[Yocto 9389]
The following changes since commit dfc016fbf13e62f7767edaf7abadf1d1b72680b2:
maintainers.inc: remove augeas (2016-08-04 20:56:11 +0100)
are available in the git repository at:
ssh://git.yoctoproject.org/poky-contrib lamego/9389
http://git.yoctoproject.org/cgit.cgi//log/?h=lamego/9389
Jose Lamego (20):
oeqa.selftest.archiver: Split configuration from code oeqa.selftest._sstatetests_noauto: Split configuration from code oeqa.selftest.bblayers: Split configuration from code oeqa.selftest.bbtests: Split configuration from code oeqa.selftest.buildhistory: Split configuration from code oeqa.selftest.buildoptions: Split configuration from code oeqa.selftest.devtool: Split configuration from code oeqa.selftest.imagefeatures: Split configuration from code oeqa.selftest.layerappend: Split configuration from code oeqa.selftest.lic-checksum: Split configuration from code oeqa.selftest.manifest: Split configuration from code oeqa.selftest.oescripts: Split configuration from code oeqa.selftest.pkgdata: Split configuration from code oeqa.selftest.prservice: Split configuration from code oeqa.selftest.recipetool: Split configuration from code oeqa.selftest.runtime-test: Split configuration from code oeqa.selftest.signing: Split configuration from code oeqa.selftest.sstatetests: Split configuration from code oeqa.selftest.wic: Split configuration from code oeqa.utils.readconfig: Read self-test configuration file
meta/lib/oeqa/selftest/_sstatetests_noauto.py | 9 +- meta/lib/oeqa/selftest/archiver.py | 24 +- meta/lib/oeqa/selftest/bblayers.py | 125 ++++-- meta/lib/oeqa/selftest/bbtests.py | 175 ++++++--- meta/lib/oeqa/selftest/buildhistory.py | 10 +- meta/lib/oeqa/selftest/buildoptions.py | 231 ++++++++---- .../oeqa/selftest/conf/_sstatetests_noauto.conf | 3 + meta/lib/oeqa/selftest/conf/archiver.conf | 8 + meta/lib/oeqa/selftest/conf/bblayers.conf | 21 ++ meta/lib/oeqa/selftest/conf/bbtests.conf | 28 ++ meta/lib/oeqa/selftest/conf/buildhistory.conf | 3 + meta/lib/oeqa/selftest/conf/buildoptions.conf | 42 +++ meta/lib/oeqa/selftest/conf/devtool.conf | 100 +++++ meta/lib/oeqa/selftest/conf/imagefeatures.conf | 19 + meta/lib/oeqa/selftest/conf/layerappend.conf | 40 ++ meta/lib/oeqa/selftest/conf/lic-checksum.conf | 4 + meta/lib/oeqa/selftest/conf/manifest.conf | 8 + meta/lib/oeqa/selftest/conf/oescripts.conf | 6 + meta/lib/oeqa/selftest/conf/pkgdata.conf | 39 ++ meta/lib/oeqa/selftest/conf/prservice.conf | 21 ++ meta/lib/oeqa/selftest/conf/recipetool.conf | 84 +++++ meta/lib/oeqa/selftest/conf/runtime-test.conf | 13 + meta/lib/oeqa/selftest/conf/signing.conf | 15 + meta/lib/oeqa/selftest/conf/sstatetests.conf | 25 ++ meta/lib/oeqa/selftest/conf/wic.conf | 10 + meta/lib/oeqa/selftest/devtool.py | 417 ++++++++++++++------- meta/lib/oeqa/selftest/imagefeatures.py | 55 ++- meta/lib/oeqa/selftest/layerappend.py | 88 ++--- meta/lib/oeqa/selftest/lic-checksum.py | 22 +- meta/lib/oeqa/selftest/manifest.py | 22 +- meta/lib/oeqa/selftest/oescripts.py | 31 +- meta/lib/oeqa/selftest/pkgdata.py | 373 ++++++++++++------ meta/lib/oeqa/selftest/prservice.py | 71 +++- meta/lib/oeqa/selftest/recipetool.py | 326 ++++++++++++---- meta/lib/oeqa/selftest/runtime-test.py | 80 ++-- meta/lib/oeqa/selftest/signing.py | 119 +++--- meta/lib/oeqa/selftest/sstatetests.py | 162 +++++--- meta/lib/oeqa/selftest/wic.py | 150 +++++--- meta/lib/oeqa/utils/readconfig.py | 18 + 39 files changed, 2213 insertions(+), 784 deletions(-) create mode 100644 meta/lib/oeqa/selftest/conf/_sstatetests_noauto.conf create mode 100644 meta/lib/oeqa/selftest/conf/archiver.conf create mode 100644 meta/lib/oeqa/selftest/conf/bblayers.conf create mode 100644 meta/lib/oeqa/selftest/conf/bbtests.conf create mode 100644 meta/lib/oeqa/selftest/conf/buildhistory.conf create mode 100644 meta/lib/oeqa/selftest/conf/buildoptions.conf create mode 100644 meta/lib/oeqa/selftest/conf/devtool.conf create mode 100644 meta/lib/oeqa/selftest/conf/imagefeatures.conf create mode 100644 meta/lib/oeqa/selftest/conf/layerappend.conf create mode 100644 meta/lib/oeqa/selftest/conf/lic-checksum.conf create mode 100644 meta/lib/oeqa/selftest/conf/manifest.conf create mode 100644 meta/lib/oeqa/selftest/conf/oescripts.conf create mode 100644 meta/lib/oeqa/selftest/conf/pkgdata.conf create mode 100644 meta/lib/oeqa/selftest/conf/prservice.conf create mode 100644 meta/lib/oeqa/selftest/conf/recipetool.conf create mode 100644 meta/lib/oeqa/selftest/conf/runtime-test.conf create mode 100644 meta/lib/oeqa/selftest/conf/signing.conf create mode 100644 meta/lib/oeqa/selftest/conf/sstatetests.conf create mode 100644 meta/lib/oeqa/selftest/conf/wic.conf create mode 100644 meta/lib/oeqa/utils/readconfig.py
Signature · 1 line
1.8.3.1
PATCH 1/20 oeqa.selftest.archiver: Split configuration from code
Improve oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
[Yocto 9389]
--- meta/lib/oeqa/selftest/archiver.py | 24 +++++++++++++++--------- meta/lib/oeqa/selftest/conf/archiver.conf | 8 ++++++++ 2 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 meta/lib/oeqa/selftest/conf/archiver.conf
meta/lib/oeqa/selftest/archiver.py +15 -9
@@ -4,10 +4,16 @@ from oeqa.utils.decorators import testcase import glob import os import shutil +from oeqa.utils.readconfig import conffile class Archiver(oeSelfTest): + @classmethod + def setUpClass(cls): + # Get test configurations from configuration file + cls.config = conffile(__file__) + @testcase(1345) def test_archiver_allows_to_filter_on_recipe_name(self): """
@@ -19,13 +25,11 @@ class Archiver(oeSelfTest): AutomatedBy: Daniel Istrate <[email protected]> """ - include_recipe = 'busybox' - exclude_recipe = 'zlib' - - features = 'INHERIT += "archiver"\n' - features += 'ARCHIVER_MODE[src] = "original"\n' - features += 'COPYLEFT_PN_INCLUDE = "%s"\n' % include_recipe - features += 'COPYLEFT_PN_EXCLUDE = "%s"\n' % exclude_recipe + # Test configuration is taken from conf file + include_recipe = self.config.get('archiver', 'include_recipe') + exclude_recipe = self.config.get('archiver', 'exclude_recipe') + image = self.config.get('archiver', 'image') + features = self.config.get('archiver', 'archiver_features') # Update local.conf self.write_config(features)
@@ -43,8 +47,10 @@ class Archiver(oeSelfTest): # Check that include_recipe was included is_included = len(glob.glob(src_path + '/%s*' % include_recipe)) - self.assertEqual(1, is_included, 'Recipe %s was not included.' % include_recipe) + self.assertEqual(1, is_included, 'Recipe %s was not included.' + % include_recipe) # Check that exclude_recipe was excluded is_excluded = len(glob.glob(src_path + '/%s*' % exclude_recipe)) - self.assertEqual(0, is_excluded, 'Recipe %s was not excluded.' % exclude_recipe) + self.assertEqual(0, is_excluded, 'Recipe %s was not excluded.' + % exclude_recipe)
meta/lib/oeqa/selftest/conf/archiver.conf new file +8 -0
@@ -0,0 +1,8 @@ +[archiver] +include_recipe = busybox +exclude_recipe = zlib +archiver_features = INHERIT += "archiver" + ARCHIVER_MODE[src] = "original" + COPYLEFT_PN_INCLUDE = "busybox" + COPYLEFT_PN_EXCLUDE = "zlib" +image = core-image-minimal
Signature · 1 line
1.8.3.1
PATCH 2/20 oeqa.selftest._sstatetests_noauto: Split configuration from code
In reply to Jose LamegoImprove oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
[Yocto 9389]
--- meta/lib/oeqa/selftest/_sstatetests_noauto.py | 9 +++++++-- meta/lib/oeqa/selftest/conf/_sstatetests_noauto.conf | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 meta/lib/oeqa/selftest/conf/_sstatetests_noauto.conf
meta/lib/oeqa/selftest/_sstatetests_noauto.py +7 -2
@@ -8,6 +8,7 @@ import oeqa.utils.ftools as ftools from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_test_layer from oeqa.selftest.sstate import SStateBase +from oeqa.utils.readconfig import conffile class RebuildFromSState(SStateBase):
@@ -15,6 +16,8 @@ class RebuildFromSState(SStateBase): @classmethod def setUpClass(self): self.builddir = os.path.join(os.environ.get('BUILDDIR')) + # Get test configurations from configuration file + self.config = conffile(__file__) def get_dep_targets(self, primary_targets): found_targets = []
@@ -89,7 +92,9 @@ class RebuildFromSState(SStateBase): self.assertFalse(failed_cleansstate, msg="The following recipes have failed cleansstate(all others have passed both cleansstate and rebuild from sstate tests): %s" % ' '.join(map(str, failed_cleansstate))) def test_sstate_relocation(self): - self.run_test_sstate_rebuild(['core-image-sato-sdk'], relocate=True, rebuild_dependencies=True) + image = self.config.get('RebuildFromSState', 'sstate_relocation_image') + self.run_test_sstate_rebuild([image], relocate=True, rebuild_dependencies=True) def test_sstate_rebuild(self): - self.run_test_sstate_rebuild(['core-image-sato-sdk'], relocate=False, rebuild_dependencies=True) + image = self.config.get('RebuildFromSState', 'sstate_rebuild_image') + self.run_test_sstate_rebuild([image], relocate=False, rebuild_dependencies=True)
meta/lib/oeqa/selftest/conf/_sstatetests_noauto.conf new file +3 -0
@@ -0,0 +1,3 @@ +[RebuildFromSState] +sstate_relocation_image = core-image-sato-sdk +sstate_rebuild_image = core-image-sato-sdk
Signature · 1 line
1.8.3.1
PATCH 3/20 oeqa.selftest.bblayers: Split configuration from code
In reply to Jose LamegoImprove oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
[Yocto 9389]
--- meta/lib/oeqa/selftest/bblayers.py | 125 ++++++++++++++++++++++-------- meta/lib/oeqa/selftest/conf/bblayers.conf | 21 +++++ 2 files changed, 115 insertions(+), 31 deletions(-) create mode 100644 meta/lib/oeqa/selftest/conf/bblayers.conf
meta/lib/oeqa/selftest/bblayers.py +94 -31
@@ -8,86 +8,149 @@ import oeqa.utils.ftools as ftools from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, get_bb_var from oeqa.utils.decorators import testcase +from oeqa.utils.readconfig import conffile class BitbakeLayers(oeSelfTest): + @classmethod + def setUpClass(cls): + # Get test configurations from configuration file + cls.config = conffile(__file__) + @testcase(756) def test_bitbakelayers_showcrossdepends(self): result = runCmd('bitbake-layers show-cross-depends') - self.assertTrue('aspell' in result.output, msg = "No dependencies were shown. bitbake-layers show-cross-depends output: %s" % result.output) + recipe = self.config.get('BitbakeLayers', + 'bitbakelayers_showcrossdepends_recipe') + self.assertTrue(recipe in result.output, msg="No dependencies were \ +shown. bitbake-layers show-cross-depends output: %s" % result.output) @testcase(83) def test_bitbakelayers_showlayers(self): result = runCmd('bitbake-layers show-layers') - self.assertTrue('meta-selftest' in result.output, msg = "No layers were shown. bitbake-layers show-layers output: %s" % result.output) + layer = self.config.get('BitbakeLayers', + 'bitbakelayers_showlayers_layer') + self.assertTrue(layer in result.output, msg="No layers were shown. \ +bitbake-layers show-layers output: %s" % result.output) @testcase(93) def test_bitbakelayers_showappends(self): - recipe = "xcursor-transparent-theme" + recipe = self.config.get('BitbakeLayers', + 'bitbakelayers_showappends_recipe') bb_file = self.get_recipe_basename(recipe) result = runCmd('bitbake-layers show-appends') - self.assertTrue(bb_file in result.output, msg="%s file was not recognised. bitbake-layers show-appends output: %s" % (bb_file, result.output)) + self.assertTrue(bb_file in result.output, msg="%s file was not \ +recognised. bitbake-layers show-appends output: %s" + % (bb_file, result.output)) @testcase(90) def test_bitbakelayers_showoverlayed(self): result = runCmd('bitbake-layers show-overlayed') - self.assertTrue('aspell' in result.output, msg="aspell overlayed recipe was not recognised bitbake-layers show-overlayed %s" % result.output) + overlayed = self.config.get('BitbakeLayers', + 'bitbakelayers_showoverlayed_recipe') + self.assertTrue(overlayed in result.output, msg="%s overlayed recipe \ +was not recognised bitbake-layers show-overlayed %s" + % (overlayed, result.output)) @testcase(95) def test_bitbakelayers_flatten(self): - recipe = "xcursor-transparent-theme" - recipe_path = "recipes-graphics/xcursor-transparent-theme" + recipe = self.config.get('BitbakeLayers', + 'bitbakelayers_flatten_recipe') + recipe_path = os.path.join(self.config.get( + 'BitbakeLayers', 'bitbakelayers_flatten_recipedir'), recipe) recipe_file = self.get_recipe_basename(recipe) testoutdir = os.path.join(self.builddir, 'test_bitbakelayers_flatten') self.assertFalse(os.path.isdir(testoutdir), msg = "test_bitbakelayers_flatten should not exist at this point in time") self.track_for_cleanup(testoutdir) result = runCmd('bitbake-layers flatten %s' % testoutdir) bb_file = os.path.join(testoutdir, recipe_path, recipe_file) - self.assertTrue(os.path.isfile(bb_file), msg = "Cannot find xcursor-transparent-theme_0.1.1.bb in the test_bitbakelayers_flatten local dir.") + self.assertTrue(os.path.isfile(bb_file), msg="Cannot find %s_0.1.1.bb \ +in the test_bitbakelayers_flatten local dir." % recipe) contents = ftools.read_file(bb_file) find_in_contents = re.search("##### bbappended from meta-selftest #####\n(.*\n)*include test_recipe.inc", contents) self.assertTrue(find_in_contents, msg = "Flattening layers did not work. bitbake-layers flatten output: %s" % result.output) @testcase(1195) def test_bitbakelayers_add_remove(self): - test_layer = os.path.join(get_bb_var('COREBASE'), 'meta-skeleton') + layer = self.config.get('BitbakeLayers', + 'bitbakelayers_add_remove_layer') + test_layer = os.path.join(get_bb_var('COREBASE'), layer) result = runCmd('bitbake-layers show-layers') - self.assertNotIn('meta-skeleton', result.output, "This test cannot run with meta-skeleton in bblayers.conf. bitbake-layers show-layers output: %s" % result.output) + self.assertNotIn(layer, result.output, "This test cannot run with %s \ +in bblayers.conf. bitbake-layers show-layers output: %s" + % (layer, result.output)) result = runCmd('bitbake-layers add-layer %s' % test_layer) result = runCmd('bitbake-layers show-layers') - self.assertIn('meta-skeleton', result.output, msg = "Something wrong happened. meta-skeleton layer was not added to conf/bblayers.conf. bitbake-layers show-layers output: %s" % result.output) + self.assertIn(layer, result.output, msg="Something wrong happened. \ +%s layer was not added to conf/bblayers.conf. bitbake-layers show-layers \ +output: %s" % (layer, result.output)) result = runCmd('bitbake-layers remove-layer %s' % test_layer) result = runCmd('bitbake-layers show-layers') - self.assertNotIn('meta-skeleton', result.output, msg = "meta-skeleton should have been removed at this step. bitbake-layers show-layers output: %s" % result.output) + self.assertNotIn(layer, result.output, msg="%s should have been \ +removed at this step. bitbake-layers show-layers output: %s" + % (layer, result.output)) result = runCmd('bitbake-layers add-layer %s' % test_layer) result = runCmd('bitbake-layers show-layers') - self.assertIn('meta-skeleton', result.output, msg = "Something wrong happened. meta-skeleton layer was not added to conf/bblayers.conf. bitbake-layers show-layers output: %s" % result.output) - result = runCmd('bitbake-layers remove-layer */meta-skeleton') + self.assertIn(layer, result.output, msg="Something wrong happened. %s \ +layer was not added to conf/bblayers.conf. bitbake-layers show-layers output: \ +%s" % (layer, result.output)) + result = runCmd('bitbake-layers remove-layer */%s' % layer) result = runCmd('bitbake-layers show-layers') - self.assertNotIn('meta-skeleton', result.output, msg = "meta-skeleton should have been removed at this step. bitbake-layers show-layers output: %s" % result.output) + self.assertNotIn(layer, result.output, msg="%s should have been \ +removed at this step. bitbake-layers show-layers output: %s" + % (layer, result.output)) @testcase(1384) def test_bitbakelayers_showrecipes(self): + recipe1 = self.config.get( + 'BitbakeLayers', 'bitbakelayers_showrecipes_recipe1') + recipe2 = self.config.get( + 'BitbakeLayers', 'bitbakelayers_showrecipes_recipe2') + recipe3 = self.config.get( + 'BitbakeLayers', 'bitbakelayers_showrecipes_recipe3') + recipe4 = self.config.get( + 'BitbakeLayers', 'bitbakelayers_showrecipes_recipe4') + inkernel = self.config.get( + 'BitbakeLayers', 'bitbakelayers_showrecipes_inkernel') + nokernel = self.config.get( + 'BitbakeLayers', 'bitbakelayers_showrecipes_nokernel') + inimage = self.config.get( + 'BitbakeLayers', 'bitbakelayers_showrecipes_inimage') + noimage1 = self.config.get( + 'BitbakeLayers', 'bitbakelayers_showrecipes_noimage1') + noimage2 = self.config.get( + 'BitbakeLayers', 'bitbakelayers_showrecipes_noimage2') + incmakepkgconfig = self.config.get( + 'BitbakeLayers', 'bitbakelayers_showrecipes_incmakepkgconfig') + nocmakepkgconfig1 = self.config.get( + 'BitbakeLayers', 'bitbakelayers_showrecipes_nocmakepkgconfig1') + nocmakepkgconfig2 = self.config.get( + 'BitbakeLayers', 'bitbakelayers_showrecipes_nocmakepkgconfig2') + nocmakepkgconfig3 = self.config.get( + 'BitbakeLayers', 'bitbakelayers_showrecipes_nocmakepkgconfig3') result = runCmd('bitbake-layers show-recipes') - self.assertIn('aspell:', result.output) - self.assertIn('mtd-utils:', result.output) - self.assertIn('linux-yocto:', result.output) - self.assertIn('core-image-minimal:', result.output) - result = runCmd('bitbake-layers show-recipes mtd-utils') - self.assertIn('mtd-utils:', result.output) - self.assertNotIn('aspell:', result.output) + self.assertIn("%s:" % recipe1, result.output) + self.assertIn("%s:" % recipe2, result.output) + self.assertIn("%s:" % recipe3, result.output) + self.assertIn("%s:" % recipe4, result.output) + result = runCmd('bitbake-layers show-recipes %s' % recipe2) + self.assertIn('%s:' % recipe2, result.output) + self.assertNotIn('%s:' % recipe1, result.output) result = runCmd('bitbake-layers show-recipes -i kernel') - self.assertIn('linux-yocto:', result.output) - self.assertNotIn('mtd-utils:', result.output) + self.assertIn('%s:' % inkernel, result.output) + self.assertNotIn('%s:' % nokernel, result.output) result = runCmd('bitbake-layers show-recipes -i image') - self.assertIn('core-image-minimal', result.output) - self.assertNotIn('linux-yocto:', result.output) - self.assertNotIn('mtd-utils:', result.output) + self.assertIn(inimage, result.output) + self.assertNotIn('%s:' % noimage2, result.output) + self.assertNotIn('%s:' % noimage1, result.output) result = runCmd('bitbake-layers show-recipes -i cmake,pkgconfig') - self.assertIn('libproxy:', result.output) - self.assertNotIn('mtd-utils:', result.output) # doesn't inherit either - self.assertNotIn('wget:', result.output) # doesn't inherit cmake - self.assertNotIn('waffle:', result.output) # doesn't inherit pkgconfig + self.assertIn('%s:' % incmakepkgconfig, result.output) + # doesn't inherit either: + self.assertNotIn('%s:' % nocmakepkgconfig1, result.output) + # doesn't inherit cmake: + self.assertNotIn('%s:' % nocmakepkgconfig2, result.output) + # doesn't inherit pkgconfig + self.assertNotIn('%s:' % nocmakepkgconfig3, result.output) result = runCmd('bitbake-layers show-recipes -i nonexistentclass', ignore_status=True) self.assertNotEqual(result.status, 0, 'bitbake-layers show-recipes -i nonexistentclass should have failed') self.assertIn('ERROR:', result.output)
meta/lib/oeqa/selftest/conf/bblayers.conf new file +21 -0
@@ -0,0 +1,21 @@ +[BitbakeLayers] +bitbakelayers_showcrossdepends_recipe = aspell +bitbakelayers_showlayers_layer = meta-selftest +bitbakelayers_showappends_recipe = xcursor-transparent-theme +bitbakelayers_showoverlayed_recipe = aspell +bitbakelayers_flatten_recipe = xcursor-transparent-theme +bitbakelayers_flatten_recipedir = recipes-graphics +bitbakelayers_add_remove_layer = meta-skeleton +bitbakelayers_showrecipes_recipe1 = aspell +bitbakelayers_showrecipes_recipe2 = mtd-utils +bitbakelayers_showrecipes_recipe3 = linux-yocto +bitbakelayers_showrecipes_recipe4 = core-image-minimal +bitbakelayers_showrecipes_inkernel = linux-yocto +bitbakelayers_showrecipes_nokernel = mtd-utils +bitbakelayers_showrecipes_inimage = core-image-minimal +bitbakelayers_showrecipes_noimage1 = mtd-utils +bitbakelayers_showrecipes_noimage2 = linux-yocto +bitbakelayers_showrecipes_incmakepkgconfig = libproxy +bitbakelayers_showrecipes_nocmakepkgconfig1 = mtd-utils +bitbakelayers_showrecipes_nocmakepkgconfig2 = wget +bitbakelayers_showrecipes_nocmakepkgconfig3 = waffle
Signature · 1 line
1.8.3.1
PATCH 4/20 oeqa.selftest.bbtests: Split configuration from code
In reply to Jose LamegoImprove oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
[Yocto 9389]
--- meta/lib/oeqa/selftest/bbtests.py | 175 +++++++++++++++++++++---------- meta/lib/oeqa/selftest/conf/bbtests.conf | 28 +++++ 2 files changed, 150 insertions(+), 53 deletions(-) create mode 100644 meta/lib/oeqa/selftest/conf/bbtests.conf
meta/lib/oeqa/selftest/bbtests.py +122 -53
@@ -5,9 +5,16 @@ import oeqa.utils.ftools as ftools from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var from oeqa.utils.decorators import testcase +from oeqa.utils.readconfig import conffile + class BitbakeTests(oeSelfTest): + @classmethod + def setUpClass(cls): + # Get test configurations from configuration file + cls.config = conffile(__file__) + def getline(self, res, line): for l in res.output.split('\n'): if line in l:
@@ -27,8 +34,10 @@ class BitbakeTests(oeSelfTest): @testcase(806) def test_event_handler(self): - self.write_config("INHERIT += \"test_events\"") - result = bitbake('m4-native') + features = self.config.get('bitbaketests', 'event_handler_features') + recipe = self.config.get('bitbaketests', 'event_handler_recipe') + self.write_config(features) + result = bitbake(recipe) find_build_started = re.search("NOTE: Test for bb\.event\.BuildStarted(\n.*)*NOTE: Executing RunQueue Tasks", result.output) find_build_completed = re.search("Tasks Summary:.*(\n.*)*NOTE: Test for bb\.event\.BuildCompleted", result.output) self.assertTrue(find_build_started, msg = "Match failed in:\n%s" % result.output)
@@ -37,26 +46,40 @@ class BitbakeTests(oeSelfTest): @testcase(103) def test_local_sstate(self): - bitbake('m4-native -ccleansstate') - bitbake('m4-native') - bitbake('m4-native -cclean') - result = bitbake('m4-native') - find_setscene = re.search("m4-native.*do_.*_setscene", result.output) - self.assertTrue(find_setscene, msg = "No \"m4-native.*do_.*_setscene\" message found during bitbake m4-native. bitbake output: %s" % result.output ) + recipe = self.config.get('bitbaketests', 'local_sstate_recipe') + bitbake('%s -ccleansstate' % recipe) + bitbake(recipe) + bitbake('%s -cclean' % recipe) + result = bitbake(recipe) + find_setscene = re.search( + "%s.*do_.*_setscene" % recipe, result.output) + self.assertTrue(find_setscene, msg="No \"%s.*do_.*_setscene\" message \ +found during bitbake %s. bitbake output: %s" % (recipe, recipe, result.output)) @testcase(105) def test_bitbake_invalid_recipe(self): - result = bitbake('-b asdf', ignore_status=True) - self.assertTrue("ERROR: Unable to find any recipe file matching 'asdf'" in result.output, msg = "Though asdf recipe doesn't exist, bitbake didn't output any err. message. bitbake output: %s" % result.output) + recipe = eval( + self.config.get('bitbaketests', 'bb_invalid_recipe_recipe')) + result = bitbake('-b %s' % recipe, ignore_status=True) + self.assertTrue("ERROR: Unable to find any recipe file matching '%s'" + % recipe in result.output, + msg="Though %s recipe doesn't exist, bitbake didn't \ +output any err. message. bitbake output: %s" % (recipe, result.output)) @testcase(107) def test_bitbake_invalid_target(self): - result = bitbake('asdf', ignore_status=True) - self.assertTrue("ERROR: Nothing PROVIDES 'asdf'" in result.output, msg = "Though no 'asdf' target exists, bitbake didn't output any err. message. bitbake output: %s" % result.output) + recipe = eval( + self.config.get('bitbaketests', 'bb_invalid_target_recipe')) + result = bitbake(recipe, ignore_status=True) + self.assertTrue("ERROR: Nothing PROVIDES '%s'" % recipe + in result.output, msg="Though no '%s' target exists, \ +bitbake didn't output any err. message. bitbake output: %s" + % (recipe, result.output)) @testcase(106) def test_warnings_errors(self): - result = bitbake('-b asdf', ignore_status=True) + recipe = self.config.get('bitbaketests', 'warnings_errors_recipe') + result = bitbake('-b %s' % recipe, ignore_status=True) find_warnings = re.search("Summary: There w.{2,3}? [1-9][0-9]* WARNING messages* shown", result.output) find_errors = re.search("Summary: There w.{2,3}? [1-9][0-9]* ERROR messages* shown", result.output) self.assertTrue(find_warnings, msg="Did not find the mumber of warnings at the end of the build:\n" + result.output)
@@ -64,18 +87,22 @@ class BitbakeTests(oeSelfTest): @testcase(108) def test_invalid_patch(self): - self.write_recipeinc('man', 'SRC_URI += "file://man-1.5h1-make.patch"') - result = bitbake('man -c patch', ignore_status=True) - self.delete_recipeinc('man') - bitbake('-cclean man') + recipe = self.config.get('bitbaketests', 'invalid_patch_recipe') + filename = self.config.get('bitbaketests', 'invalid_patch_file') + self.write_recipeinc(recipe, 'SRC_URI += "file://%s"' % filename) + result = bitbake('%s -c patch' % recipe, ignore_status=True) + self.delete_recipeinc(recipe) + bitbake('-cclean %s' % recipe) line = self.getline(result, "Function failed: patch_do_patch") - self.assertTrue(line and line.startswith("ERROR:"), msg = "Though no man-1.5h1-make.patch file exists, bitbake didn't output any err. message. bitbake output: %s" % result.output) + self.assertTrue(line and line.startswith("ERROR:"), + msg="Though no %s file exists, bitbake didn't output \ +any err. message. bitbake output: %s" % (filename, result.output)) @testcase(1354) def test_force_task_1(self): # test 1 from bug 5875 - test_recipe = 'zlib' - test_data = "Microsoft Made No Profit From Anyone's Zunes Yo" + test_recipe = self.config.get('bitbaketests', 'force_task_1_recipe') + test_data = self.config.get('bitbaketests', 'force_task_1_data') image_dir = get_bb_var('D', test_recipe) pkgsplit_dir = get_bb_var('PKGDEST', test_recipe) man_dir = get_bb_var('mandir', test_recipe)
@@ -84,11 +111,12 @@ class BitbakeTests(oeSelfTest): bitbake(test_recipe) self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe) - man_file = os.path.join(image_dir + man_dir, 'man3/zlib.3') + man_file = os.path.join(image_dir + man_dir, 'man3/%s.3' % test_recipe) ftools.append_file(man_file, test_data) bitbake('-c package -f %s' % test_recipe) - man_split_file = os.path.join(pkgsplit_dir, 'zlib-doc' + man_dir, 'man3/zlib.3') + man_split_file = os.path.join(pkgsplit_dir, '%s-doc' % test_recipe + + man_dir, 'man3/%s.3' % test_recipe) man_split_content = ftools.read_file(man_split_file) self.assertIn(test_data, man_split_content, 'The man file has not changed in packages-split.')
@@ -98,7 +126,7 @@ class BitbakeTests(oeSelfTest): @testcase(163) def test_force_task_2(self): # test 2 from bug 5875 - test_recipe = 'zlib' + test_recipe = self.config.get('bitbaketests', 'force_task_2_recipe') bitbake('-c cleansstate %s' % test_recipe) bitbake(test_recipe)
@@ -111,17 +139,29 @@ class BitbakeTests(oeSelfTest): @testcase(167) def test_bitbake_g(self): - result = bitbake('-g core-image-full-cmdline') - for f in ['pn-buildlist', 'pn-depends.dot', 'package-depends.dot', 'task-depends.dot']: - self.addCleanup(os.remove, f) - self.assertTrue('NOTE: PN build list saved to \'pn-buildlist\'' in result.output, msg = "No dependency \"pn-buildlist\" file was generated for the given task target. bitbake output: %s" % result.output) - self.assertTrue('openssh' in ftools.read_file(os.path.join(self.builddir, 'pn-buildlist')), msg = "No \"openssh\" dependency found in pn-buildlist file.") + image = self.config.get('bitbaketests', 'bitbake_g_image') + pnfiles = eval(self.config.get('bitbaketests', 'bitbake_g_files')) + drecipe = self.config.get( + 'bitbaketests', 'bitbake_g_dependencyrecipe') + result = bitbake('-g %s' % image) + for f in pnfiles: + self.addCleanup(os.remove, pnfiles[f]) + self.assertTrue('NOTE: PN build list saved to \'%s\'' + % pnfiles['PN build list'] in result.output, + msg="No dependency \"%s\" file was generated for \ +the given task target. bitbake output: %s" + % (pnfiles['PN build list'], result.output)) + self.assertTrue(drecipe in ftools.read_file(os.path.join(self.builddir, + pnfiles['PN build list'])), + msg="No \"%s\" dependency found in %s file." + % (drecipe, pnfiles['PN build list'])) @testcase(899) def test_image_manifest(self): - bitbake('core-image-minimal') - deploydir = get_bb_var("DEPLOY_DIR_IMAGE", target="core-image-minimal") - imagename = get_bb_var("IMAGE_LINK_NAME", target="core-image-minimal") + image = self.config.get('bitbaketests', 'image_manifest_image') + bitbake(image) + deploydir = get_bb_var("DEPLOY_DIR_IMAGE", target=image) + imagename = get_bb_var("IMAGE_LINK_NAME", target=image) manifest = os.path.join(deploydir, imagename + ".manifest") self.assertTrue(os.path.islink(manifest), msg="No manifest file created for image. It should have been created in %s" % manifest)
@@ -147,29 +187,42 @@ doesn't exist, yet fetcher didn't report any error. bitbake output: %s" % result @testcase(171) def test_rename_downloaded_file(self): + recipe = self.config.get( + 'bitbaketests', 'rename_downloaded_file_recipe') self.write_config("""DL_DIR = \"${TOPDIR}/download-selftest\" SSTATE_DIR = \"${TOPDIR}/download-selftest\" """) self.track_for_cleanup(os.path.join(self.builddir, "download-selftest")) - data = 'SRC_URI_append = ";downloadfilename=test-aspell.tar.gz"' - self.write_recipeinc('aspell', data) - bitbake('-ccleanall aspell') - result = bitbake('-c fetch aspell', ignore_status=True) - self.delete_recipeinc('aspell') - self.assertEqual(result.status, 0, msg = "Couldn't fetch aspell. %s" % result.output) - self.assertTrue(os.path.isfile(os.path.join(get_bb_var("DL_DIR"), 'test-aspell.tar.gz')), msg = "File rename failed. No corresponding test-aspell.tar.gz file found under %s" % str(get_bb_var("DL_DIR"))) - self.assertTrue(os.path.isfile(os.path.join(get_bb_var("DL_DIR"), 'test-aspell.tar.gz.done')), "File rename failed. No corresponding test-aspell.tar.gz.done file found under %s" % str(get_bb_var("DL_DIR"))) + data = 'SRC_URI_append = ";downloadfilename=test-%s.tar.gz"' % recipe + self.write_recipeinc(recipe, data) + bitbake('-ccleanall %s' % recipe) + result = bitbake('-c fetch %s' % recipe, ignore_status=True) + self.delete_recipeinc(recipe) + self.assertEqual(result.status, 0, msg="Couldn't fetch %s. %s" + % (recipe, result.output)) + self.assertTrue(os.path.isfile(os.path.join(get_bb_var("DL_DIR"), + 'test-%s.tar.gz' % recipe)), + msg="File rename failed. No corresponding \ +test-%s.tar.gz file found under %s" % (recipe, str(get_bb_var("DL_DIR")))) + self.assertTrue(os.path.isfile(os.path.join(get_bb_var("DL_DIR"), + 'test-%s.tar.gz.done' % recipe)), + "File rename failed. No corresponding \ +test-%s.tar.gz.done file found under %s" % (recipe, str(get_bb_var("DL_DIR")))) @testcase(1028) def test_environment(self): - self.write_config("TEST_ENV=\"localconf\"") + tstring = self.config.get('bitbaketests', 'environment_teststring') + self.write_config("TEST_ENV=\"%s\"" % tstring) result = runCmd('bitbake -e | grep TEST_ENV=') - self.assertTrue('localconf' in result.output, msg = "bitbake didn't report any value for TEST_ENV variable. To test, run 'bitbake -e | grep TEST_ENV='") + self.assertTrue(tstring in result.output, + msg="bitbake didn't report any value for TEST_ENV \ +variable. To test, run 'bitbake -e | grep TEST_ENV='") @testcase(1029) def test_dry_run(self): - result = runCmd('bitbake -n m4-native') + recipe = self.config.get('bitbaketests', 'dry_run_recipe') + result = runCmd('bitbake -n %s' % recipe) self.assertEqual(0, result.status, "bitbake dry run didn't run as expected. %s" % result.output) @testcase(1030)
@@ -205,38 +258,53 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\" @testcase(1034) def test_checkuri(self): - result = runCmd('bitbake -c checkuri m4') + recipe = self.config.get('bitbaketests', 'checkuri_recipe') + result = runCmd('bitbake -c checkuri %s' % recipe) self.assertEqual(0, result.status, msg = "\"checkuri\" task was not executed. bitbake output: %s" % result.output) @testcase(1035) def test_continue(self): + recipe = self.config.get('bitbaketests', 'continue_recipe') self.write_config("""DL_DIR = \"${TOPDIR}/download-selftest\" SSTATE_DIR = \"${TOPDIR}/download-selftest\" """) self.track_for_cleanup(os.path.join(self.builddir, "download-selftest")) self.write_recipeinc('man',"\ndo_fail_task () {\nexit 1 \n}\n\naddtask do_fail_task before do_fetch\n" ) - runCmd('bitbake -c cleanall man xcursor-transparent-theme') - result = runCmd('bitbake man xcursor-transparent-theme -k', ignore_status=True) + runCmd('bitbake -c cleanall man %s' % recipe) + result = runCmd('bitbake man %s -k' % recipe, ignore_status=True) errorpos = result.output.find('ERROR: Function failed: do_fail_task') - manver = re.search("NOTE: recipe xcursor-transparent-theme-(.*?): task do_unpack: Started", result.output) - continuepos = result.output.find('NOTE: recipe xcursor-transparent-theme-%s: task do_unpack: Started' % manver.group(1)) + manver = re.search( + "NOTE: recipe %s-(.*?): task do_unpack: Started" % recipe, + result.output) + continuepos = result.output.find('NOTE: recipe %s-%s: task do_unpack: \ +Started' % (recipe, manver.group(1))) self.assertLess(errorpos,continuepos, msg = "bitbake didn't pass do_fail_task. bitbake output: %s" % result.output) @testcase(1119) def test_non_gplv3(self): - data = 'INCOMPATIBLE_LICENSE = "GPLv3"' + recipe = self.config.get('bitbaketests', 'non_gplv3_recipe') + data = self.config.get('bitbaketests', 'non_gplv3_data') conf = os.path.join(self.builddir, 'conf/local.conf') ftools.append_file(conf ,data) self.addCleanup(ftools.remove_from_file, conf ,data) - result = bitbake('readline', ignore_status=True) + result = bitbake(recipe, ignore_status=True) self.assertEqual(result.status, 0, "Bitbake failed, exit code %s, output %s" % (result.status, result.output)) - self.assertFalse(os.path.isfile(os.path.join(self.builddir, 'tmp/deploy/licenses/readline/generic_GPLv3'))) - self.assertTrue(os.path.isfile(os.path.join(self.builddir, 'tmp/deploy/licenses/readline/generic_GPLv2'))) + self.assertFalse( + os.path.isfile(os.path.join( + self.builddir, + 'tmp/deploy/licenses/%s/generic_GPLv3' + % recipe))) + self.assertTrue( + os.path.isfile(os.path.join( + self.builddir, + 'tmp/deploy/licenses/%s/generic_GPLv2' + % recipe))) @testcase(1422) def test_setscene_only(self): """ Bitbake option to restore from sstate only within a build (i.e. execute no real tasks, only setscene)""" - test_recipe = 'ed' + test_recipe = self.config.get( + 'bitbaketests', 'setscene_only_recipe') bitbake(test_recipe) bitbake('-c clean %s' % test_recipe)
@@ -251,7 +319,8 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\" @testcase(1425) def test_bbappend_order(self): """ Bitbake should bbappend to recipe in a predictable order """ - test_recipe = 'ed' + test_recipe = self.config.get( + 'bitbaketests', 'bbappend_order_recipe') test_recipe_summary_before = get_bb_var('SUMMARY', test_recipe) test_recipe_pv = get_bb_var('PV', test_recipe) recipe_append_file = test_recipe + '_' + test_recipe_pv + '.bbappend'
meta/lib/oeqa/selftest/conf/bbtests.conf new file +28 -0
@@ -0,0 +1,28 @@ +[bitbaketests] +event_handler_features = INHERIT += "test_events" +event_handler_recipe = m4-native +local_sstate_recipe = %(event_handler_recipe)s +bb_invalid_recipe_recipe = "asdf" # nonexistent recipe +bb_invalid_target_recipe = %(bb_invalid_recipe_recipe)s +warnings_errors_recipe = %(bb_invalid_recipe_recipe)s +invalid_patch_recipe = man +invalid_patch_file = man-1.5h1-make.patch +force_task_1_recipe = zlib +force_task_1_data = Microsoft Made No Profit From Anyone's Zunes Yo +force_task_2_recipe = %(force_task_1_recipe)s +bitbake_g_image = core-image-full-cmdline +bitbake_g_files = {'PN build list': 'pn-buildlist', + 'PN dependencies list': 'pn-depends.dot', + 'Package dependencies list': 'package-depends.dot', + 'Task dependencies list': 'task-depends.dot'} +bitbake_g_dependencyrecipe = openssh +image_manifest_image = core-image-minimal +rename_downloaded_file_recipe = aspell +environment_teststring = localconf +dry_run_recipe = %(event_handler_recipe)s +checkuri_recipe = m4 +continue_recipe = xcursor-transparent-theme +non_gplv3_data = INCOMPATIBLE_LICENSE = "GPLv3" +non_gplv3_recipe = readline +setscene_only_recipe = ed +bbappend_order_recipe = %(setscene_only_recipe)s
Signature · 1 line
1.8.3.1
PATCH 5/20 oeqa.selftest.buildhistory: Split configuration from code
In reply to Jose LamegoImprove oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
[Yocto 9389]
--- meta/lib/oeqa/selftest/buildhistory.py | 10 +++++++++- meta/lib/oeqa/selftest/conf/buildhistory.conf | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 meta/lib/oeqa/selftest/conf/buildhistory.conf
meta/lib/oeqa/selftest/buildhistory.py +9 -1
@@ -5,13 +5,21 @@ import datetime from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import bitbake, get_bb_var from oeqa.utils.decorators import testcase +from oeqa.utils.readconfig import conffile class BuildhistoryBase(oeSelfTest): + @classmethod + def setUpClass(cls): + # Get test configurations from configuration file + cls.config = conffile(__file__) + def config_buildhistory(self, tmp_bh_location=False): if (not 'buildhistory' in get_bb_var('USER_CLASSES')) and (not 'buildhistory' in get_bb_var('INHERIT')): - add_buildhistory_config = 'INHERIT += "buildhistory"\nBUILDHISTORY_COMMIT = "1"' + add_buildhistory_config = self.config.get( + 'buildhistory', + 'config_buildhistory_features') self.append_config(add_buildhistory_config) if tmp_bh_location:
meta/lib/oeqa/selftest/conf/buildhistory.conf new file +3 -0
@@ -0,0 +1,3 @@ +[buildhistory] +config_buildhistory_features = INHERIT += "buildhistory" + BUILDHISTORY_COMMIT = "1"
Signature · 1 line
1.8.3.1
PATCH 6/20 oeqa.selftest.buildoptions: Split configuration from code
In reply to Jose LamegoImprove oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
[Yocto 9389]
--- meta/lib/oeqa/selftest/buildoptions.py | 231 +++++++++++++++++++------- meta/lib/oeqa/selftest/conf/buildoptions.conf | 42 +++++ 2 files changed, 210 insertions(+), 63 deletions(-) create mode 100644 meta/lib/oeqa/selftest/conf/buildoptions.conf
meta/lib/oeqa/selftest/buildoptions.py +168 -63
@@ -8,78 +8,145 @@ from oeqa.selftest.buildhistory import BuildhistoryBase from oeqa.utils.commands import runCmd, bitbake, get_bb_var import oeqa.utils.ftools as ftools from oeqa.utils.decorators import testcase +from oeqa.utils.readconfig import conffile + class ImageOptionsTests(oeSelfTest): + @classmethod + def setUpClass(cls): + # Get test configurations from configuration file + cls.config = conffile(__file__) + @testcase(761) def test_incremental_image_generation(self): image_pkgtype = get_bb_var("IMAGE_PKGTYPE") if image_pkgtype != 'rpm': self.skipTest('Not using RPM as main package format') - bitbake("-c cleanall core-image-minimal") - self.write_config('INC_RPM_IMAGE_GEN = "1"') - self.append_config('IMAGE_FEATURES += "ssh-server-openssh"') - bitbake("core-image-minimal") - log_data_file = os.path.join(get_bb_var("WORKDIR", "core-image-minimal"), "temp/log.do_rootfs") + image = self.config.get( + 'ImageOptionsTests', 'incremental_image_generation_image') + writeconfig = self.config.get( + 'ImageOptionsTests', + 'incremental_image_generation_writeconfig') + appendconfig = self.config.get( + 'ImageOptionsTests', + 'incremental_image_generation_appendconfig') + packagecreated = self.config.get( + 'ImageOptionsTests', + 'incremental_image_generation_packagecreated') + packageremoved = self.config.get( + 'ImageOptionsTests', + 'incremental_image_generation_packageremoved') + bitbake("-c cleanall %s" % image) + self.write_config(writeconfig) + self.append_config(appendconfig) + bitbake(image) + log_data_file = os.path.join( + get_bb_var("WORKDIR", image), "temp/log.do_rootfs") log_data_created = ftools.read_file(log_data_file) incremental_created = re.search("NOTE: load old install solution for incremental install\nNOTE: old install solution not exist\nNOTE: creating new install solution for incremental install(\n.*)*NOTE: Installing the following packages:.*packagegroup-core-ssh-openssh", log_data_created) - self.remove_config('IMAGE_FEATURES += "ssh-server-openssh"') + self.remove_config(appendconfig) self.assertTrue(incremental_created, msg = "Match failed in:\n%s" % log_data_created) - bitbake("core-image-minimal") + bitbake(image) log_data_removed = ftools.read_file(log_data_file) incremental_removed = re.search("NOTE: load old install solution for incremental install\nNOTE: creating new install solution for incremental install(\n.*)*NOTE: incremental removed:.*openssh-sshd-.*", log_data_removed) self.assertTrue(incremental_removed, msg = "Match failed in:\n%s" % log_data_removed) @testcase(925) def test_rm_old_image(self): - bitbake("core-image-minimal") - deploydir = get_bb_var("DEPLOY_DIR_IMAGE", target="core-image-minimal") - imagename = get_bb_var("IMAGE_LINK_NAME", target="core-image-minimal") + image = self.config.get('ImageOptionsTests', 'rm_old_image_image') + bitbake(image) + deploydir = get_bb_var("DEPLOY_DIR_IMAGE", target=image) + imagename = get_bb_var("IMAGE_LINK_NAME", target=image) deploydir_files = os.listdir(deploydir) track_original_files = [] for image_file in deploydir_files: if imagename in image_file and os.path.islink(os.path.join(deploydir, image_file)): track_original_files.append(os.path.realpath(os.path.join(deploydir, image_file))) self.write_config("RM_OLD_IMAGE = \"1\"") - bitbake("-C rootfs core-image-minimal") + bitbake("-C rootfs %s" % image) deploydir_files = os.listdir(deploydir) remaining_not_expected = [path for path in track_original_files if os.path.basename(path) in deploydir_files] self.assertFalse(remaining_not_expected, msg="\nThe following image files were not removed: %s" % ', '.join(map(str, remaining_not_expected))) @testcase(286) def test_ccache_tool(self): - bitbake("ccache-native") - self.assertTrue(os.path.isfile(os.path.join(get_bb_var('STAGING_BINDIR_NATIVE', 'ccache-native'), "ccache")), msg = "No ccache found under %s" % str(get_bb_var('STAGING_BINDIR_NATIVE', 'ccache-native'))) - self.write_config('INHERIT += "ccache"') - bitbake("m4 -c cleansstate") - bitbake("m4 -c compile") - self.addCleanup(bitbake, 'ccache-native -ccleansstate') - res = runCmd("grep ccache %s" % (os.path.join(get_bb_var("WORKDIR","m4"),"temp/log.do_compile")), ignore_status=True) - self.assertEqual(0, res.status, msg="No match for ccache in m4 log.do_compile. For further details: %s" % os.path.join(get_bb_var("WORKDIR","m4"),"temp/log.do_compile")) + recipe1 = self.config.get('ImageOptionsTests', 'ccache_tool_recipe1') + recipe2 = self.config.get('ImageOptionsTests', 'ccache_tool_recipe2') + recipenative = self.config.get( + 'ImageOptionsTests', 'ccache_tool_recipenative') + bitbake("%s-native" % recipe1) + self.assertTrue( + os.path.isfile( + os.path.join( + get_bb_var('STAGING_BINDIR_NATIVE', '%s-native' % recipe1), + recipe1)), + msg="No %s found under %s" + % (recipe1, str(get_bb_var( + 'STAGING_BINDIR_NATIVE', + '%s-native' % recipe1)))) + self.write_config('INHERIT += "%s"' % recipe1) + bitbake("%s -c cleansstate" % recipe2) + bitbake("%s -c compile" % recipe2) + self.addCleanup(bitbake, '%s-native -ccleansstate' % recipe1) + res = runCmd("grep %s %s" + % (recipe1, os.path.join( + get_bb_var("WORKDIR", recipe2), + "temp/log.do_compile")), + ignore_status=True) + self.assertEqual( + 0, res.status, + msg="No match for %s in %s log.do_compile. For further details: %s" + % (recipe1, recipe2, os.path.join(get_bb_var("WORKDIR", recipe2), + "temp/log.do_compile"))) @testcase(1435) def test_read_only_image(self): - self.write_config('IMAGE_FEATURES += "read-only-rootfs"') - bitbake("core-image-sato") + recipe = self.config.get( + 'ImageOptionsTests', 'read_only_image_recipe') + config = self.config.get( + 'ImageOptionsTests', 'read_only_image_config') + self.write_config(config) + bitbake(recipe) # do_image will fail if there are any pending postinsts + class DiskMonTest(oeSelfTest): + @classmethod + def setUpClass(cls): + # Get test configurations from configuration file + cls.config = conffile(__file__) + @testcase(277) def test_stoptask_behavior(self): - self.write_config('BB_DISKMON_DIRS = "STOPTASKS,${TMPDIR},100000G,100K"') - res = bitbake("m4", ignore_status = True) + recipe = self.config.get('DiskMonTest', 'stoptask_behavior_recipe') + configstop = self.config.get( + 'DiskMonTest', 'stoptask_behavior_configstop') + configabort = self.config.get( + 'DiskMonTest', 'stoptask_behavior_configabort') + configwarn = self.config.get( + 'DiskMonTest', 'stoptask_behavior_configwarn') + self.write_config(configstop) + res = bitbake(recipe, ignore_status=True) self.assertTrue('ERROR: No new tasks can be executed since the disk space monitor action is "STOPTASKS"!' in res.output, msg = "Tasks should have stopped. Disk monitor is set to STOPTASK: %s" % res.output) self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output)) - self.write_config('BB_DISKMON_DIRS = "ABORT,${TMPDIR},100000G,100K"') - res = bitbake("m4", ignore_status = True) + self.write_config(configabort) + res = bitbake(recipe, ignore_status = True) self.assertTrue('ERROR: Immediately abort since the disk space monitor action is "ABORT"!' in res.output, "Tasks should have been aborted immediatelly. Disk monitor is set to ABORT: %s" % res.output) self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output)) - self.write_config('BB_DISKMON_DIRS = "WARN,${TMPDIR},100000G,100K"') - res = bitbake("m4") + self.write_config(configwarn) + res = bitbake(recipe) self.assertTrue('WARNING: The free space' in res.output, msg = "A warning should have been displayed for disk monitor is set to WARN: %s" %res.output) + class SanityOptionsTest(oeSelfTest): + + @classmethod + def setUpClass(cls): + # Get test configurations from configuration file + cls.config = conffile(__file__) + def getline(self, res, line): for l in res.output.split('\n'): if line in l:
@@ -87,49 +154,60 @@ class SanityOptionsTest(oeSelfTest): @testcase(927) def test_options_warnqa_errorqa_switch(self): - bitbake("xcursor-transparent-theme -ccleansstate") + recipe = self.config.get( + 'SanityOptionsTest', 'options_warnqa_errorqa_switch_recipe') + bitbake("%s -ccleansstate" % recipe) if "packages-list" not in get_bb_var("ERROR_QA"): self.write_config("ERROR_QA_append = \" packages-list\"") - self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"') - res = bitbake("xcursor-transparent-theme", ignore_status=True) - self.delete_recipeinc('xcursor-transparent-theme') - line = self.getline(res, "QA Issue: xcursor-transparent-theme-dbg is listed in PACKAGES multiple times, this leads to packaging errors.") + self.write_recipeinc(recipe, 'PACKAGES += \"${PN}-dbg\"') + res = bitbake(recipe, ignore_status=True) + self.delete_recipeinc(recipe) + line = self.getline(res, "QA Issue: %s-dbg is listed in PACKAGES \ +multiple times, this leads to packaging errors." % recipe) self.assertTrue(line and line.startswith("ERROR:"), msg=res.output) self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output)) - self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"') + self.write_recipeinc(recipe, 'PACKAGES += \"${PN}-dbg\"') self.append_config('ERROR_QA_remove = "packages-list"') self.append_config('WARN_QA_append = " packages-list"') - bitbake("xcursor-transparent-theme -ccleansstate") - res = bitbake("xcursor-transparent-theme") - self.delete_recipeinc('xcursor-transparent-theme') - line = self.getline(res, "QA Issue: xcursor-transparent-theme-dbg is listed in PACKAGES multiple times, this leads to packaging errors.") + bitbake("%s -ccleansstate" % recipe) + res = bitbake(recipe) + self.delete_recipeinc(recipe) + line = self.getline(res, "QA Issue: %s-dbg is listed in PACKAGES \ +multiple times, this leads to packaging errors." % recipe) self.assertTrue(line and line.startswith("WARNING:"), msg=res.output) @testcase(278) def test_sanity_unsafe_script_references(self): + recipe = self.config.get( + 'SanityOptionsTest', 'sanity_unsafe_script_references_recipe') self.write_config('WARN_QA_append = " unsafe-references-in-scripts"') - bitbake("-ccleansstate gzip") - res = bitbake("gzip") - line = self.getline(res, "QA Issue: gzip") - self.assertFalse(line, "WARNING: QA Issue: gzip message is present in bitbake's output and shouldn't be: %s" % res.output) + bitbake("-ccleansstate %s" % recipe) + res = bitbake(recipe) + line = self.getline(res, "QA Issue: %s" % recipe) + self.assertFalse(line, "WARNING: QA Issue: %s message is present in \ +bitbake's output and shouldn't be: %s" % (recipe, res.output)) self.append_config(""" -do_install_append_pn-gzip () { - echo "\n${bindir}/test" >> ${D}${bindir}/zcat +do_install_append_pn-%s () { + echo "\n${bindir}/test" >> ${D}${bindir}/zcat } -""") - res = bitbake("gzip") - line = self.getline(res, "QA Issue: gzip") - self.assertTrue(line and line.startswith("WARNING:"), "WARNING: QA Issue: gzip message is not present in bitbake's output: %s" % res.output) +""" % recipe) + res = bitbake(recipe) + line = self.getline(res, "QA Issue: %s" % recipe) + self.assertTrue(line and line.startswith("WARNING:"), "WARNING: QA \ +Issue: %s message is not present in bitbake's output: %s" + % (recipe, res.output)) @testcase(1434) def test_sanity_unsafe_binary_references(self): + recipe = self.config.get( + 'SanityOptionsTest', 'sanity_unsafe_binary_references_recipe') self.write_config('WARN_QA_append = " unsafe-references-in-binaries"') - bitbake("-ccleansstate nfs-utils") + bitbake("-ccleansstate %s" % recipe) #res = bitbake("nfs-utils") # FIXME when nfs-utils passes this test #line = self.getline(res, "QA Issue: nfs-utils")
@@ -140,9 +218,11 @@ do_install_append_pn-gzip () { # echo "\n${bindir}/test" >> ${D}${base_sbindir}/osd_login #} #""") - res = bitbake("nfs-utils") - line = self.getline(res, "QA Issue: nfs-utils") - self.assertTrue(line and line.startswith("WARNING:"), "WARNING: QA Issue: nfs-utils message is not present in bitbake's output: %s" % res.output) + res = bitbake(recipe) + line = self.getline(res, "QA Issue: %s" % recipe) + self.assertTrue(line and line.startswith("WARNING:"), "WARNING: QA \ +Issue: %s message is not present in bitbake's output: %s" + % (recipe, res.output)) @testcase(1421) def test_layer_without_git_dir(self):
@@ -154,9 +234,13 @@ do_install_append_pn-gzip () { AutomatedBy: Daniel Istrate <[email protected]> """ + dummy_layer_name = self.config.get( + 'SanityOptionsTest', 'layer_without_git_dir_layername') + test_recipe = self.config.get( + 'SanityOptionsTest', 'layer_without_git_dir_recipe') + dirpath = tempfile.mkdtemp() - dummy_layer_name = 'meta-dummy' dummy_layer_path = os.path.join(dirpath, dummy_layer_name) dummy_layer_conf_dir = os.path.join(dummy_layer_path, 'conf') os.makedirs(dummy_layer_conf_dir)
@@ -173,8 +257,6 @@ do_install_append_pn-gzip () { bblayers_conf = 'BBLAYERS += "%s"\n' % dummy_layer_path self.write_bblayers_config(bblayers_conf) - test_recipe = 'ed' - ret = bitbake('-n %s' % test_recipe) err = 'fatal: Not a git repository'
@@ -188,28 +270,51 @@ class BuildhistoryTests(BuildhistoryBase): @testcase(293) def test_buildhistory_basic(self): - self.run_buildhistory_operation('xcursor-transparent-theme') + self.configlocal = conffile(__file__) + recipe = self.configlocal.get( + 'BuildhistoryTests', 'buildhistory_basic_recipe') + self.run_buildhistory_operation(recipe) self.assertTrue(os.path.isdir(get_bb_var('BUILDHISTORY_DIR')), "buildhistory dir was not created.") @testcase(294) def test_buildhistory_buildtime_pr_backwards(self): + self.configlocal = conffile(__file__) + target = self.configlocal.get( + 'BuildhistoryTests', 'buildhistory_buildtime_pr_backwards_target') self.add_command_to_tearDown('cleanup-workdir') - target = 'xcursor-transparent-theme' error = "ERROR:.*QA Issue: Package version for package %s went backwards which would break package feeds from (.*-r1.* to .*-r0.*)" % target self.run_buildhistory_operation(target, target_config="PR = \"r1\"", change_bh_location=True) self.run_buildhistory_operation(target, target_config="PR = \"r0\"", change_bh_location=False, expect_error=True, error_regex=error) class ArchiverTest(oeSelfTest): + + @classmethod + def setUpClass(cls): + # Get test configurations from configuration file + cls.config = conffile(__file__) + @testcase(926) def test_arch_work_dir_and_export_source(self): """ Test for archiving the work directory and exporting the source files. """ + recipe = self.config.get( + 'ArchiverTest', 'arch_work_dir_and_export_source_recipe') + config = self.config.get( + 'ArchiverTest', 'arch_work_dir_and_export_source_config') + prefix = self.config.get( + 'ArchiverTest', 'arch_work_dir_and_export_source_prefix') + self.add_command_to_tearDown('cleanup-workdir') - self.write_config("INHERIT += \"archiver\"\nARCHIVER_MODE[src] = \"original\"\nARCHIVER_MODE[srpm] = \"1\"") - res = bitbake("xcursor-transparent-theme", ignore_status=True) - self.assertEqual(res.status, 0, "\nCouldn't build xcursortransparenttheme.\nbitbake output %s" % res.output) - pkgs_path = g.glob(str(self.builddir) + "/tmp/deploy/sources/allarch*/xcurs*") - src_file_glob = str(pkgs_path[0]) + "/xcursor*.src.rpm" - tar_file_glob = str(pkgs_path[0]) + "/xcursor*.tar.gz" - self.assertTrue((g.glob(src_file_glob) and g.glob(tar_file_glob)), "Couldn't find .src.rpm and .tar.gz files under tmp/deploy/sources/allarch*/xcursor*") + self.write_config(config) + res = bitbake(recipe, ignore_status=True) + self.assertEqual(res.status, 0, + "\nCouldn't build %s.\nbitbake output %s" + % (recipe, res.output)) + pkgs_path = g.glob(str(self.builddir) + + "/tmp/deploy/sources/allarch*/%s*" % prefix) + src_file_glob = str(pkgs_path[0]) + "/%s*.src.rpm" % prefix + tar_file_glob = str(pkgs_path[0]) + "/%s*.tar.gz" % prefix + self.assertTrue((g.glob(src_file_glob) and g.glob(tar_file_glob)), + "Couldn't find .src.rpm and .tar.gz files under \ +tmp/deploy/sources/allarch*/%s*" % prefix)
meta/lib/oeqa/selftest/conf/buildoptions.conf new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 7/20 oeqa.selftest.devtool: Split configuration from code
In reply to Jose LamegoImprove oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
[Yocto 9389]
--- meta/lib/oeqa/selftest/conf/devtool.conf | 100 ++++++++ meta/lib/oeqa/selftest/devtool.py | 417 +++++++++++++++++++++---------- 2 files changed, 389 insertions(+), 128 deletions(-) create mode 100644 meta/lib/oeqa/selftest/conf/devtool.conf
meta/lib/oeqa/selftest/conf/devtool.conf new file +100 -0
@@ -0,0 +1,100 @@ +[DevtoolTests] +test_create_workspace_prefix = devtoolqa +test_devtool_add_prefix = %(test_create_workspace_prefix)s +test_devtool_add_url = http://www.ivarch.com/programs/sources/pv-1.5.3.tar.bz2 +test_devtool_add_tar_file = pv-1.5.3.tar.bz2 +test_devtool_add_dir = pv-1.5.3 +test_devtool_add_package = pv +test_devtool_add_git_local_prefix = %(test_create_workspace_prefix)s +test_devtool_add_git_local_pn = dbus-wait +# We choose an https:// git URL here to check rewriting the URL works +test_devtool_add_git_local_url = https://git.yoctoproject.org/git/dbus-wait +test_devtool_add_git_local_checkvars_license = GPLv2 +test_devtool_add_git_local_checkvars_md5 = b234ee4d69f5fce4486a80fdaf4a4263 +test_devtool_add_git_local_checkvars_pv = 0.1 +test_devtool_add_git_local_checkvars_srcuri = git://git.yoctoproject.org/git/dbus-wait;protocol=https +test_devtool_add_git_local_checkvars_depends = dbus +test_devtool_add_git_local_srcrev = 6cc6077a36fe2648a5f993fe7c16c9632f946517 +test_devtool_add_library_recipe1 = libusb1 +test_devtool_add_library_prefix = %(test_create_workspace_prefix)s +test_devtool_add_library_version = 1.1 +# _recipe2 is linked to _url, _file, _binary and _extra_var +test_devtool_add_library_recipe2 = libftdi +test_devtool_add_library_url = https://www.intra2net.com/en/developer/libftdi/download/libftdi1-1.1.tar.bz2 +test_devtool_add_library_file = libftdi1 +test_devtool_add_library_binary = libftdi1.so.2.1.0 +# libftdi's python/CMakeLists.txt is a bit broken, so let's just disable it +# There's also the matter of it installing cmake files to a path we don't +# normally cover, which triggers the installed-vs-shipped QA test we have +# within do_package +test_devtool_add_library_extra_var = "EXTRA_OECMAKE -- \'-DPYTHON_BINDINGS=OFF -DLIBFTDI_CMAKE_CONFIG_DIR=${datadir}/cmake/Modules\'" +test_devtool_add_fetch_prefix = devtoolqa +# _testver is linked to _url and _testrecipe +test_devtool_add_fetch_testver = 0.23 +test_devtool_add_fetch_url = https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.23.tar.gz +test_devtool_add_fetch_testrecipe = python-markupsafe +test_devtool_add_fetch_fakever = 1.9 +test_devtool_add_fetch_git_prefix = %(test_devtool_add_fetch_prefix)s +test_devtool_add_fetch_git_url = git://git.yoctoproject.org/libmatchbox +test_devtool_add_fetch_git_checkrev = 462f0652055d89c648ddd54fd7b03f175c2c6973 +test_devtool_add_fetch_git_testrecipe = libmatchbox2 +test_devtool_add_fetch_git_pv = 1.12 +# To try with version specified +test_devtool_add_fetch_git_ver = 1.5 +test_devtool_add_fetch_simple_prefix = devtoolqa +# _testver is linked to _url and _testrecipe +test_devtool_add_fetch_simple_testver = 1.6.0 +test_devtool_add_fetch_simple_url = http://www.ivarch.com/programs/sources/pv-1.6.0.tar.bz2 +test_devtool_add_fetch_simple_testrecipe = pv +test_devtool_modify_prefix = devtoolqa +test_devtool_modify_recipe = mdadm +test_devtool_modify_invalid_prefix = %(test_devtool_modify_prefix)s +test_devtool_modify_invalid_testrecipes = perf kernel-devsrc package-index core-image-minimal meta-toolchain packagegroup-core-sdk meta-ide-support +test_devtool_modify_native_prefix = %(test_devtool_modify_prefix)s +test_devtool_modify_native_testrecipes = mtools-native apt-native desktop-file-utils-native +test_devtool_modify_git_prefix = %(test_devtool_modify_prefix)s +test_devtool_modify_git_testrecipe = mkelfimage +test_devtool_modify_localfiles_prefix = %(test_devtool_modify_prefix)s +test_devtool_modify_localfiles_testrecipe = lighttpd +test_devtool_modify_virtual_prefix = %(test_devtool_modify_prefix)s +test_devtool_modify_virtual_virtrecipe = virtual/libx11 +test_devtool_modify_virtual_realrecipe = libx11 +test_devtool_update_recipe_prefix = %(test_devtool_modify_prefix)s +test_devtool_update_recipe_testrecipe = minicom +test_devtool_update_recipe_git_prefix = %(test_devtool_modify_prefix)s +test_devtool_update_recipe_git_testrecipe = mtd-utils +test_devtool_update_recipe_git_srcuri = git://git.infradead.org/mtd-utils.git +test_devtool_update_recipe_append_prefix = %(test_devtool_modify_prefix)s +test_devtool_update_recipe_append_testrecipe = mdadm +test_devtool_update_recipe_append_git_prefix = %(test_devtool_modify_prefix)s +test_devtool_update_recipe_append_git_testrecipe = mtd-utils +test_devtool_update_recipe_local_files_prefix = %(test_devtool_modify_prefix)s +test_devtool_update_recipe_local_files_testrecipe = makedevs +test_devtool_update_recipe_local_files_2_prefix = %(test_devtool_modify_prefix)s +test_devtool_update_recipe_local_files_2_testrecipe = lzo +test_devtool_extract_prefix = devtoolqa +test_devtool_extract_virtual_prefix = %(test_devtool_extract_prefix)s +test_devtool_extract_virtual_virtrecipe = libx11 +test_devtool_reset_all_prefix = devtoolqa +test_devtool_reset_all_testrecipe1 = mdadm +test_devtool_reset_all_testrecipe2 = cronie +test_devtool_deploy_target_prefix = devtoolqa +test_devtool_deploy_target_testrecipe = mdadm +test_devtool_deploy_target_testcommand = --help +test_devtool_build_image_prefix = devtoolqa +test_devtool_build_image_image = core-image-minimal +# Add target and native recipes to workspace +test_devtool_build_image_recipes = mdadm parted-native +test_devtool_upgrade_prefix = devtoolqa +test_devtool_upgrade_recipe = devtool-upgrade-test1 +test_devtool_upgrade_version = 1.6.0 +test_devtool_upgrade_git_recipe = devtool-upgrade-test2 +test_devtool_upgrade_git_commit = 6cc6077a36fe2648a5f993fe7c16c9632f946517 +test_devtool_upgrade_git_prefix = devtoolqa +test_devtool_layer_plugins_s = Microsoft Made No Profit From Anyone's Zunes Yo +_setup_test_devtool_finish_upgrade_recipe = devtool-upgrade-test1 +_setup_test_devtool_finish_upgrade_oldversion = 1.5.3 +_setup_test_devtool_finish_upgrade_newversion = 1.6.0 +_setup_test_devtool_finish_upgrade_prefix = devtoolqa +_setup_test_devtool_finish_modify_recipe = mdadm +_setup_test_devtool_finish_modify_prefix = devtoolqa
meta/lib/oeqa/selftest/devtool.py +289 -128
812 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 8/20 oeqa.selftest.imagefeatures: Split configuration from code
In reply to Jose LamegoImprove oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
[Yocto 9389]
--- meta/lib/oeqa/selftest/conf/imagefeatures.conf | 19 +++++++++ meta/lib/oeqa/selftest/imagefeatures.py | 55 +++++++++++++++++--------- 2 files changed, 56 insertions(+), 18 deletions(-) create mode 100644 meta/lib/oeqa/selftest/conf/imagefeatures.conf
meta/lib/oeqa/selftest/conf/imagefeatures.conf new file +19 -0
@@ -0,0 +1,19 @@ +[imagefeatures] +test_user = tester +root_user = root +test_non_root_user_can_connect_via_ssh_without_password_features = + 'EXTRA_IMAGE_FEATURES = \ + "ssh-server-openssh empty-root-password allow-empty-password"\n\ + INHERIT += "extrausers"\n' +test_non_root_user_can_connect_via_ssh_without_password_image = core-image-minimal +test_all_users_can_connect_via_ssh_without_password_features = + 'EXTRA_IMAGE_FEATURES = \ + "ssh-server-openssh allow-empty-password"\n\ + INHERIT += "extrausers"\n' +test_all_users_can_connect_via_ssh_without_password_image = core-image-minimal +test_wayland_support_in_image_features = + 'DISTRO_FEATURES_append = " wayland"\n\ + CORE_IMAGE_EXTRA_INSTALL += "wayland weston"' +test_wayland_support_in_image_image = core-image-weston +test_bmap_features = IMAGE_FSTYPES += " ext4 ext4.bmap" +test_bmap_image = core-image-minimal
meta/lib/oeqa/selftest/imagefeatures.py +37 -18
107 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 9/20 oeqa.selftest.layerappend: Split configuration from code
In reply to Jose LamegoImprove oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
[Yocto 9389]
--- meta/lib/oeqa/selftest/conf/layerappend.conf | 40 +++++++++++++ meta/lib/oeqa/selftest/layerappend.py | 88 +++++++++++++--------------- 2 files changed, 80 insertions(+), 48 deletions(-) create mode 100644 meta/lib/oeqa/selftest/conf/layerappend.conf
meta/lib/oeqa/selftest/conf/layerappend.conf new file +40 -0
@@ -0,0 +1,40 @@ +[LayerAppendTests] +layerconf = """ + # We have a conf and classes directory, append to BBPATH + BBPATH .= ":${LAYERDIR}" + + # We have a recipes directory, add to BBFILES + BBFILES += "${LAYERDIR}/recipes*/*.bb ${LAYERDIR}/recipes*/*.bbappend" + + BBFILE_COLLECTIONS += "meta-layerINT" + BBFILE_PATTERN_meta-layerINT := "^${LAYERDIR}/" + BBFILE_PRIORITY_meta-layerINT = "6" + """ +recipe = """ + LICENSE="CLOSED" + INHIBIT_DEFAULT_DEPS = "1" + + python do_build() { + bb.plain('Building ...') + } + addtask build + """ +append = """ + FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + + SRC_URI_append = " file://appendtest.txt" + + sysroot_stage_all_append() { + install -m 644 ${WORKDIR}/appendtest.txt ${SYSROOT_DESTDIR}/ + } + + """ +append2 = """ + FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + + SRC_URI_append += "file://appendtest.txt" + """ +layerappend = '' + +layer_appends_layername = layertest +layer_appends_dirname = recipes-test
meta/lib/oeqa/selftest/layerappend.py +40 -48
130 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 10/20 oeqa.selftest.lic-checksum: Split configuration from code
In reply to Jose LamegoImprove oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
[Yocto 9389]
--- meta/lib/oeqa/selftest/conf/lic-checksum.conf | 4 ++++ meta/lib/oeqa/selftest/lic-checksum.py | 22 ++++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 meta/lib/oeqa/selftest/conf/lic-checksum.conf
meta/lib/oeqa/selftest/conf/lic-checksum.conf new file +4 -0
@@ -0,0 +1,4 @@ +[LicenseTests] +nonmatching_checksum_bitbake_cmd = -c populate_lic emptytest +nonmatching_checksum_error_msg = emptytest: The new md5 checksum is 8d777f385d3dfec8815d20f7496026dc +nonmatching_checksum_lic_path_md5 = d41d8cd98f00b204e9800998ecf8427e
meta/lib/oeqa/selftest/lic-checksum.py +16 -6
@@ -5,25 +5,35 @@ from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import bitbake from oeqa.utils import CommandError from oeqa.utils.decorators import testcase +from oeqa.utils.readconfig import conffile + class LicenseTests(oeSelfTest): + @classmethod + def setUpClass(cls): + # Get test configurations from configuration file + cls.config = conffile(__file__) + # Verify that changing a license file that has an absolute path causes # the license qa to fail due to a mismatched md5sum. @testcase(1197) def test_nonmatching_checksum(self): - bitbake_cmd = '-c populate_lic emptytest' - error_msg = 'emptytest: The new md5 checksum is 8d777f385d3dfec8815d20f7496026dc' - + bitbake_cmd = self.config.get( + 'LicenseTests', 'nonmatching_checksum_bitbake_cmd') + error_msg = self.config.get( + 'LicenseTests', 'nonmatching_checksum_error_msg') + lic_path_md5 = self.config.get( + 'LicenseTests', 'nonmatching_checksum_lic_path_md5') lic_file, lic_path = tempfile.mkstemp() os.close(lic_file) self.track_for_cleanup(lic_path) self.write_recipeinc('emptytest', """ INHIBIT_DEFAULT_DEPS = "1" -LIC_FILES_CHKSUM = "file://%s;md5=d41d8cd98f00b204e9800998ecf8427e" -SRC_URI = "file://%s;md5=d41d8cd98f00b204e9800998ecf8427e" -""" % (lic_path, lic_path)) +LIC_FILES_CHKSUM = "file://%s;md5=%s" +SRC_URI = "file://%s;md5=%s" +""" % (lic_path, lic_path_md5, lic_path, lic_path_md5)) result = bitbake(bitbake_cmd) with open(lic_path, "w") as f:
Signature · 1 line
1.8.3.1
PATCH 11/20 oeqa.selftest.manifest: Split configuration from code
In reply to Jose LamegoImprove oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
[Yocto 9389]
--- meta/lib/oeqa/selftest/conf/manifest.conf | 8 ++++++++ meta/lib/oeqa/selftest/manifest.py | 22 +++++++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 meta/lib/oeqa/selftest/conf/manifest.conf
meta/lib/oeqa/selftest/conf/manifest.conf new file +8 -0
@@ -0,0 +1,8 @@ +[VerifyManifest] +setUpClass_buildtarget = core-image-minimal +setUpClass_classname = VerifyManifest +# the setup should bitbake core-image-minimal and here it is required +# to do an additional setup for the sdk +SDK_manifest_entries_sdktask = -c populate_sdk +SDK_manifest_entries_host = nativesdk-packagegroup-sdk-host +image_manifest_entries_revdir_name = runtime-reverse
meta/lib/oeqa/selftest/manifest.py +15 -7
@@ -4,6 +4,8 @@ import os from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import get_bb_var, bitbake from oeqa.utils.decorators import testcase +from oeqa.utils.readconfig import conffile + class ManifestEntry: '''A manifest item of a collection able to list missing packages'''
@@ -48,9 +50,12 @@ class VerifyManifest(oeSelfTest): @classmethod def setUpClass(self): - self.buildtarget = 'core-image-minimal' - self.classname = 'VerifyManifest' - + # Get test configurations from configuration file + self.config = conffile(__file__) + self.buildtarget = self.config.get( + 'VerifyManifest', 'setUpClass_buildtarget') + self.classname = self.config.get( + 'VerifyManifest', 'setUpClass_classname') self.log.info("{}: doing bitbake {} as a prerequisite of the test"\ .format(self.classname, self.buildtarget)) if bitbake(self.buildtarget).status:
@@ -65,7 +70,9 @@ class VerifyManifest(oeSelfTest): # the setup should bitbake core-image-minimal and here it is required # to do an additional setup for the sdk - sdktask = '-c populate_sdk' + sdktask = self.config.get( + 'VerifyManifest', 'SDK_manifest_entries_sdktask') + host = self.config.get('VerifyManifest', 'SDK_manifest_entries_host') bbargs = sdktask + ' ' + self.buildtarget self.log.debug("{}: doing bitbake {} as a prerequisite of the test"\ .format(self.classname, bbargs))
@@ -79,8 +86,7 @@ class VerifyManifest(oeSelfTest): pkgdata_dir = reverse_dir = {} mfilename = mpath = m_entry = {} # get manifest location based on target to query about - d_target= dict(target = self.buildtarget, - host = 'nativesdk-packagegroup-sdk-host') + d_target = dict(target=self.buildtarget, host=host) try: mdir = self.get_dir_from_bb_var('SDK_DEPLOY', self.buildtarget) for k in d_target.keys():
@@ -130,6 +136,8 @@ class VerifyManifest(oeSelfTest): '''Verifying the image manifest entries exist''' # get manifest location based on target to query about + revdir_name = self.config.get( + 'VerifyManifest', 'image_manifest_entries_revdir_name') try: mdir = self.get_dir_from_bb_var('DEPLOY_DIR_IMAGE', self.buildtarget)
@@ -142,7 +150,7 @@ class VerifyManifest(oeSelfTest): pkgdata_dir = {} pkgdata_dir = self.get_dir_from_bb_var('PKGDATA_DIR', self.buildtarget) - revdir = os.path.join(pkgdata_dir, 'runtime-reverse') + revdir = os.path.join(pkgdata_dir, revdir_name) if not os.path.exists(revdir): raise IOError except OSError: raise unittest.SkipTest("{}: Error in obtaining manifest dirs"\
Signature · 1 line
1.8.3.1
PATCH 12/20 oeqa.selftest.oescripts: Split configuration from code
In reply to Jose LamegoImprove oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
[Yocto 9389]
--- meta/lib/oeqa/selftest/conf/oescripts.conf | 6 ++++++ meta/lib/oeqa/selftest/oescripts.py | 31 ++++++++++++++++++++++-------- 2 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 meta/lib/oeqa/selftest/conf/oescripts.conf
meta/lib/oeqa/selftest/conf/oescripts.conf new file +6 -0
@@ -0,0 +1,6 @@ +[TestScripts] +cleanup_workdir_package = gzip +cleanup_workdir_old_version = 1.3.12 + +[BuildhistoryDiffTests] +buildhistory_diff_target = xcursor-transparent-theme
meta/lib/oeqa/selftest/oescripts.py +23 -8
@@ -9,27 +9,39 @@ from oeqa.selftest.base import oeSelfTest from oeqa.selftest.buildhistory import BuildhistoryBase from oeqa.utils.commands import Command, runCmd, bitbake, get_bb_var, get_test_layer from oeqa.utils.decorators import testcase +from oeqa.utils.readconfig import conffile + class TestScripts(oeSelfTest): + @classmethod + def setUpClass(cls): + # Get test configurations from configuration file + cls.config = conffile(__file__) + @testcase(300) def test_cleanup_workdir(self): - path = os.path.dirname(get_bb_var('WORKDIR', 'gzip')) - old_version_recipe = os.path.join(get_bb_var('COREBASE'), 'meta/recipes-extended/gzip/gzip_1.3.12.bb') - old_version = '1.3.12' - bitbake("-ccleansstate gzip") + package = self.config.get('TestScripts', 'cleanup_workdir_package') + old_version = self.config.get( + 'TestScripts', 'cleanup_workdir_old_version') + path = os.path.dirname(get_bb_var('WORKDIR', package)) + old_version_recipe = os.path.join( + get_bb_var('COREBASE'), + 'meta/recipes-extended/%s/%s_%s.bb' + % (package, package, old_version)) + bitbake("-ccleansstate %s" % package) bitbake("-ccleansstate -b %s" % old_version_recipe) if os.path.exists(get_bb_var('WORKDIR', "-b %s" % old_version_recipe)): shutil.rmtree(get_bb_var('WORKDIR', "-b %s" % old_version_recipe)) - if os.path.exists(get_bb_var('WORKDIR', 'gzip')): - shutil.rmtree(get_bb_var('WORKDIR', 'gzip')) + if os.path.exists(get_bb_var('WORKDIR', package)): + shutil.rmtree(get_bb_var('WORKDIR', package)) if os.path.exists(path): initial_contents = os.listdir(path) else: initial_contents = [] - bitbake('gzip') + bitbake(package) intermediary_contents = os.listdir(path) bitbake("-b %s" % old_version_recipe) runCmd('cleanup-workdir')
@@ -45,8 +57,11 @@ class BuildhistoryDiffTests(BuildhistoryBase): @testcase(295) def test_buildhistory_diff(self): + # Get test configurations from configuration file + configlocal = conffile(__file__) + target = configlocal.get( + 'BuildhistoryDiffTests', 'buildhistory_diff_target') self.add_command_to_tearDown('cleanup-workdir') - target = 'xcursor-transparent-theme' self.run_buildhistory_operation(target, target_config="PR = \"r1\"", change_bh_location=True) self.run_buildhistory_operation(target, target_config="PR = \"r0\"", change_bh_location=False, expect_error=True) result = runCmd("buildhistory-diff -p %s" % get_bb_var('BUILDHISTORY_DIR'))
Signature · 1 line
1.8.3.1
PATCH 13/20 oeqa.selftest.pkgdata: Split configuration from code
In reply to Jose LamegoImprove oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
[Yocto 9389]
--- meta/lib/oeqa/selftest/conf/pkgdata.conf | 39 ++++ meta/lib/oeqa/selftest/pkgdata.py | 373 ++++++++++++++++++++++--------- 2 files changed, 305 insertions(+), 107 deletions(-) create mode 100644 meta/lib/oeqa/selftest/conf/pkgdata.conf
meta/lib/oeqa/selftest/conf/pkgdata.conf new file +39 -0
@@ -0,0 +1,39 @@ +[OePkgdataUtilTests] +setUpClass_package_1 = glibc +setUpClass_package_2 = busybox +setUpClass_package_3 = zlib +setUpClass_package_4 = bash +lookup_pkg_package_1 = glibc +lookup_pkg_package_2 = busybox +lookup_pkg_package_3 = libc6 +lookup_pkg_package_4 = zlib-dev +lookup_pkg_package_5 = libz-dev +lookup_pkg_package_6 = nonexistentpkg +read_value_package_1 = libz1 +read_value_package_2 = zlib +read_value_package_3 = bash +find_path_package_1 = libc.so.6 +find_path_package_2 = glibc +find_path_package_3 = bash +lookup_recipe_package_1 = libc6-staticdev +lookup_recipe_package_2 = busybox +lookup_recipe_package_3 = glibc +lookup_recipe_package_4 = libz-dbg +lookup_recipe_package_5 = zlib +lookup_recipe_package_6 = nonexistentpkg +list_pkgs_package_1 = list-pkgs +list_pkgs_package_2 = glibc-utils +list_pkgs_package_3 = zlib-dev +list_pkgs_package_4 = libc6-utils +list_pkgs_package_5 = libz-dev +list_pkgs_package_6 = zlib +list_pkgs_package_7 = libz +list_pkg_files_package_1 = zlib +list_pkg_files_package_2 = libz +glob_package_1 = libc6 +glob_package_2 = libz +glob_package_3 = busybox +glob_package_4 = glibc +glob_prefix = pkgdataqa +specify_pkgdatadir_package_1 = glibc +specify_pkgdatadir_package_2 = libc6
meta/lib/oeqa/selftest/pkgdata.py +266 -107
476 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 14/20 oeqa.selftest.prservice: Split configuration from code
In reply to Jose LamegoImprove oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
[Yocto 9389]
--- meta/lib/oeqa/selftest/conf/prservice.conf | 21 +++++++++ meta/lib/oeqa/selftest/prservice.py | 71 ++++++++++++++++++++++++++---- 2 files changed, 83 insertions(+), 9 deletions(-) create mode 100644 meta/lib/oeqa/selftest/conf/prservice.conf
meta/lib/oeqa/selftest/conf/prservice.conf new file +21 -0
@@ -0,0 +1,21 @@ +[BitbakePrTests] +import_export_replace_db_package = m4 +import_export_override_db_package = m4 +pr_service_rpm_arch_dep_package = m4 +pr_service_rpm_arch_dep_package_type = rpm +pr_service_rpm_arch_dep_track_task = do_package +pr_service_deb_arch_dep_package = m4 +pr_service_deb_arch_dep_package_type = deb +pr_service_deb_arch_dep_track_task = do_package +pr_service_ipk_arch_dep_package = m4 +pr_service_ipk_arch_dep_package_type = ipk +pr_service_ipk_arch_dep_track_task = do_package +pr_service_rpm_arch_indep_package = xcursor-transparent-theme +pr_service_rpm_arch_indep_package_type = rpm +pr_service_rpm_arch_indep_track_task = do_package +pr_service_deb_arch_indep_package = xcursor-transparent-theme +pr_service_deb_arch_indep_package_type = deb +pr_service_deb_arch_indep_track_task = do_package +pr_service_ipk_arch_indep_package = xcursor-transparent-theme +pr_service_ipk_arch_indep_package_type = ipk +pr_service_ipk_arch_indep_track_task = do_package
meta/lib/oeqa/selftest/prservice.py +62 -9
106 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 15/20 oeqa.selftest.recipetool: Split configuration from code
In reply to Jose LamegoImprove oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
[Yocto 9389]
--- meta/lib/oeqa/selftest/conf/recipetool.conf | 84 +++++++ meta/lib/oeqa/selftest/recipetool.py | 326 +++++++++++++++++++++------- 2 files changed, 332 insertions(+), 78 deletions(-) create mode 100644 meta/lib/oeqa/selftest/conf/recipetool.conf
meta/lib/oeqa/selftest/conf/recipetool.conf new file +84 -0
@@ -0,0 +1,84 @@ +[RecipetoolTests] +setupclass_logger_name = selftest +setupclass_logger_info = Running bitbake to generate pkgdata +setupclass_recipe_1 = base-files +setupclass_recipe_2 = coreutils +setupclass_recipe_3 = busybox +recipetool_appendfile_basic_recipe = base-files +recipetool_appendfile_basic_lines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', + '\n'] +recipetool_appendfile_appendfile = motd +recipetool_appendfile_alternatives_append_file = /bin/ls +recipetool_appendfile_alternatives_error_msg = {'ERROR: File /bin/ls is an alternative possibly provided by the following recipes:', 'coreutils', 'busybox'} +recipetool_appendfile_alternatives_testfile_2 = oe-init-build-env +recipetool_appendfile_alternatives_testrecipe = coreutils +# /bin/ls can be a symlink to /usr/bin/ls +recipetool_appendfile_binary_append_file = /bin/ls +recipetool_appendfile_binary_testrecipe = coreutils +recipetool_appendfile_add_append_file = netbase +recipetool_appendfile_add_testfile_2 = oe-init-build-env +recipetool_appendfile_add_bindir_append_file = netbase +recipetool_appendfile_add_machine_append_file = netbase +# append_testfile is used in tests 1184, 1191, 1187, 1190, 1189, 1181, 1182, +# 1185, 1188, 1180, 1186 +recipetool_appendfile_append_testfile = selftest-recipetool-appendfile +recipetool_appendfile_wildcard_recipe = base-files +recipetool_create_recipe = srctree +recipetool_create_recipe_file = logrotate_3.8.7.bb +recipetool_create_srcuri = https://fedorahosted.org/releases/l/o/logrotate/logrotate-3.8.7.tar.gz +recipetool_create_license = GPLv2 +recipetool_create_licfileschksum = 18810669f13b87348459e611d31ab760 +recipetool_create_src_uri = https://fedorahosted.org/releases/l/o/logrotate/logrotate-${PV}.tar.gz +recipetool_create_srcuri_md5sum = 99e08503ef24c3e2e3ff74cc5f3be213 +recipetool_create_srcuri_sha256sum = f6ba691f40e30e640efa2752c1f9499a3f9738257660994de70a45fe00d12b64 +recipetool_create_git_recipes = 'libpng pango libx11 libxext jpeg libcheck' +recipetool_create_git_recipe_1 = srctree +recipetool_create_git_srcuri = git://git.yoctoproject.org/libmatchbox +recipetool_create_git_rev = 9f7cf8895ae2d39c465c04cc78e918c157420269 + +recipetool_create_git_recipe_file = libmatchbox.bb +recipetool_create_git_license = LGPLv2.1 +recipetool_create_git_licfileschksum = 7fbc338309ac38fefcd64b04bb903e34 +recipetool_create_git_pv = 1.11 +recipetool_create_git_set_depends = {'libcheck', 'libjpeg-turbo', 'libpng', 'libx11', 'libxext', 'pango'} +recipetool_create_git_inherit_1 = autotools +recipetool_create_git_inherit_2 = pkgconfig +recipetool_create_simple_recipe = recipe +recipetool_create_simple_pv = 1.7.3.0 +recipetool_create_simple_srcuri = http://www.dest-unreach.org/socat/download/socat-%(recipetool_create_simple_pv)s.tar.bz2 +recipetool_create_simple_set_license = {'Unknown', 'GPLv2'} +recipetool_create_simple_set_fileschksum = {'file://COPYING.OpenSSL;md5=5c9bccc77f67a8328ef4ebaf468116f4', 'file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263'} +recipetool_create_simple_s = None +recipetool_create_simple_inherits = autotools +recipetool_create_cmake_recipe = recipe +recipetool_create_cmake_recipe_file = navit_0.5.0.bb +recipetool_create_cmake_srcuri = http://downloads.sourceforge.net/project/navit/v0.5.0/navit-0.5.0.tar.gz +recipetool_create_cmake_set_license = {'Unknown', 'GPLv2', 'LGPLv2'} +recipetool_create_cmake_src_uri = http://downloads.sourceforge.net/project/navit/v${PV}/navit-${PV}.tar.gz +recipetool_create_cmake_md5sum = 242f398e979a6b8c0f3c802b63435b68 +recipetool_create_cmake_sha256sum = 13353481d7fc01a4f64e385dda460b51496366bba0fd2cc85a89a0747910e94d +recipetool_create_cmake_set_depends = {'freetype', 'zlib', 'openssl', 'glib-2.0', 'virtual/libgl', 'virtual/egl', 'gtk+', 'libpng', 'libsdl', 'freeglut', 'dbus-glib'} +recipetool_create_cmake_inherits_recipes = {'cmake', 'python-dir', 'gettext', 'pkgconfig'} +recipetool_create_github_recipe_file = meson_git.bb +recipetool_create_github_srcuri = https://github.com/mesonbuild/meson +recipetool_create_github_license = Apache-2.0 +recipetool_create_github_git_srcuri = git://github.com/mesonbuild/meson;protocol=https +recipetool_create_github_inherits = {'setuptools'} +recipetool_create_github_tarball_pv = 0.32.0 +recipetool_create_github_tarball_recipe_file = meson +recipetool_create_github_tarball_srcuri = https://github.com/mesonbuild/meson/releases/download/ +recipetool_create_github_tarball_license = Apache-2.0 +recipetool_create_github_tarball_inherits = setuptools +recipetool_create_git_http_recipe_file = matchbox-terminal_git.bb +recipetool_create_git_http_srcuri = http://git.yoctoproject.org/git/matchbox-terminal +recipetool_create_git_http_git_srcuri = git://git.yoctoproject.org/git/matchbox-terminal;protocol=http +recipetool_create_git_http_license = GPLv2 +recipetool_create_git_http_inherits = {'pkgconfig', 'autotools'} + + +[RecipetoolAppendsrcTests] +recipetool_appendsrcfile_base_files = base-files +recipetool_appendsrcfile_file_1 = a-file +recipetool_appendsrcfile_recipe = bash +recipetool_appendsrcfile_filepath = Makefile.in +
meta/lib/oeqa/selftest/recipetool.py +248 -78
532 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 16/20 oeqa.selftest.runtime-test: Split configuration from code
In reply to Jose LamegoImprove oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
[Yocto 9389]
--- meta/lib/oeqa/selftest/conf/runtime-test.conf | 13 +++++ meta/lib/oeqa/selftest/runtime-test.py | 80 ++++++++------------------- 2 files changed, 37 insertions(+), 56 deletions(-) create mode 100644 meta/lib/oeqa/selftest/conf/runtime-test.conf
meta/lib/oeqa/selftest/conf/runtime-test.conf new file +13 -0
@@ -0,0 +1,13 @@ +[TestExport] +# These aren't the actual IP addresses but testexport class needs something +# defined +setUpClass_features = INHERIT += "testexport" + TEST_SERVER_IP = "192.168.7.1" + TEST_TARGET_IP = "192.168.7.1" + TEST_SUITES = "ping" +setUpClass_image = core-image-minimal +[TestImage] +setUpClass_features = INHERIT += "testimage" + TEST_SUITES = "ping ssh selftest" + TEST_SUITES_TAGS = "selftest_package_install" +setUpClass_image = core-image-full-cmdline
meta/lib/oeqa/selftest/runtime-test.py +24 -56
116 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 17/20 oeqa.selftest.signing: Split configuration from code
In reply to Jose LamegoImprove oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
[Yocto 9389]
--- meta/lib/oeqa/selftest/conf/signing.conf | 15 ++++ meta/lib/oeqa/selftest/signing.py | 119 +++++++++++++++++++------------ 2 files changed, 90 insertions(+), 44 deletions(-) create mode 100644 meta/lib/oeqa/selftest/conf/signing.conf
meta/lib/oeqa/selftest/conf/signing.conf new file +15 -0
@@ -0,0 +1,15 @@ +[Signing] +setUpClass_prefix = oeqa-signing- +# key.secret and key.pub are located in gpg_dir +setUpClass_pub_keyname = key.pub +setUpClass_secret_keyname = key.secret +setUpClass_test_recipe = ed +setUpClass_passphrase = test123 +signing_packages_inherit = sign_rpm +signing_packages_name = testuser +[LockedSignatures] +locked_signatures_locked_sigs_file = locked-sigs.inc +locked_signatures_feature = require %(locked_signatures_locked_sigs_file)s + SIGGEN_LOCKEDSIGS_TASKSIG_CHECK = "warn" +locked_signatures_recipe_dir = recipes-test +locked_signatures_summary = test locked signature
meta/lib/oeqa/selftest/signing.py +75 -44
205 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 18/20 oeqa.selftest.sstatetests: Split configuration from code
In reply to Jose LamegoImprove oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
[Yocto 9389]
--- meta/lib/oeqa/selftest/conf/sstatetests.conf | 25 +++++ meta/lib/oeqa/selftest/sstatetests.py | 162 ++++++++++++++++++--------- 2 files changed, 133 insertions(+), 54 deletions(-) create mode 100644 meta/lib/oeqa/selftest/conf/sstatetests.conf
meta/lib/oeqa/selftest/conf/sstatetests.conf new file +25 -0
@@ -0,0 +1,25 @@ +[SStateTests] +setUpClass_prefix = binutils-cross- +setUpClass_recipe1 = binutils-native +setUpClass_recipe2 = glibc-initial +setupClass_recipe3 = m4 +setupClass_recipe4 = meta-toolchain +setupClass_recipe5 = meta-environment +setupClass_recipe6 = cross-canadian +setUpClass_pattern = populate_lic +setUpClass_machine1 = qemux86-64 +setupClass_machine2 = qemux86 +setupClass_machine3 = qemuarm +setUpClass_machine4 = qemux86copy +setUpClass_image = core-image-sato +sstate_32_64_same_hash_features_1 = MACHINE = "qemux86" + BUILD_ARCH = "x86_64" + BUILD_OS = "linux" + SDKMACHINE = "x86_64" +sstate_32_64_same_hash_features_2 = MACHINE = "qemux86" + BUILD_ARCH = "i686" + BUILD_OS = "linux" + SDKMACHINE = "i686" +sstate_32_64_same_hash_arch2 = i686 +sstate_32_64_same_hash_arch1 = x86_64 +
meta/lib/oeqa/selftest/sstatetests.py +108 -54
320 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 19/20 oeqa.selftest.wic: Split configuration from code
In reply to Jose LamegoImprove oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
[Yocto 9389]
--- meta/lib/oeqa/selftest/conf/wic.conf | 10 +++ meta/lib/oeqa/selftest/wic.py | 150 ++++++++++++++++++++--------------- 2 files changed, 98 insertions(+), 62 deletions(-) create mode 100644 meta/lib/oeqa/selftest/conf/wic.conf
meta/lib/oeqa/selftest/conf/wic.conf new file +10 -0
@@ -0,0 +1,10 @@ +[Wic] +setUpClass_image1 = core-image-minimal +setUpClass_image2 = minimal +setUpClass_image3 = qemux86-directdisk +setUpClass_image4 = directdisk +setUpClass_image5 = wic-image-minimal +setUpClass_features = IMAGE_FSTYPES += " hddimg" + MACHINE_FEATURES_append = " efi" +setUpClass_recipes = syslinux syslinux-native parted-native gptfdisk-native dosfstools-native mtools-native bmap-tools-native +
meta/lib/oeqa/selftest/wic.py +88 -62
269 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 20/20 oeqa.utils.readconfig: Read self-test configuration file
In reply to Jose LamegoImprove oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
This library reads a configuration file located at the oeqa/selftest/conf directory with same name as the caller file and the conf extension.
[Yocto 9389]
--- meta/lib/oeqa/utils/readconfig.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 meta/lib/oeqa/utils/readconfig.py
meta/lib/oeqa/utils/readconfig.py new file +18 -0
@@ -0,0 +1,18 @@ +import os +import re +import configparser + + +def conffile(codefile): + # Get test configurations from configuration file + f = re.compile(r'(pyc?$)') + fn = os.path.basename(codefile) + configfile = os.path.join(os.path.dirname(codefile), 'conf', + f.sub('conf', fn)) + config = configparser.SafeConfigParser() + read_result = config.read(configfile) + if read_result == []: + raise configparser.Error("Failed to get test configuration from \ +\"%s\". Verify that file exists and format is correct." + % configfile) + return config
Signature · 1 line
1.8.3.1
Re: [PATCH 19/20] oeqa.selftest.wic: Split configuration from code
In reply to Jose LamegoHi Jose,
Quoted 4 lines · Jose Lamego
Improve oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
Frankly I have mixed feelings about these changes. From the first look splitting configuration and code is a good idea. However, looking at the result I must say I feel like the test became less readable and harder to understand and maintain.
May be the changes make sense for other tests, but for this one they make my life as a maintainer of this one less easy I'd say.
Quoted 15 lines
[Yocto 9389]
Signed-off-by Jose Lamego <[email protected]>--- meta/lib/oeqa/selftest/conf/wic.conf | 10 +++ meta/lib/oeqa/selftest/wic.py | 150 ++++++++++++++++++++--------------- 2 files changed, 98 insertions(+), 62 deletions(-) create mode 100644 meta/lib/oeqa/selftest/conf/wic.confmeta/lib/oeqa/selftest/conf/wic.conf new file +0
-0
meta/lib/oeqa/selftest/conf/wic.conf line 3
Quoted 3 lines
meta/lib/oeqa/selftest/conf/wic.conf new file +3
-0@@ -0,0 +1,10 @@ +[Wic] +setUpClass_image1 = core-image-minimal +setUpClass_image2 = minimal
setUpClass_image2 is not used in the code.
meta/lib/oeqa/selftest/conf/wic.conf line 6
Quoted 3 lines
meta/lib/oeqa/selftest/conf/wic.conf new file +3
-0+setUpClass_image3 = qemux86-directdisk +setUpClass_image4 = directdisk +setUpClass_image5 = wic-image-minimal
setUpClass_image1 is an image produced by bitbake, but setUpClass_image3 is a name of wic image. They're not the same. Bitbake image is an input for wic and wic image is an output. setUpClass_image5 is again the name of the bitbake target, but it differs from _image3. Naming doesn't reflect this fact.
meta/lib/oeqa/selftest/conf/wic.conf line 9
Quoted 3 lines
meta/lib/oeqa/selftest/conf/wic.conf new file +3
-0+setUpClass_features = IMAGE_FSTYPES += " hddimg" + MACHINE_FEATURES_append = " efi" +setUpClass_recipes = syslinux syslinux-native parted-native gptfdisk-native dosfstools-native mtools-native bmap-tools-native
This list is used only once in the test. Moving it to config file makes it longer to understand what's in the list.
Quoted 17 lines
meta/lib/oeqa/selftest/wic.py +2
-0@@ -31,6 +31,7 @@ from shutil import rmtree from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu from oeqa.utils.decorators import testcase +from oeqa.utils.readconfig import conffile class Wic(oeSelfTest):@@ -39,6 +40,18 @@ class Wic(oeSelfTest): resultdir = "/var/tmp/wic/build/" image_is_ready = False + @classmethod
meta/lib/oeqa/selftest/wic.py class Wic(oeSelfTest): · line 53
Quoted 10 lines
meta/lib/oeqa/selftest/wic.py +10
-0+ def setUpClass(cls): + # Get test configurations from configuration file + cls.config = conffile(__file__) + cls.image1 = cls.config.get('Wic', 'setUpClass_image1') + cls.image2 = cls.config.get('Wic', 'setUpClass_image2') + cls.image3 = cls.config.get('Wic', 'setUpClass_image3') + cls.image4 = cls.config.get('Wic', 'setUpClass_image4') + cls.image5 = cls.config.get('Wic', 'setUpClass_image5') + cls.features = cls.config.get('Wic', 'setUpClass_features') + cls.recipes = cls.config.get('Wic', 'setUpClass_recipes')
This looks like a duplication of code and configuration and also hides real image names and features making test much less readable.
meta/lib/oeqa/selftest/wic.py class Wic(oeSelfTest): · line 65
Quoted 13 lines
meta/lib/oeqa/selftest/wic.py +3
-3+ def setUpLocal(self): """This code is executed before each test method.""" self.write_config('IMAGE_FSTYPES += " hddimg"\n'@@ -48,9 +61,8 @@ class Wic(oeSelfTest): # clean up which can result in the native tools built earlier in # setUpClass being unavailable. if not Wic.image_is_ready: - bitbake('syslinux syslinux-native parted-native gptfdisk-native ' - 'dosfstools-native mtools-native bmap-tools-native') - bitbake('core-image-minimal') + bitbake(self.recipes) + bitbake(self.image1)
I'd really prefer to see list of dependencies and the image name right in the test code without having to look into configuration file.
The same is true for pretty much all the changes.
Quoted 250 lines
meta/lib/oeqa/selftest/wic.py +73
-59Wic.image_is_ready = True rmtree(self.resultdir, ignore_errors=True)@@ -73,30 +85,35 @@ class Wic(oeSelfTest): @testcase(1211) def test_build_image_name(self): """Test wic create directdisk --image-name core-image-minimal""" - self.assertEqual(0, runCmd("wic create directdisk " - "--image-name core-image-minimal").status) - self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) + self.assertEqual( + 0, runCmd("wic create %s --image-name %s" + % (self.image4, self.image1)).status) + self.assertEqual( + 1, len(glob(self.resultdir + "%s-*.direct" % self.image4))) @testcase(1212) def test_build_artifacts(self): """Test wic create directdisk providing all artifacts.""" - bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) \ - for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', - 'STAGING_DIR_NATIVE', 'IMAGE_ROOTFS')) + bbvars = dict((var.lower(), get_bb_var(var, self.image1)) + for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', + 'STAGING_DIR_NATIVE', 'IMAGE_ROOTFS')) status = runCmd("wic create directdisk " "-b %(staging_datadir)s " "-k %(deploy_dir_image)s " "-n %(staging_dir_native)s " "-r %(image_rootfs)s" % bbvars).status self.assertEqual(0, status) - self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) + self.assertEqual(1, len(glob(self.resultdir + "%s-*.direct" + % self.image4))) @testcase(1157) def test_gpt_image(self): - """Test creation of core-image-minimal with gpt table and UUID boot""" - self.assertEqual(0, runCmd("wic create directdisk-gpt " - "--image-name core-image-minimal").status) - self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) + """Test creation of %s with gpt table and UUID boot""" % self.image1 + self.assertEqual(0, runCmd("wic create %s-gpt " + "--image-name %s" + % (self.image4, self.image1)).status) + self.assertEqual(1, len(glob(self.resultdir + "%s-*.direct" + % self.image4))) @testcase(1213) def test_unsupported_subcommand(self):@@ -127,55 +144,63 @@ class Wic(oeSelfTest): @testcase(1264) def test_compress_gzip(self): """Test compressing an image with gzip""" - self.assertEqual(0, runCmd("wic create directdisk " - "--image-name core-image-minimal " - "-c gzip").status) - self.assertEqual(1, len(glob(self.resultdir + \ - "directdisk-*.direct.gz"))) + self.assertEqual(0, runCmd("wic create %s " + "--image-name %s " + "-c gzip" + % (self.image4, self.image1)).status) + self.assertEqual(1, len(glob( + self.resultdir + "%s-*.direct.gz" + % self.image4))) @testcase(1265) def test_compress_bzip2(self): """Test compressing an image with bzip2""" - self.assertEqual(0, runCmd("wic create directdisk " - "--image-name core-image-minimal " - "-c bzip2").status) - self.assertEqual(1, len(glob(self.resultdir + \ - "directdisk-*.direct.bz2"))) + self.assertEqual(0, runCmd("wic create %s " + "--image-name %s " + "-c bzip2" + % (self.image4, self.image1)).status) + self.assertEqual(1, len(glob( + self.resultdir + "%s-*.direct.bz2" + % self.image4))) @testcase(1266) def test_compress_xz(self): """Test compressing an image with xz""" - self.assertEqual(0, runCmd("wic create directdisk " - "--image-name core-image-minimal " - "-c xz").status) - self.assertEqual(1, len(glob(self.resultdir + \ - "directdisk-*.direct.xz"))) + self.assertEqual(0, runCmd("wic create %s " + "--image-name %s " + "-c xz" + % (self.image4, self.image1)).status) + self.assertEqual(1, len(glob( + self.resultdir + "%s-*.direct.xz" + % self.image4))) @testcase(1267) def test_wrong_compressor(self): """Test how wic breaks if wrong compressor is provided""" - self.assertEqual(2, runCmd("wic create directdisk " - "--image-name core-image-minimal " - "-c wrong", ignore_status=True).status) + self.assertEqual(2, runCmd("wic create %s " + "--image-name %s " + "-c wrong" % (self.image4, self.image1), + ignore_status=True).status) @testcase(1268) def test_rootfs_indirect_recipes(self): """Test usage of rootfs plugin with rootfs recipes""" wks = "directdisk-multi-rootfs" self.assertEqual(0, runCmd("wic create %s " - "--image-name core-image-minimal " - "--rootfs rootfs1=core-image-minimal " - "--rootfs rootfs2=core-image-minimal" \ - % wks).status) + "--image-name %s " + "--rootfs rootfs1=%s " + "--rootfs rootfs2=%s" + % (wks, self.image1, self.image1, + self.image1)).status) self.assertEqual(1, len(glob(self.resultdir + "%s*.direct" % wks))) @testcase(1269) def test_rootfs_artifacts(self): """Test usage of rootfs plugin with rootfs paths""" - bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) \ - for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', - 'STAGING_DIR_NATIVE', 'IMAGE_ROOTFS')) - bbvars['wks'] = "directdisk-multi-rootfs" + bbvars = dict((var.lower(), get_bb_var(var, self.image1)) + for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', + 'STAGING_DIR_NATIVE', 'IMAGE_ROOTFS')) + bbvars['wks'] = "%s-multi-rootfs" % self.image4 status = runCmd("wic create %(wks)s " "-b %(staging_datadir)s " "-k %(deploy_dir_image)s "@@ -191,14 +216,14 @@ class Wic(oeSelfTest): def test_iso_image(self): """Test creation of hybrid iso image with legacy and EFI boot""" self.assertEqual(0, runCmd("wic create mkhybridiso " - "--image-name core-image-minimal").status) + "--image-name %s" % self.image1).status) self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.direct"))) self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.iso"))) @testcase(1347) def test_image_env(self): """Test generation of <image>.env files.""" - image = 'core-image-minimal' + image = self.image1 self.assertEqual(0, bitbake('%s -c do_rootfs_wicenv' % image).status) stdir = get_bb_var('STAGING_DIR_TARGET', image) imgdatadir = os.path.join(stdir, 'imgdata')@@ -222,11 +247,11 @@ class Wic(oeSelfTest): @testcase(1351) def test_wic_image_type(self): """Test building wic images by bitbake""" - self.assertEqual(0, bitbake('wic-image-minimal').status) + self.assertEqual(0, bitbake(self.image5).status) deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE') machine = get_bb_var('MACHINE') - prefix = os.path.join(deploy_dir, 'wic-image-minimal-%s.' % machine) + prefix = os.path.join(deploy_dir, '%s-%s.' % (self.image5, machine)) # check if we have result image and manifests symlinks # pointing to existing files for suffix in ('wic', 'manifest'):@@ -236,42 +261,42 @@ class Wic(oeSelfTest): @testcase(1348) def test_qemux86_directdisk(self): - """Test creation of qemux-86-directdisk image""" - image = "qemux86-directdisk" - self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \ - % image).status) - self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) + """Test creation of %s image""" % self.image3 + self.assertEqual(0, runCmd("wic create %s -e %s" + % (self.image3, self.image1)).status) + self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" + % self.image3))) @testcase(1349) def test_mkgummidisk(self): """Test creation of mkgummidisk image""" image = "mkgummidisk" - self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \ - % image).status) + self.assertEqual(0, runCmd("wic create %s -e %s" + % (image, self.image1)).status) self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) @testcase(1350) def test_mkefidisk(self): """Test creation of mkefidisk image""" image = "mkefidisk" - self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \ - % image).status) + self.assertEqual(0, runCmd("wic create %s -e %s" + % (image, self.image1)).status) self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) @testcase(1385) def test_directdisk_bootloader_config(self): - """Test creation of directdisk-bootloader-config image""" - image = "directdisk-bootloader-config" - self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \ - % image).status) + """Test creation of %s-bootloader-config image""" % self.image4 + image = "%s-bootloader-config" % self.image4 + self.assertEqual(0, runCmd("wic create %s -e %s" + % (image, self.image1)).status) self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) @testcase(1422) def test_qemu(self): - """Test wic-image-minimal under qemu""" - self.assertEqual(0, bitbake('wic-image-minimal').status) + """Test %s under qemu""" % self.image5 + self.assertEqual(0, bitbake(self.image5).status) - with runqemu('wic-image-minimal', ssh=False) as qemu: + with runqemu(self.image5, ssh=False) as qemu: command = "mount |grep '^/dev/' | cut -f1,3 -d ' '" status, output = qemu.run_serial(command) self.assertEqual(1, status, 'Failed to run command "%s": %s' % (command, output))@@ -279,8 +304,9 @@ class Wic(oeSelfTest): def test_bmap(self): """Test generation of .bmap file""" - image = "directdisk" - status = runCmd("wic create %s -e core-image-minimal --bmap" % image).status + image = self.image4 + status = runCmd("wic create %s -e %s --bmap" + % (image, self.image1)).status self.assertEqual(0, status) self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) self.assertEqual(1, len(glob(self.resultdir + "%s-*direct.bmap" % image)))Signature · 7 lines
1.8.3.1 -- _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 3 lines
-- Regards, Ed
Re: [PATCH 20/20] oeqa.utils.readconfig: Read self-test configuration file
In reply to Jose LamegoQuoted 6 lines · Jose Lamego
Improve oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
This library reads a configuration file located at the oeqa/selftest/conf directory with same name as the caller file and the conf extension.
This patch to add the oeqa.utils.readconfig module should really be applied before all of the changes which make use it. It's a relatively minor niggle, but this should really be 1/20.
Quoted 17 lines
[Yocto 9389]
Signed-off-by Jose Lamego <[email protected]>---
meta/lib/oeqa/utils/readconfig.py | 18 ++++++++++++++++++1 file changed, 18 insertions(+)create mode 100644
meta/lib/oeqa/utils/readconfig.pymeta/lib/oeqa/utils/readconfig.py new file +1
-0@@ -0,0 +1,18 @@ +import os
meta/lib/oeqa/utils/readconfig.py line 11
Quoted 10 lines
meta/lib/oeqa/utils/readconfig.py new file +10
-0+import re +import configparser + + +def conffile(codefile): + # Get test configurations from configuration file + f = re.compile(r'(pyc?$)') + fn = os.path.basename(codefile) + configfile = os.path.join(os.path.dirname(codefile), 'conf', + f.sub('conf', fn))
This seems like it would be simpler with os.path.splitext()[1] ?
meta/lib/oeqa/utils/readconfig.py line 12
Quoted 1 line
meta/lib/oeqa/utils/readconfig.py new file +1
-0+ config = configparser.SafeConfigParser()
Since Python 3.2 that's just ConfigParser()[2]. As we require Python 3.4 or newer for BitBake you can just use configparser.ConfigParser() here.
Quoted 10 lines
meta/lib/oeqa/utils/readconfig.py new file +3
-0+ read_result = config.read(configfile) + if read_result == []: + raise configparser.Error("Failed to get test configurationfrom \
+\"%s\". Verify that file exists and format is correct." + % configfile) + return config
--
1.8.3.1
Regards,
Joshua
1. https://docs.python.org/3/library/os.path.html#os.path.splitext
2. https://docs.python.org/3/whatsnew/3.2.html
Quoted 8 lines · Jose Lamego
Improve oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
Configuration file reading is done through a new library in oeqa.utils and specific configuration files for each test are stored in a separate directory.[Yocto 9389]
Looking at these changes, I'm not 100% convinced this is an improvement in readability or experience. Right now, I can look at the test case definition and get a reasonable idea of what its doing. After the change, I have to read two files at once, side by side in order to have a clue what the test does. Is that an improvement?
I'm open to persuasion on why this patchset is a good idea but the pieces I looked at didn't seem to help much :/
Cheers,
Richard
Re: [PATCH 19/20] oeqa.selftest.wic: Split configuration from code
In reply to Ed BartoshHi Ed, thanks for your quick response.
Quoted 8 lines · Ed Bartosh
Hi Jose,
Quoted 4 lines · Jose Lamego
Improve oeqa-selftest capabilities and UX by placing test configuration features and variables into a separate configuration file.
Quoted 7 lines
Frankly I have mixed feelings about these changes. From the first look splitting configuration and code is a good idea. However, looking at the result I must say I feel like the test became less readable and harder to understand and maintain.
May be the changes make sense for other tests, but for this one they make my life as a maintainer of this one less easy I'd say.
I totally understand you point. But before we drop the idea of this change for wic, would there be a way to keep the code understandable while leveraging on the configuration file to be able to easily try different input/output combinations without touching the test code (which is the basic purpose of the change)? Maybe renaming the conf variables (see below proposals)?
If you still believe there would be no benefits from this change, it will be better to skip it for wic.
Quoted 21 lines
Quoted 16 lines
[Yocto 9389]
Signed-off-by Jose Lamego <[email protected]>--- meta/lib/oeqa/selftest/conf/wic.conf | 10 +++ meta/lib/oeqa/selftest/wic.py | 150 ++++++++++++++++++++--------------- 2 files changed, 98 insertions(+), 62 deletions(-) create mode 100644 meta/lib/oeqa/selftest/conf/wic.confmeta/lib/oeqa/selftest/conf/wic.conf new file +0
-0meta/lib/oeqa/selftest/conf/wic.conf line 3
Quoted 3 lines
meta/lib/oeqa/selftest/conf/wic.conf new file +3
-0@@ -0,0 +1,10 @@ +[Wic] +setUpClass_image1 = core-image-minimal +setUpClass_image2 = minimal
setUpClass_image2is not used in the code.
Quoted 7 lines
meta/lib/oeqa/selftest/conf/wic.conf line 6
Quoted 3 lines
meta/lib/oeqa/selftest/conf/wic.conf new file +3
-0+setUpClass_image3 = qemux86-directdisk +setUpClass_image4 = directdisk +setUpClass_image5 = wic-image-minimal
setUpClass_image1is an image produced by bitbake, butsetUpClass_image3is a name of wic image. They're not the same. Bitbake image is an input for wic and wic image is an output.setUpClass_image5is again the name of the bitbake target, but it differs from_image3. Naming doesn't reflect this fact.
setUpClass_image1 could be renamed to setUpClass_bitbakeImage1 setUpClass_image3 could be renamed to setClass_wicImage setUpClass_image5 to setUpClass_bitbakeImage2
Quoted 38 lines
meta/lib/oeqa/selftest/conf/wic.conf line 9
Quoted 5 lines
meta/lib/oeqa/selftest/conf/wic.conf new file +3
-0+setUpClass_features = IMAGE_FSTYPES += " hddimg" + MACHINE_FEATURES_append = " efi" +setUpClass_recipes = syslinux syslinux-native parted-native gptfdisk-native dosfstools-native mtools-native bmap-tools-nativeThis list is used only once in the test. Moving it to config file makes it longer to understand what's in the list.
Quoted 17 lines
meta/lib/oeqa/selftest/wic.py +2
-0@@ -31,6 +31,7 @@ from shutil import rmtree from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu from oeqa.utils.decorators import testcase +from oeqa.utils.readconfig import conffile class Wic(oeSelfTest):@@ -39,6 +40,18 @@ class Wic(oeSelfTest): resultdir = "/var/tmp/wic/build/" image_is_ready = False + @classmethodmeta/lib/oeqa/selftest/wic.py class Wic(oeSelfTest): · line 53
Quoted 10 lines
meta/lib/oeqa/selftest/wic.py +10
-0+ def setUpClass(cls): + # Get test configurations from configuration file + cls.config = conffile(__file__) + cls.image1 = cls.config.get('Wic', 'setUpClass_image1') + cls.image2 = cls.config.get('Wic', 'setUpClass_image2') + cls.image3 = cls.config.get('Wic', 'setUpClass_image3') + cls.image4 = cls.config.get('Wic', 'setUpClass_image4') + cls.image5 = cls.config.get('Wic', 'setUpClass_image5') + cls.features = cls.config.get('Wic', 'setUpClass_features') + cls.recipes = cls.config.get('Wic', 'setUpClass_recipes')This looks like a duplication of code and configuration and also hides real image names and features making test much less readable.
Quoted 15 lines
meta/lib/oeqa/selftest/wic.py class Wic(oeSelfTest): · line 65
Quoted 13 lines
meta/lib/oeqa/selftest/wic.py +3
-3+ def setUpLocal(self): """This code is executed before each test method.""" self.write_config('IMAGE_FSTYPES += " hddimg"\n'@@ -48,9 +61,8 @@ class Wic(oeSelfTest): # clean up which can result in the native tools built earlier in # setUpClass being unavailable. if not Wic.image_is_ready: - bitbake('syslinux syslinux-native parted-native gptfdisk-native ' - 'dosfstools-native mtools-native bmap-tools-native') - bitbake('core-image-minimal') + bitbake(self.recipes) + bitbake(self.image1)I'd really prefer to see list of dependencies and the image name right in the test code without having to look into configuration file.
Could this dependency list be renamed to something that reflects its nature? something like "nativeDependencies"? So a different dependency group could be used from the conf file.
Quoted 254 lines
The same is true for pretty much all the changes.
Quoted 250 lines
meta/lib/oeqa/selftest/wic.py +73
-59Wic.image_is_ready = True rmtree(self.resultdir, ignore_errors=True)@@ -73,30 +85,35 @@ class Wic(oeSelfTest): @testcase(1211) def test_build_image_name(self): """Test wic create directdisk --image-name core-image-minimal""" - self.assertEqual(0, runCmd("wic create directdisk " - "--image-name core-image-minimal").status) - self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) + self.assertEqual( + 0, runCmd("wic create %s --image-name %s" + % (self.image4, self.image1)).status) + self.assertEqual( + 1, len(glob(self.resultdir + "%s-*.direct" % self.image4))) @testcase(1212) def test_build_artifacts(self): """Test wic create directdisk providing all artifacts.""" - bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) \ - for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', - 'STAGING_DIR_NATIVE', 'IMAGE_ROOTFS')) + bbvars = dict((var.lower(), get_bb_var(var, self.image1)) + for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', + 'STAGING_DIR_NATIVE', 'IMAGE_ROOTFS')) status = runCmd("wic create directdisk " "-b %(staging_datadir)s " "-k %(deploy_dir_image)s " "-n %(staging_dir_native)s " "-r %(image_rootfs)s" % bbvars).status self.assertEqual(0, status) - self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) + self.assertEqual(1, len(glob(self.resultdir + "%s-*.direct" + % self.image4))) @testcase(1157) def test_gpt_image(self): - """Test creation of core-image-minimal with gpt table and UUID boot""" - self.assertEqual(0, runCmd("wic create directdisk-gpt " - "--image-name core-image-minimal").status) - self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) + """Test creation of %s with gpt table and UUID boot""" % self.image1 + self.assertEqual(0, runCmd("wic create %s-gpt " + "--image-name %s" + % (self.image4, self.image1)).status) + self.assertEqual(1, len(glob(self.resultdir + "%s-*.direct" + % self.image4))) @testcase(1213) def test_unsupported_subcommand(self):@@ -127,55 +144,63 @@ class Wic(oeSelfTest): @testcase(1264) def test_compress_gzip(self): """Test compressing an image with gzip""" - self.assertEqual(0, runCmd("wic create directdisk " - "--image-name core-image-minimal " - "-c gzip").status) - self.assertEqual(1, len(glob(self.resultdir + \ - "directdisk-*.direct.gz"))) + self.assertEqual(0, runCmd("wic create %s " + "--image-name %s " + "-c gzip" + % (self.image4, self.image1)).status) + self.assertEqual(1, len(glob( + self.resultdir + "%s-*.direct.gz" + % self.image4))) @testcase(1265) def test_compress_bzip2(self): """Test compressing an image with bzip2""" - self.assertEqual(0, runCmd("wic create directdisk " - "--image-name core-image-minimal " - "-c bzip2").status) - self.assertEqual(1, len(glob(self.resultdir + \ - "directdisk-*.direct.bz2"))) + self.assertEqual(0, runCmd("wic create %s " + "--image-name %s " + "-c bzip2" + % (self.image4, self.image1)).status) + self.assertEqual(1, len(glob( + self.resultdir + "%s-*.direct.bz2" + % self.image4))) @testcase(1266) def test_compress_xz(self): """Test compressing an image with xz""" - self.assertEqual(0, runCmd("wic create directdisk " - "--image-name core-image-minimal " - "-c xz").status) - self.assertEqual(1, len(glob(self.resultdir + \ - "directdisk-*.direct.xz"))) + self.assertEqual(0, runCmd("wic create %s " + "--image-name %s " + "-c xz" + % (self.image4, self.image1)).status) + self.assertEqual(1, len(glob( + self.resultdir + "%s-*.direct.xz" + % self.image4))) @testcase(1267) def test_wrong_compressor(self): """Test how wic breaks if wrong compressor is provided""" - self.assertEqual(2, runCmd("wic create directdisk " - "--image-name core-image-minimal " - "-c wrong", ignore_status=True).status) + self.assertEqual(2, runCmd("wic create %s " + "--image-name %s " + "-c wrong" % (self.image4, self.image1), + ignore_status=True).status) @testcase(1268) def test_rootfs_indirect_recipes(self): """Test usage of rootfs plugin with rootfs recipes""" wks = "directdisk-multi-rootfs" self.assertEqual(0, runCmd("wic create %s " - "--image-name core-image-minimal " - "--rootfs rootfs1=core-image-minimal " - "--rootfs rootfs2=core-image-minimal" \ - % wks).status) + "--image-name %s " + "--rootfs rootfs1=%s " + "--rootfs rootfs2=%s" + % (wks, self.image1, self.image1, + self.image1)).status) self.assertEqual(1, len(glob(self.resultdir + "%s*.direct" % wks))) @testcase(1269) def test_rootfs_artifacts(self): """Test usage of rootfs plugin with rootfs paths""" - bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) \ - for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', - 'STAGING_DIR_NATIVE', 'IMAGE_ROOTFS')) - bbvars['wks'] = "directdisk-multi-rootfs" + bbvars = dict((var.lower(), get_bb_var(var, self.image1)) + for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', + 'STAGING_DIR_NATIVE', 'IMAGE_ROOTFS')) + bbvars['wks'] = "%s-multi-rootfs" % self.image4 status = runCmd("wic create %(wks)s " "-b %(staging_datadir)s " "-k %(deploy_dir_image)s "@@ -191,14 +216,14 @@ class Wic(oeSelfTest): def test_iso_image(self): """Test creation of hybrid iso image with legacy and EFI boot""" self.assertEqual(0, runCmd("wic create mkhybridiso " - "--image-name core-image-minimal").status) + "--image-name %s" % self.image1).status) self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.direct"))) self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.iso"))) @testcase(1347) def test_image_env(self): """Test generation of <image>.env files.""" - image = 'core-image-minimal' + image = self.image1 self.assertEqual(0, bitbake('%s -c do_rootfs_wicenv' % image).status) stdir = get_bb_var('STAGING_DIR_TARGET', image) imgdatadir = os.path.join(stdir, 'imgdata')@@ -222,11 +247,11 @@ class Wic(oeSelfTest): @testcase(1351) def test_wic_image_type(self): """Test building wic images by bitbake""" - self.assertEqual(0, bitbake('wic-image-minimal').status) + self.assertEqual(0, bitbake(self.image5).status) deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE') machine = get_bb_var('MACHINE') - prefix = os.path.join(deploy_dir, 'wic-image-minimal-%s.' % machine) + prefix = os.path.join(deploy_dir, '%s-%s.' % (self.image5, machine)) # check if we have result image and manifests symlinks # pointing to existing files for suffix in ('wic', 'manifest'):@@ -236,42 +261,42 @@ class Wic(oeSelfTest): @testcase(1348) def test_qemux86_directdisk(self): - """Test creation of qemux-86-directdisk image""" - image = "qemux86-directdisk" - self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \ - % image).status) - self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) + """Test creation of %s image""" % self.image3 + self.assertEqual(0, runCmd("wic create %s -e %s" + % (self.image3, self.image1)).status) + self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" + % self.image3))) @testcase(1349) def test_mkgummidisk(self): """Test creation of mkgummidisk image""" image = "mkgummidisk" - self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \ - % image).status) + self.assertEqual(0, runCmd("wic create %s -e %s" + % (image, self.image1)).status) self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) @testcase(1350) def test_mkefidisk(self): """Test creation of mkefidisk image""" image = "mkefidisk" - self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \ - % image).status) + self.assertEqual(0, runCmd("wic create %s -e %s" + % (image, self.image1)).status) self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) @testcase(1385) def test_directdisk_bootloader_config(self): - """Test creation of directdisk-bootloader-config image""" - image = "directdisk-bootloader-config" - self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \ - % image).status) + """Test creation of %s-bootloader-config image""" % self.image4 + image = "%s-bootloader-config" % self.image4 + self.assertEqual(0, runCmd("wic create %s -e %s" + % (image, self.image1)).status) self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) @testcase(1422) def test_qemu(self): - """Test wic-image-minimal under qemu""" - self.assertEqual(0, bitbake('wic-image-minimal').status) + """Test %s under qemu""" % self.image5 + self.assertEqual(0, bitbake(self.image5).status) - with runqemu('wic-image-minimal', ssh=False) as qemu: + with runqemu(self.image5, ssh=False) as qemu: command = "mount |grep '^/dev/' | cut -f1,3 -d ' '" status, output = qemu.run_serial(command) self.assertEqual(1, status, 'Failed to run command "%s": %s' % (command, output))@@ -279,8 +304,9 @@ class Wic(oeSelfTest): def test_bmap(self): """Test generation of .bmap file""" - image = "directdisk" - status = runCmd("wic create %s -e core-image-minimal --bmap" % image).status + image = self.image4 + status = runCmd("wic create %s -e %s --bmap" + % (image, self.image1)).status self.assertEqual(0, status) self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) self.assertEqual(1, len(glob(self.resultdir + "%s-*direct.bmap" % image)))Signature · 7 lines
1.8.3.1 -- _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 1 line
Jose Lamego | OTC Embedded Platforms & Tools | GDC