public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH 00/20] oeqa: Split configuration from the code
@ 2016-08-08 16:22 Jose Lamego
  2016-08-08 16:22 ` [PATCH 01/20] oeqa.selftest.archiver: Split configuration from code Jose Lamego
                   ` (20 more replies)
  0 siblings, 21 replies; 25+ messages in thread
From: Jose Lamego @ 2016-08-08 16:22 UTC (permalink / raw)
  To: openembedded-core

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

-- 
1.8.3.1



^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 01/20] oeqa.selftest.archiver: Split configuration from code
  2016-08-08 16:22 [PATCH 00/20] oeqa: Split configuration from the code Jose Lamego
@ 2016-08-08 16:22 ` Jose Lamego
  2016-08-08 16:22 ` [PATCH 02/20] oeqa.selftest._sstatetests_noauto: " Jose Lamego
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Jose Lamego @ 2016-08-08 16:22 UTC (permalink / raw)
  To: openembedded-core

Improve oeqa-selftest capabilities and UX by placing
test configuration features and variables into a separate
configuration file.

[Yocto 9389]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 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

diff --git a/meta/lib/oeqa/selftest/archiver.py b/meta/lib/oeqa/selftest/archiver.py
index f2030c4..a2e2de9 100644
--- a/meta/lib/oeqa/selftest/archiver.py
+++ b/meta/lib/oeqa/selftest/archiver.py
@@ -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 <daniel.alexandrux.istrate@intel.com>
         """
 
-        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)
diff --git a/meta/lib/oeqa/selftest/conf/archiver.conf b/meta/lib/oeqa/selftest/conf/archiver.conf
new file mode 100644
index 0000000..2d56056
--- /dev/null
+++ b/meta/lib/oeqa/selftest/conf/archiver.conf
@@ -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
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 02/20] oeqa.selftest._sstatetests_noauto: Split configuration from code
  2016-08-08 16:22 [PATCH 00/20] oeqa: Split configuration from the code Jose Lamego
  2016-08-08 16:22 ` [PATCH 01/20] oeqa.selftest.archiver: Split configuration from code Jose Lamego
@ 2016-08-08 16:22 ` Jose Lamego
  2016-08-08 16:22 ` [PATCH 03/20] oeqa.selftest.bblayers: " Jose Lamego
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Jose Lamego @ 2016-08-08 16:22 UTC (permalink / raw)
  To: openembedded-core

Improve oeqa-selftest capabilities and UX by placing
test configuration features and variables into a separate
configuration file.

[Yocto 9389]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 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

diff --git a/meta/lib/oeqa/selftest/_sstatetests_noauto.py b/meta/lib/oeqa/selftest/_sstatetests_noauto.py
index fc9ae7e..f35811e 100644
--- a/meta/lib/oeqa/selftest/_sstatetests_noauto.py
+++ b/meta/lib/oeqa/selftest/_sstatetests_noauto.py
@@ -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)
diff --git a/meta/lib/oeqa/selftest/conf/_sstatetests_noauto.conf b/meta/lib/oeqa/selftest/conf/_sstatetests_noauto.conf
new file mode 100644
index 0000000..41854a0
--- /dev/null
+++ b/meta/lib/oeqa/selftest/conf/_sstatetests_noauto.conf
@@ -0,0 +1,3 @@
+[RebuildFromSState]
+sstate_relocation_image = core-image-sato-sdk
+sstate_rebuild_image = core-image-sato-sdk
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 03/20] oeqa.selftest.bblayers: Split configuration from code
  2016-08-08 16:22 [PATCH 00/20] oeqa: Split configuration from the code Jose Lamego
  2016-08-08 16:22 ` [PATCH 01/20] oeqa.selftest.archiver: Split configuration from code Jose Lamego
  2016-08-08 16:22 ` [PATCH 02/20] oeqa.selftest._sstatetests_noauto: " Jose Lamego
@ 2016-08-08 16:22 ` Jose Lamego
  2016-08-08 16:22 ` [PATCH 04/20] oeqa.selftest.bbtests: " Jose Lamego
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Jose Lamego @ 2016-08-08 16:22 UTC (permalink / raw)
  To: openembedded-core

Improve oeqa-selftest capabilities and UX by placing
test configuration features and variables into a separate
configuration file.

[Yocto 9389]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 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

diff --git a/meta/lib/oeqa/selftest/bblayers.py b/meta/lib/oeqa/selftest/bblayers.py
index d23675e..49eb2e7 100644
--- a/meta/lib/oeqa/selftest/bblayers.py
+++ b/meta/lib/oeqa/selftest/bblayers.py
@@ -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)
diff --git a/meta/lib/oeqa/selftest/conf/bblayers.conf b/meta/lib/oeqa/selftest/conf/bblayers.conf
new file mode 100644
index 0000000..db6160b
--- /dev/null
+++ b/meta/lib/oeqa/selftest/conf/bblayers.conf
@@ -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
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 04/20] oeqa.selftest.bbtests: Split configuration from code
  2016-08-08 16:22 [PATCH 00/20] oeqa: Split configuration from the code Jose Lamego
                   ` (2 preceding siblings ...)
  2016-08-08 16:22 ` [PATCH 03/20] oeqa.selftest.bblayers: " Jose Lamego
@ 2016-08-08 16:22 ` Jose Lamego
  2016-08-08 16:22 ` [PATCH 05/20] oeqa.selftest.buildhistory: " Jose Lamego
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Jose Lamego @ 2016-08-08 16:22 UTC (permalink / raw)
  To: openembedded-core

Improve oeqa-selftest capabilities and UX by placing
test configuration features and variables into a separate
configuration file.

[Yocto 9389]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 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

diff --git a/meta/lib/oeqa/selftest/bbtests.py b/meta/lib/oeqa/selftest/bbtests.py
index 4b42323..0f89fee 100644
--- a/meta/lib/oeqa/selftest/bbtests.py
+++ b/meta/lib/oeqa/selftest/bbtests.py
@@ -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'
diff --git a/meta/lib/oeqa/selftest/conf/bbtests.conf b/meta/lib/oeqa/selftest/conf/bbtests.conf
new file mode 100644
index 0000000..1412049
--- /dev/null
+++ b/meta/lib/oeqa/selftest/conf/bbtests.conf
@@ -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
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 05/20] oeqa.selftest.buildhistory: Split configuration from code
  2016-08-08 16:22 [PATCH 00/20] oeqa: Split configuration from the code Jose Lamego
                   ` (3 preceding siblings ...)
  2016-08-08 16:22 ` [PATCH 04/20] oeqa.selftest.bbtests: " Jose Lamego
@ 2016-08-08 16:22 ` Jose Lamego
  2016-08-08 16:22 ` [PATCH 06/20] oeqa.selftest.buildoptions: " Jose Lamego
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Jose Lamego @ 2016-08-08 16:22 UTC (permalink / raw)
  To: openembedded-core

Improve oeqa-selftest capabilities and UX by placing
test configuration features and variables into a separate
configuration file.

[Yocto 9389]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 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

diff --git a/meta/lib/oeqa/selftest/buildhistory.py b/meta/lib/oeqa/selftest/buildhistory.py
index 674da62..9553788 100644
--- a/meta/lib/oeqa/selftest/buildhistory.py
+++ b/meta/lib/oeqa/selftest/buildhistory.py
@@ -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:
diff --git a/meta/lib/oeqa/selftest/conf/buildhistory.conf b/meta/lib/oeqa/selftest/conf/buildhistory.conf
new file mode 100644
index 0000000..e81c701
--- /dev/null
+++ b/meta/lib/oeqa/selftest/conf/buildhistory.conf
@@ -0,0 +1,3 @@
+[buildhistory]
+config_buildhistory_features = INHERIT += "buildhistory"
+                               BUILDHISTORY_COMMIT = "1"
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 06/20] oeqa.selftest.buildoptions: Split configuration from code
  2016-08-08 16:22 [PATCH 00/20] oeqa: Split configuration from the code Jose Lamego
                   ` (4 preceding siblings ...)
  2016-08-08 16:22 ` [PATCH 05/20] oeqa.selftest.buildhistory: " Jose Lamego
@ 2016-08-08 16:22 ` Jose Lamego
  2016-08-08 16:22 ` [PATCH 07/20] oeqa.selftest.devtool: " Jose Lamego
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Jose Lamego @ 2016-08-08 16:22 UTC (permalink / raw)
  To: openembedded-core

Improve oeqa-selftest capabilities and UX by placing
test configuration features and variables into a separate
configuration file.

[Yocto 9389]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 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

diff --git a/meta/lib/oeqa/selftest/buildoptions.py b/meta/lib/oeqa/selftest/buildoptions.py
index 4d01921..877a8c7 100644
--- a/meta/lib/oeqa/selftest/buildoptions.py
+++ b/meta/lib/oeqa/selftest/buildoptions.py
@@ -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 <daniel.alexandrux.istrate@intel.com>
         """
 
+        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)
diff --git a/meta/lib/oeqa/selftest/conf/buildoptions.conf b/meta/lib/oeqa/selftest/conf/buildoptions.conf
new file mode 100644
index 0000000..9471166
--- /dev/null
+++ b/meta/lib/oeqa/selftest/conf/buildoptions.conf
@@ -0,0 +1,42 @@
+[ImageOptionsTests]
+incremental_image_generation_image = core-image-minimal
+incremental_image_generation_writeconfig = INC_RPM_IMAGE_GEN = "1"
+incremental_image_generation_appendconfig = IMAGE_FEATURES += "ssh-server-openssh"
+incremental_image_generation_packagecreated = core-ssh-openssh
+incremental_image_generation_packageremoved = openssh-sshd
+rm_old_image_image = %(incremental_image_generation_image)s
+ccache_tool_recipe1 = ccache
+ccache_tool_recipe2 = m4
+ccache_tool_recipenative = ccache-native
+read_only_image_config = IMAGE_FEATURES += "read-only-rootfs"
+read_only_image_recipe = core-image-sato
+
+[DiskMonTest]
+stoptask_behavior_configstop = BB_DISKMON_DIRS = "STOPTASKS,${TMPDIR},100000G,100K"
+stoptask_behavior_configabort = BB_DISKMON_DIRS = "ABORT,${TMPDIR},100000G,100K"
+stoptask_behavior_configwarn = BB_DISKMON_DIRS = "WARN,${TMPDIR},100000G,100K"
+stoptask_behavior_recipe = m4
+
+[SanityOptionsTest]
+options_warnqa_errorqa_switch_recipe = xcursor-transparent-theme
+sanity_unsafe_script_references_recipe = gzip
+sanity_unsafe_binary_references_recipe = nfs-utils
+layer_without_git_dir_layername = meta-dummy
+layer_without_git_dir_recipe = ed
+
+[BuildhistoryTests]
+buildhistory_basic_recipe = xcursor-transparent-theme
+buildhistory_buildtime_pr_backwards_target = %(buildhistory_basic_recipe)s
+
+[BuildImagesTest]
+directfb_config = DISTRO_FEATURES_remove = "x11"
+                  DISTRO_FEATURES_append = " directfb"
+                  MACHINE ??= "qemuarm"
+directfb_recipe = core-image-directfb
+
+[ArchiverTest]
+arch_work_dir_and_export_source_config = INHERIT += "archiver"
+                                         ARCHIVER_MODE[src] = "original"
+                                         ARCHIVER_MODE[srpm] = "1"
+arch_work_dir_and_export_source_recipe = xcursor-transparent-theme
+arch_work_dir_and_export_source_prefix = xcurs
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 07/20] oeqa.selftest.devtool: Split configuration from code
  2016-08-08 16:22 [PATCH 00/20] oeqa: Split configuration from the code Jose Lamego
                   ` (5 preceding siblings ...)
  2016-08-08 16:22 ` [PATCH 06/20] oeqa.selftest.buildoptions: " Jose Lamego
@ 2016-08-08 16:22 ` Jose Lamego
  2016-08-08 16:22 ` [PATCH 08/20] oeqa.selftest.imagefeatures: " Jose Lamego
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Jose Lamego @ 2016-08-08 16:22 UTC (permalink / raw)
  To: openembedded-core

Improve oeqa-selftest capabilities and UX by placing
test configuration features and variables into a separate
configuration file.

[Yocto 9389]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 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

diff --git a/meta/lib/oeqa/selftest/conf/devtool.conf b/meta/lib/oeqa/selftest/conf/devtool.conf
new file mode 100644
index 0000000..f328c64
--- /dev/null
+++ b/meta/lib/oeqa/selftest/conf/devtool.conf
@@ -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
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py
index 08fe8df..3068c4d 100644
--- a/meta/lib/oeqa/selftest/devtool.py
+++ b/meta/lib/oeqa/selftest/devtool.py
@@ -11,6 +11,8 @@ import oeqa.utils.ftools as ftools
 from oeqa.selftest.base import oeSelfTest
 from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer, runqemu, get_test_layer
 from oeqa.utils.decorators import testcase
+from oeqa.utils.readconfig import conffile
+
 
 class DevtoolBase(oeSelfTest):
 
@@ -114,6 +116,11 @@ class DevtoolBase(oeSelfTest):
 
 class DevtoolTests(DevtoolBase):
 
+    @classmethod
+    def setUpClass(cls):
+        # Get test configurations from configuration file
+        cls.config = conffile(__file__)
+
     def setUp(self):
         """Test case setup function"""
         super(DevtoolTests, self).setUp()
@@ -155,7 +162,9 @@ class DevtoolTests(DevtoolBase):
         result = runCmd('bitbake-layers show-layers')
         self.assertTrue('/workspace' not in result.output, 'This test cannot be run with a workspace layer in bblayers.conf')
         # Try creating a workspace layer with a specific path
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        prefix = self.config.get(
+               'DevtoolTests', 'test_create_workspace_prefix')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
         result = runCmd('devtool create-workspace %s' % tempdir)
         self.assertTrue(os.path.isfile(os.path.join(tempdir, 'conf', 'layer.conf')), msg = "No workspace created. devtool output: %s " % result.output)
@@ -172,45 +181,66 @@ class DevtoolTests(DevtoolBase):
 
     @testcase(1159)
     def test_devtool_add(self):
+        prefix = self.config.get('DevtoolTests', 'test_devtool_add_prefix')
+        url = self.config.get('DevtoolTests', 'test_devtool_add_url')
+        tar_file = self.config.get('DevtoolTests', 'test_devtool_add_tar_file')
+        add_dir = self.config.get('DevtoolTests', 'test_devtool_add_dir')
+        package = self.config.get('DevtoolTests', 'test_devtool_add_package')
         # Fetch source
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
-        url = 'http://www.ivarch.com/programs/sources/pv-1.5.3.tar.bz2'
         result = runCmd('wget %s' % url, cwd=tempdir)
-        result = runCmd('tar xfv pv-1.5.3.tar.bz2', cwd=tempdir)
-        srcdir = os.path.join(tempdir, 'pv-1.5.3')
+        result = runCmd('tar xfv %s' % tar_file, cwd=tempdir)
+        srcdir = os.path.join(tempdir, add_dir)
         self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure')), 'Unable to find configure script in source directory')
         # Test devtool add
         self.track_for_cleanup(self.workspacedir)
-        self.add_command_to_tearDown('bitbake -c cleansstate pv')
+        self.add_command_to_tearDown('bitbake -c cleansstate %s' % package)
         self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
-        result = runCmd('devtool add pv %s' % srcdir)
+        result = runCmd('devtool add %s %s' % (package, srcdir))
         self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'conf', 'layer.conf')), 'Workspace directory not created')
         # Test devtool status
         result = runCmd('devtool status')
-        self.assertIn('pv', result.output)
+        self.assertIn(package, result.output)
         self.assertIn(srcdir, result.output)
         # Clean up anything in the workdir/sysroot/sstate cache (have to do this *after* devtool add since the recipe only exists then)
-        bitbake('pv -c cleansstate')
+        bitbake('%s -c cleansstate' % package)
         # Test devtool build
-        result = runCmd('devtool build pv')
-        installdir = get_bb_var('D', 'pv')
+        result = runCmd('devtool build %s' % package)
+        installdir = get_bb_var('D', package)
         self.assertTrue(installdir, 'Could not query installdir variable')
-        bindir = get_bb_var('bindir', 'pv')
+        bindir = get_bb_var('bindir', package)
         self.assertTrue(bindir, 'Could not query bindir variable')
         if bindir[0] == '/':
             bindir = bindir[1:]
-        self.assertTrue(os.path.isfile(os.path.join(installdir, bindir, 'pv')), 'pv binary not found in D')
+        self.assertTrue(
+            os.path.isfile(os.path.join(installdir, bindir, package)),
+            '%s binary not found in D' % package)
 
     @testcase(1423)
     def test_devtool_add_git_local(self):
+        prefix = self.config.get(
+               'DevtoolTests', 'test_devtool_add_git_local_prefix')
+        pn = self.config.get(
+           'DevtoolTests', 'test_devtool_add_git_local_pn')
+        # We choose an https:// git URL here to check rewriting the URL works
+        url = self.config.get(
+            'DevtoolTests', 'test_devtool_add_git_local_url')
+        srcrev = self.config.get(
+               'DevtoolTests', 'test_devtool_add_git_local_srcrev')
+        license = self.config.get(
+                'DevtoolTests', 'test_devtool_add_git_local_checkvars_license')
+        md5 = self.config.get(
+            'DevtoolTests', 'test_devtool_add_git_local_checkvars_md5')
+        pv = self.config.get(
+           'DevtoolTests', 'test_devtool_add_git_local_checkvars_pv')
+        srcuri = self.config.get(
+               'DevtoolTests', 'test_devtool_add_git_local_checkvars_srcuri')
+        depends = self.config.get(
+                'DevtoolTests', 'test_devtool_add_git_local_checkvars_depends')
         # Fetch source from a remote URL, but do it outside of devtool
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
-        pn = 'dbus-wait'
-        srcrev = '6cc6077a36fe2648a5f993fe7c16c9632f946517'
-        # We choose an https:// git URL here to check rewriting the URL works
-        url = 'https://git.yoctoproject.org/git/dbus-wait'
         # Force fetching to "noname" subdir so we verify we're picking up the name from autoconf
         # instead of the directory name
         result = runCmd('git clone %s noname' % url, cwd=tempdir)
@@ -233,70 +263,102 @@ class DevtoolTests(DevtoolBase):
         self.assertIn(srcdir, result.output)
         self.assertIn(recipefile, result.output)
         checkvars = {}
-        checkvars['LICENSE'] = 'GPLv2'
-        checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263'
+        checkvars['LICENSE'] = license
+        checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=%s' % md5
         checkvars['S'] = '${WORKDIR}/git'
-        checkvars['PV'] = '0.1+git${SRCPV}'
-        checkvars['SRC_URI'] = 'git://git.yoctoproject.org/git/dbus-wait;protocol=https'
+        checkvars['PV'] = '%s+git${SRCPV}' % pv
+        checkvars['SRC_URI'] = srcuri
         checkvars['SRCREV'] = srcrev
-        checkvars['DEPENDS'] = set(['dbus'])
+        checkvars['DEPENDS'] = set([depends])
         self._test_recipe_contents(recipefile, checkvars, [])
 
     @testcase(1162)
     def test_devtool_add_library(self):
         # We don't have the ability to pick up this dependency automatically yet...
-        bitbake('libusb1')
+        recipe1 = self.config.get(
+                'DevtoolTests', 'test_devtool_add_library_recipe1')
+        prefix = self.config.get(
+               'DevtoolTests', 'test_devtool_add_library_prefix')
+        version = self.config.get(
+                'DevtoolTests', 'test_devtool_add_library_version')
+        recipe2 = self.config.get(
+                'DevtoolTests', 'test_devtool_add_library_recipe2')
+        url = self.config.get(
+            'DevtoolTests', 'test_devtool_add_library_url')
+        libfile = self.config.get(
+                'DevtoolTests', 'test_devtool_add_library_file')
+        binary = self.config.get(
+               'DevtoolTests', 'test_devtool_add_library_binary')
+        extra_var = eval(
+                  self.config.get(
+                     'DevtoolTests', 'test_devtool_add_library_extra_var'))
+        bitbake(recipe1)
         # Fetch source
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
-        version = '1.1'
-        url = 'https://www.intra2net.com/en/developer/libftdi/download/libftdi1-%s.tar.bz2' % version
         result = runCmd('wget %s' % url, cwd=tempdir)
-        result = runCmd('tar xfv libftdi1-%s.tar.bz2' % version, cwd=tempdir)
-        srcdir = os.path.join(tempdir, 'libftdi1-%s' % version)
+        result = runCmd(
+               'tar xfv %s-%s.tar.bz2' % (libfile, version), cwd=tempdir)
+        srcdir = os.path.join(tempdir, '%s-%s' % (libfile, version))
         self.assertTrue(os.path.isfile(os.path.join(srcdir, 'CMakeLists.txt')), 'Unable to find CMakeLists.txt in source directory')
         # Test devtool add (and use -V so we test that too)
         self.track_for_cleanup(self.workspacedir)
         self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
-        result = runCmd('devtool add libftdi %s -V %s' % (srcdir, version))
+        result = runCmd(
+               'devtool add %s %s -V %s' % (recipe2, srcdir, version))
         self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'conf', 'layer.conf')), 'Workspace directory not created')
         # Test devtool status
         result = runCmd('devtool status')
-        self.assertIn('libftdi', result.output)
+        self.assertIn(recipe2, result.output)
         self.assertIn(srcdir, result.output)
         # Clean up anything in the workdir/sysroot/sstate cache (have to do this *after* devtool add since the recipe only exists then)
-        bitbake('libftdi -c cleansstate')
+        bitbake('%s -c cleansstate' % recipe2)
         # 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
-        recipefile = '%s/recipes/libftdi/libftdi_%s.bb' % (self.workspacedir, version)
-        result = runCmd('recipetool setvar %s EXTRA_OECMAKE -- \'-DPYTHON_BINDINGS=OFF -DLIBFTDI_CMAKE_CONFIG_DIR=${datadir}/cmake/Modules\'' % recipefile)
+        recipefile = '%s/recipes/%s/%s_%s.bb' % (
+                   self.workspacedir, recipe2, recipe2, version)
+        result = runCmd('recipetool setvar %s %s' % (recipefile, extra_var))
         with open(recipefile, 'a') as f:
             f.write('\nFILES_${PN}-dev += "${datadir}/cmake/Modules"\n')
         # Test devtool build
-        result = runCmd('devtool build libftdi')
-        staging_libdir = get_bb_var('STAGING_LIBDIR', 'libftdi')
+        result = runCmd('devtool build %s' % recipe2)
+        staging_libdir = get_bb_var('STAGING_LIBDIR', recipe2)
         self.assertTrue(staging_libdir, 'Could not query STAGING_LIBDIR variable')
-        self.assertTrue(os.path.isfile(os.path.join(staging_libdir, 'libftdi1.so.2.1.0')), "libftdi binary not found in STAGING_LIBDIR. Output of devtool build libftdi %s" % result.output)
+        self.assertTrue(
+            os.path.isfile(
+                os.path.join(staging_libdir, binary)),
+            "%s binary not found in STAGING_LIBDIR. Output of devtool build \
+%s %s" % (recipe2, recipe2, result.output))
         # Test devtool reset
-        stampprefix = get_bb_var('STAMP', 'libftdi')
-        result = runCmd('devtool reset libftdi')
+        stampprefix = get_bb_var('STAMP', recipe2)
+        result = runCmd('devtool reset %s' % recipe2)
         result = runCmd('devtool status')
-        self.assertNotIn('libftdi', result.output)
-        self.assertTrue(stampprefix, 'Unable to get STAMP value for recipe libftdi')
+        self.assertNotIn(recipe2, result.output)
+        self.assertTrue(stampprefix, 'Unable to get STAMP value for recipe %s'
+                        % recipe2)
         matches = glob.glob(stampprefix + '*')
-        self.assertFalse(matches, 'Stamp files exist for recipe libftdi that should have been cleaned')
-        self.assertFalse(os.path.isfile(os.path.join(staging_libdir, 'libftdi1.so.2.1.0')), 'libftdi binary still found in STAGING_LIBDIR after cleaning')
+        self.assertFalse(matches, 'Stamp files exist for recipe %s that should \
+have been cleaned' % recipe2)
+        self.assertFalse(os.path.isfile(os.path.join(staging_libdir, binary)),
+                         '%s binary still found in STAGING_LIBDIR after \
+cleaning' % recipe2)
 
     @testcase(1160)
     def test_devtool_add_fetch(self):
+        prefix = self.config.get(
+               'DevtoolTests', 'test_devtool_add_fetch_prefix')
+        testver = self.config.get(
+                'DevtoolTests', 'test_devtool_add_fetch_testver')
+        url = self.config.get('DevtoolTests', 'test_devtool_add_fetch_url')
+        testrecipe = self.config.get(
+                   'DevtoolTests', 'test_devtool_add_fetch_testrecipe')
+        fakever = self.config.get(
+                'DevtoolTests', 'test_devtool_add_fetch_fakever')
         # Fetch source
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
-        testver = '0.23'
-        url = 'https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-%s.tar.gz' % testver
-        testrecipe = 'python-markupsafe'
         srcdir = os.path.join(tempdir, testrecipe)
         # Test devtool add
         self.track_for_cleanup(self.workspacedir)
@@ -320,7 +382,6 @@ class DevtoolTests(DevtoolBase):
         # Try with version specified
         result = runCmd('devtool reset -n %s' % testrecipe)
         shutil.rmtree(srcdir)
-        fakever = '1.9'
         result = runCmd('devtool add %s %s -f %s -V %s' % (testrecipe, srcdir, url, fakever))
         self.assertTrue(os.path.isfile(os.path.join(srcdir, 'setup.py')), 'Unable to find setup.py in source directory')
         # Test devtool status
@@ -337,12 +398,19 @@ class DevtoolTests(DevtoolBase):
 
     @testcase(1161)
     def test_devtool_add_fetch_git(self):
+        prefix = self.config.get(
+               'DevtoolTests', 'test_devtool_add_fetch_git_prefix')
+        checkrev = self.config.get(
+                 'DevtoolTests', 'test_devtool_add_fetch_git_checkrev')
+        url = self.config.get(
+            'DevtoolTests', 'test_devtool_add_fetch_git_url')
+        testrecipe = self.config.get(
+                   'DevtoolTests', 'test_devtool_add_fetch_git_testrecipe')
+        pv = self.config.get('DevtoolTests', 'test_devtool_add_fetch_git_pv')
+        ver = self.config.get('DevtoolTests', 'test_devtool_add_fetch_git_ver')
         # Fetch source
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
-        url = 'git://git.yoctoproject.org/libmatchbox'
-        checkrev = '462f0652055d89c648ddd54fd7b03f175c2c6973'
-        testrecipe = 'libmatchbox2'
         srcdir = os.path.join(tempdir, testrecipe)
         # Test devtool add
         self.track_for_cleanup(self.workspacedir)
@@ -360,7 +428,7 @@ class DevtoolTests(DevtoolBase):
         self.assertIn('_git.bb', recipefile, 'Recipe file incorrectly named')
         checkvars = {}
         checkvars['S'] = '${WORKDIR}/git'
-        checkvars['PV'] = '1.12+git${SRCPV}'
+        checkvars['PV'] = '%s+git${SRCPV}' % pv
         checkvars['SRC_URI'] = url
         checkvars['SRCREV'] = '${AUTOREV}'
         self._test_recipe_contents(recipefile, checkvars, [])
@@ -368,7 +436,8 @@ class DevtoolTests(DevtoolBase):
         result = runCmd('devtool reset -n %s' % testrecipe)
         shutil.rmtree(srcdir)
         url_rev = '%s;rev=%s' % (url, checkrev)
-        result = runCmd('devtool add %s %s -f "%s" -V 1.5' % (testrecipe, srcdir, url_rev))
+        result = runCmd('devtool add %s %s -f "%s" -V %s'
+                        % (testrecipe, srcdir, url_rev, ver))
         self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure.ac')), 'Unable to find configure.ac in source directory')
         # Test devtool status
         result = runCmd('devtool status')
@@ -379,19 +448,24 @@ class DevtoolTests(DevtoolBase):
         self.assertIn('_git.bb', recipefile, 'Recipe file incorrectly named')
         checkvars = {}
         checkvars['S'] = '${WORKDIR}/git'
-        checkvars['PV'] = '1.5+git${SRCPV}'
+        checkvars['PV'] = '%s+git${SRCPV}' % ver
         checkvars['SRC_URI'] = url
         checkvars['SRCREV'] = checkrev
         self._test_recipe_contents(recipefile, checkvars, [])
 
     @testcase(1391)
     def test_devtool_add_fetch_simple(self):
+        prefix = self.config.get(
+               'DevtoolTests', 'test_devtool_add_fetch_simple_prefix')
+        url = self.config.get(
+            'DevtoolTests', 'test_devtool_add_fetch_simple_url')
+        testrecipe = self.config.get(
+                   'DevtoolTests', 'test_devtool_add_fetch_simple_testrecipe')
+        testver = self.config.get(
+                'DevtoolTests', 'test_devtool_add_fetch_simple_testver')
         # Fetch source from a remote URL, auto-detecting name
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
-        testver = '1.6.0'
-        url = 'http://www.ivarch.com/programs/sources/pv-%s.tar.bz2' % testver
-        testrecipe = 'pv'
         srcdir = os.path.join(self.workspacedir, 'sources', testrecipe)
         # Test devtool add
         self.track_for_cleanup(self.workspacedir)
@@ -414,58 +488,76 @@ class DevtoolTests(DevtoolBase):
 
     @testcase(1164)
     def test_devtool_modify(self):
+        prefix = self.config.get(
+               'DevtoolTests', 'test_devtool_modify_prefix')
+        recipe = self.config.get(
+               'DevtoolTests', 'test_devtool_modify_recipe')
         # Clean up anything in the workdir/sysroot/sstate cache
-        bitbake('mdadm -c cleansstate')
+        bitbake('%s -c cleansstate' % recipe)
         # Try modifying a recipe
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
         self.track_for_cleanup(self.workspacedir)
         self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
-        self.add_command_to_tearDown('bitbake -c clean mdadm')
-        result = runCmd('devtool modify mdadm -x %s' % tempdir)
+        self.add_command_to_tearDown('bitbake -c clean %s' % recipe)
+        result = runCmd('devtool modify %s -x %s' % (recipe, tempdir))
         self.assertTrue(os.path.exists(os.path.join(tempdir, 'Makefile')), 'Extracted source could not be found')
         self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'conf', 'layer.conf')), 'Workspace directory not created')
-        matches = glob.glob(os.path.join(self.workspacedir, 'appends', 'mdadm_*.bbappend'))
+        matches = glob.glob(
+                os.path.join(
+                    self.workspacedir, 'appends', '%s_*.bbappend' % recipe))
         self.assertTrue(matches, 'bbappend not created %s' % result.output)
         # Test devtool status
         result = runCmd('devtool status')
-        self.assertIn('mdadm', result.output)
+        self.assertIn(recipe, result.output)
         self.assertIn(tempdir, result.output)
         # Check git repo
         self._check_src_repo(tempdir)
         # Try building
         bitbake('mdadm')
         # Try making (minor) modifications to the source
-        result = runCmd("sed -i 's!^\.TH.*!.TH MDADM 8 \"\" v9.999-custom!' %s" % os.path.join(tempdir, 'mdadm.8.in'))
-        bitbake('mdadm -c package')
-        pkgd = get_bb_var('PKGD', 'mdadm')
+        uprecipe = recipe.upper()
+        result = runCmd(
+               "sed -i 's!^\.TH.*!.TH %s 8 \"\" v9.999-custom!' %s"
+               % (uprecipe, os.path.join(tempdir, '%s.8.in' % recipe)))
+        bitbake('%s -c package' % recipe)
+        pkgd = get_bb_var('PKGD', recipe)
         self.assertTrue(pkgd, 'Could not query PKGD variable')
-        mandir = get_bb_var('mandir', 'mdadm')
+        mandir = get_bb_var('mandir', recipe)
         self.assertTrue(mandir, 'Could not query mandir variable')
         if mandir[0] == '/':
             mandir = mandir[1:]
-        with open(os.path.join(pkgd, mandir, 'man8', 'mdadm.8'), 'r') as f:
+        with open(
+                os.path.join(pkgd, mandir, 'man8', '%s.8' % recipe), 'r') as f:
             for line in f:
                 if line.startswith('.TH'):
-                    self.assertEqual(line.rstrip(), '.TH MDADM 8 "" v9.999-custom', 'man file not modified. man searched file path: %s' % os.path.join(pkgd, mandir, 'man8', 'mdadm.8'))
+                    self.assertEqual(
+                        line.rstrip(), '.TH %s 8 "" v9.999-custom' % uprecipe,
+                        'man file not modified. man searched file path: %s'
+                        % os.path.join(pkgd, mandir, 'man8', '%s.8' % recipe))
         # Test devtool reset
-        stampprefix = get_bb_var('STAMP', 'mdadm')
-        result = runCmd('devtool reset mdadm')
+        stampprefix = get_bb_var('STAMP', recipe)
+        result = runCmd('devtool reset %s' % recipe)
         result = runCmd('devtool status')
-        self.assertNotIn('mdadm', result.output)
-        self.assertTrue(stampprefix, 'Unable to get STAMP value for recipe mdadm')
+        self.assertNotIn(recipe, result.output)
+        self.assertTrue(
+            stampprefix, 'Unable to get STAMP value for recipe %s' % recipe)
         matches = glob.glob(stampprefix + '*')
-        self.assertFalse(matches, 'Stamp files exist for recipe mdadm that should have been cleaned')
+        self.assertFalse(matches, 'Stamp files exist for recipe %s that should\
+ have been cleaned' % recipe)
 
     @testcase(1166)
     def test_devtool_modify_invalid(self):
+        prefix = self.config.get(
+               'DevtoolTests', 'test_devtool_modify_invalid_prefix')
+        testrecipes = self.config.get(
+            'DevtoolTests', 'test_devtool_modify_invalid_testrecipes').split()
         # Try modifying some recipes
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
         self.track_for_cleanup(self.workspacedir)
         self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
 
-        testrecipes = 'perf kernel-devsrc package-index core-image-minimal meta-toolchain packagegroup-core-sdk meta-ide-support'.split()
         # Find actual name of gcc-source since it now includes the version - crude, but good enough for this purpose
         result = runCmd('bitbake-layers show-recipes gcc-source*')
         for line in result.output.splitlines():
@@ -488,17 +580,20 @@ class DevtoolTests(DevtoolBase):
 
     @testcase(1365)
     def test_devtool_modify_native(self):
+        prefix = self.config.get(
+               'DevtoolTests', 'test_devtool_modify_native_prefix')
+        testrecipes = self.config.get(
+            'DevtoolTests', 'test_devtool_modify_native_testrecipes').split()
         # Check preconditions
         self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory')
         # Try modifying some recipes
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
         self.track_for_cleanup(self.workspacedir)
         self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
 
         bbclassextended = False
         inheritnative = False
-        testrecipes = 'mtools-native apt-native desktop-file-utils-native'.split()
         for testrecipe in testrecipes:
             checkextend = 'native' in (get_bb_var('BBCLASSEXTEND', testrecipe) or '').split()
             if not bbclassextended:
@@ -518,14 +613,17 @@ class DevtoolTests(DevtoolBase):
 
     @testcase(1165)
     def test_devtool_modify_git(self):
+        prefix = self.config.get(
+               'DevtoolTests', 'test_devtool_modify_git_prefix')
+        testrecipe = self.config.get(
+                   'DevtoolTests', 'test_devtool_modify_git_testrecipe')
         # Check preconditions
-        testrecipe = 'mkelfimage'
         src_uri = get_bb_var('SRC_URI', testrecipe)
         self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe)
         # Clean up anything in the workdir/sysroot/sstate cache
         bitbake('%s -c cleansstate' % testrecipe)
         # Try modifying a recipe
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
         self.track_for_cleanup(self.workspacedir)
         self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
@@ -546,8 +644,11 @@ class DevtoolTests(DevtoolBase):
 
     @testcase(1167)
     def test_devtool_modify_localfiles(self):
+        prefix = self.config.get(
+               'DevtoolTests', 'test_devtool_modify_localfiles_prefix')
+        testrecipe = self.config.get(
+                   'DevtoolTests', 'test_devtool_modify_localfiles_testrecipe')
         # Check preconditions
-        testrecipe = 'lighttpd'
         src_uri = (get_bb_var('SRC_URI', testrecipe) or '').split()
         foundlocal = False
         for item in src_uri:
@@ -558,7 +659,7 @@ class DevtoolTests(DevtoolBase):
         # Clean up anything in the workdir/sysroot/sstate cache
         bitbake('%s -c cleansstate' % testrecipe)
         # Try modifying a recipe
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
         self.track_for_cleanup(self.workspacedir)
         self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
@@ -577,10 +678,14 @@ class DevtoolTests(DevtoolBase):
 
     @testcase(1378)
     def test_devtool_modify_virtual(self):
+        prefix = self.config.get(
+               'DevtoolTests', 'test_devtool_modify_virtual_prefix')
+        virtrecipe = self.config.get(
+                   'DevtoolTests', 'test_devtool_modify_virtual_virtrecipe')
+        realrecipe = self.config.get(
+                   'DevtoolTests', 'test_devtool_modify_virtual_realrecipe')
         # Try modifying a virtual recipe
-        virtrecipe = 'virtual/libx11'
-        realrecipe = 'libx11'
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
         self.track_for_cleanup(self.workspacedir)
         self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
@@ -600,14 +705,17 @@ class DevtoolTests(DevtoolBase):
 
     @testcase(1169)
     def test_devtool_update_recipe(self):
+        prefix = self.config.get(
+               'DevtoolTests', 'test_devtool_update_recipe_prefix')
+        testrecipe = self.config.get(
+                   'DevtoolTests', 'test_devtool_update_recipe_testrecipe')
         # Check preconditions
-        testrecipe = 'minicom'
         recipefile = get_bb_var('FILE', testrecipe)
         src_uri = get_bb_var('SRC_URI', testrecipe)
         self.assertNotIn('git://', src_uri, 'This test expects the %s recipe to NOT be a git recipe' % testrecipe)
         self._check_repo_status(os.path.dirname(recipefile), [])
         # First, modify a recipe
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
         self.track_for_cleanup(self.workspacedir)
         self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
@@ -632,8 +740,13 @@ class DevtoolTests(DevtoolBase):
 
     @testcase(1172)
     def test_devtool_update_recipe_git(self):
+        prefix = self.config.get(
+               'DevtoolTests', 'test_devtool_update_recipe_git_prefix')
+        testrecipe = self.config.get(
+                   'DevtoolTests', 'test_devtool_update_recipe_git_testrecipe')
+        srcuri = self.config.get(
+               'DevtoolTests', 'test_devtool_update_recipe_git_srcuri')
         # Check preconditions
-        testrecipe = 'mtd-utils'
         recipefile = get_bb_var('FILE', testrecipe)
         src_uri = get_bb_var('SRC_URI', testrecipe)
         self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe)
@@ -644,7 +757,7 @@ class DevtoolTests(DevtoolBase):
         self.assertGreater(len(patches), 0, 'The %s recipe does not appear to contain any patches, so this test will not be effective' % testrecipe)
         self._check_repo_status(os.path.dirname(recipefile), [])
         # First, modify a recipe
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
         self.track_for_cleanup(self.workspacedir)
         self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
@@ -666,7 +779,7 @@ class DevtoolTests(DevtoolBase):
         self._check_repo_status(os.path.dirname(recipefile), expected_status)
 
         result = runCmd('git diff %s' % os.path.basename(recipefile), cwd=os.path.dirname(recipefile))
-        addlines = ['SRCREV = ".*"', 'SRC_URI = "git://git.infradead.org/mtd-utils.git"']
+        addlines = ['SRCREV = ".*"', 'SRC_URI = "%s"' % srcuri]
         srcurilines = src_uri.split()
         srcurilines[0] = 'SRC_URI = "' + srcurilines[0]
         srcurilines.append('"')
@@ -701,14 +814,17 @@ class DevtoolTests(DevtoolBase):
 
     @testcase(1170)
     def test_devtool_update_recipe_append(self):
+        prefix = self.config.get(
+               'DevtoolTests', 'test_devtool_update_recipe_append_prefix')
+        testrecipe = self.config.get(
+                'DevtoolTests', 'test_devtool_update_recipe_append_testrecipe')
         # Check preconditions
-        testrecipe = 'mdadm'
         recipefile = get_bb_var('FILE', testrecipe)
         src_uri = get_bb_var('SRC_URI', testrecipe)
         self.assertNotIn('git://', src_uri, 'This test expects the %s recipe to NOT be a git recipe' % testrecipe)
         self._check_repo_status(os.path.dirname(recipefile), [])
         # First, modify a recipe
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         tempsrcdir = os.path.join(tempdir, 'source')
         templayerdir = os.path.join(tempdir, 'layer')
         self.track_for_cleanup(tempdir)
@@ -769,8 +885,11 @@ class DevtoolTests(DevtoolBase):
 
     @testcase(1171)
     def test_devtool_update_recipe_append_git(self):
+        prefix = self.config.get(
+               'DevtoolTests', 'test_devtool_update_recipe_append_git_prefix')
+        testrecipe = self.config.get(
+            'DevtoolTests', 'test_devtool_update_recipe_append_git_testrecipe')
         # Check preconditions
-        testrecipe = 'mtd-utils'
         recipefile = get_bb_var('FILE', testrecipe)
         src_uri = get_bb_var('SRC_URI', testrecipe)
         self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe)
@@ -780,7 +899,7 @@ class DevtoolTests(DevtoolBase):
                 break
         self._check_repo_status(os.path.dirname(recipefile), [])
         # First, modify a recipe
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         tempsrcdir = os.path.join(tempdir, 'source')
         templayerdir = os.path.join(tempdir, 'layer')
         self.track_for_cleanup(tempdir)
@@ -859,10 +978,13 @@ class DevtoolTests(DevtoolBase):
     @testcase(1370)
     def test_devtool_update_recipe_local_files(self):
         """Check that local source files are copied over instead of patched"""
-        testrecipe = 'makedevs'
+        prefix = self.config.get(
+            'DevtoolTests', 'test_devtool_update_recipe_local_files_prefix')
+        testrecipe = self.config.get(
+           'DevtoolTests', 'test_devtool_update_recipe_local_files_testrecipe')
         recipefile = get_bb_var('FILE', testrecipe)
         # Setup srctree for modifying the recipe
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
         self.track_for_cleanup(self.workspacedir)
         self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
@@ -889,10 +1011,14 @@ class DevtoolTests(DevtoolBase):
     @testcase(1371)
     def test_devtool_update_recipe_local_files_2(self):
         """Check local source files support when oe-local-files is in Git"""
-        testrecipe = 'lzo'
+        prefix = self.config.get(
+            'DevtoolTests', 'test_devtool_update_recipe_local_files_2_prefix')
+        testrecipe = self.config.get(
+            'DevtoolTests',
+            'test_devtool_update_recipe_local_files_2_testrecipe')
         recipefile = get_bb_var('FILE', testrecipe)
         # Setup srctree for modifying the recipe
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
         self.track_for_cleanup(self.workspacedir)
         self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
@@ -929,7 +1055,9 @@ class DevtoolTests(DevtoolBase):
 
     @testcase(1163)
     def test_devtool_extract(self):
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        prefix = self.config.get(
+               'DevtoolTests', 'test_devtool_extract_prefix')
+        tempdir = tempfile.mkdtemp(prefix)
         # Try devtool extract
         self.track_for_cleanup(tempdir)
         self.append_config('PREFERRED_PROVIDER_virtual/make = "remake"')
@@ -941,7 +1069,11 @@ class DevtoolTests(DevtoolBase):
 
     @testcase(1379)
     def test_devtool_extract_virtual(self):
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        prefix = self.config.get(
+               'DevtoolTests', 'test_devtool_extract_virtual_prefix')
+        virtrecipe = self.config.get(
+                   'DevtoolTests', 'test_devtool_extract_virtual_virtrecipe')
+        tempdir = tempfile.mkdtemp(prefix)
         # Try devtool extract
         self.track_for_cleanup(tempdir)
         result = runCmd('devtool extract virtual/libx11 %s' % tempdir)
@@ -952,12 +1084,16 @@ class DevtoolTests(DevtoolBase):
 
     @testcase(1168)
     def test_devtool_reset_all(self):
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        prefix = self.config.get(
+               'DevtoolTests', 'test_devtool_reset_all_prefix')
+        testrecipe1 = self.config.get(
+                    'DevtoolTests', 'test_devtool_reset_all_testrecipe1')
+        testrecipe2 = self.config.get(
+                    'DevtoolTests', 'test_devtool_reset_all_testrecipe2')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
         self.track_for_cleanup(self.workspacedir)
         self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
-        testrecipe1 = 'mdadm'
-        testrecipe2 = 'cronie'
         result = runCmd('devtool modify -x %s %s' % (testrecipe1, os.path.join(tempdir, testrecipe1)))
         result = runCmd('devtool modify -x %s %s' % (testrecipe2, os.path.join(tempdir, testrecipe2)))
         result = runCmd('devtool build %s' % testrecipe1)
@@ -1003,10 +1139,16 @@ class DevtoolTests(DevtoolBase):
             self.skipTest('No tap devices found - you must set up tap devices with scripts/runqemu-gen-tapdevs before running this test')
         self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory')
         # Definitions
-        testrecipe = 'mdadm'
-        testfile = '/sbin/mdadm'
+        prefix = self.config.get(
+               'DevtoolTests', 'test_devtool_deploy_target_prefix')
+        testrecipe = self.config.get(
+                   'DevtoolTests', 'test_devtool_deploy_target_testrecipe')
+        test_command = self.config.get(
+                    'DevtoolTests', 'test_devtool_deploy_target_testcommand')
+
+        testfile = '/sbin/%s' % testrecipe
         testimage = 'oe-selftest-image'
-        testcommand = '/sbin/mdadm --help'
+        testcommand = '/sbin/%s %s' % (testrecipe, test_command)
         # Build an image to run
         bitbake("%s qemu-native qemu-helper-native" % testimage)
         deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE')
@@ -1015,7 +1157,7 @@ class DevtoolTests(DevtoolBase):
         # Clean recipe so the first deploy will fail
         bitbake("%s -c clean" % testrecipe)
         # Try devtool modify
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
         self.track_for_cleanup(self.workspacedir)
         self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
@@ -1045,7 +1187,7 @@ class DevtoolTests(DevtoolBase):
             filelist1 = self._process_ls_output(result.output)
 
             # Now look on the target
-            tempdir2 = tempfile.mkdtemp(prefix='devtoolqa')
+            tempdir2 = tempfile.mkdtemp(prefix)
             self.track_for_cleanup(tempdir2)
             tmpfilelist = os.path.join(tempdir2, 'files.txt')
             with open(tmpfilelist, 'w') as f:
@@ -1066,16 +1208,20 @@ class DevtoolTests(DevtoolBase):
     def test_devtool_build_image(self):
         """Test devtool build-image plugin"""
         # Check preconditions
+        prefix = self.config.get(
+               'DevtoolTests', 'test_devtool_build_image_prefix')
+        image = self.config.get(
+              'DevtoolTests', 'test_devtool_build_image_image')
+        recipes = self.config.get(
+                'DevtoolTests', 'test_devtool_build_image_recipes').split()
         self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory')
-        image = 'core-image-minimal'
         self.track_for_cleanup(self.workspacedir)
         self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
         self.add_command_to_tearDown('bitbake -c clean %s' % image)
         bitbake('%s -c clean' % image)
         # Add target and native recipes to workspace
-        recipes = ['mdadm', 'parted-native']
         for recipe in recipes:
-            tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+            tempdir = tempfile.mkdtemp(prefix)
             self.track_for_cleanup(tempdir)
             self.add_command_to_tearDown('bitbake -c clean %s' % recipe)
             runCmd('devtool modify %s -x %s' % (recipe, tempdir))
@@ -1099,6 +1245,12 @@ class DevtoolTests(DevtoolBase):
     @testcase(1367)
     def test_devtool_upgrade(self):
         # Check preconditions
+        recipe = self.config.get(
+               'DevtoolTests', 'test_devtool_upgrade_recipe')
+        version = self.config.get(
+                'DevtoolTests', 'test_devtool_upgrade_version')
+        prefix = self.config.get(
+               'DevtoolTests', 'test_devtool_upgrade_prefix')
         self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory')
         self.track_for_cleanup(self.workspacedir)
         self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
@@ -1107,10 +1259,8 @@ class DevtoolTests(DevtoolBase):
         for param in 'recipename srctree --version -V --branch -b --keep-temp --no-patch'.split():
             self.assertIn(param, result.output)
         # For the moment, we are using a real recipe.
-        recipe = 'devtool-upgrade-test1'
-        version = '1.6.0'
         oldrecipefile = get_bb_var('FILE', recipe)
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
         # Check that recipe is not already under devtool control
         result = runCmd('devtool status')
@@ -1144,13 +1294,17 @@ class DevtoolTests(DevtoolBase):
     @testcase(1433)
     def test_devtool_upgrade_git(self):
         # Check preconditions
+        recipe = self.config.get(
+               'DevtoolTests', 'test_devtool_upgrade_git_recipe')
+        commit = self.config.get(
+               'DevtoolTests', 'test_devtool_upgrade_git_commit')
+        prefix = self.config.get(
+               'DevtoolTests', 'test_devtool_upgrade_git_prefix')
         self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory')
         self.track_for_cleanup(self.workspacedir)
         self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
-        recipe = 'devtool-upgrade-test2'
-        commit = '6cc6077a36fe2648a5f993fe7c16c9632f946517'
         oldrecipefile = get_bb_var('FILE', recipe)
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
         # Check that recipe is not already under devtool control
         result = runCmd('devtool status')
@@ -1186,8 +1340,7 @@ class DevtoolTests(DevtoolBase):
 
         self.track_for_cleanup(self.workspacedir)
         self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
-
-        s = "Microsoft Made No Profit From Anyone's Zunes Yo"
+        s = self.config.get('DevtoolTests', 'test_devtool_layer_plugins_s')
         result = runCmd("devtool --quiet selftest-reverse \"%s\"" % s)
         self.assertEqual(result.output, s[::-1])
 
@@ -1197,15 +1350,20 @@ class DevtoolTests(DevtoolBase):
         self.track_for_cleanup(self.workspacedir)
         self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
         # Use a "real" recipe from meta-selftest
-        recipe = 'devtool-upgrade-test1'
-        oldversion = '1.5.3'
-        newversion = '1.6.0'
+        recipe = self.config.get(
+               'DevtoolTests', '_setup_test_devtool_finish_upgrade_recipe')
+        oldversion = self.config.get(
+               'DevtoolTests', '_setup_test_devtool_finish_upgrade_oldversion')
+        newversion = self.config.get(
+               'DevtoolTests', '_setup_test_devtool_finish_upgrade_newversion')
+        prefix = self.config.get(
+               'DevtoolTests', '_setup_test_devtool_finish_upgrade_prefix')
         oldrecipefile = get_bb_var('FILE', recipe)
         recipedir = os.path.dirname(oldrecipefile)
         result = runCmd('git status --porcelain .', cwd=recipedir)
         if result.output.strip():
             self.fail('Recipe directory for %s contains uncommitted changes' % recipe)
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
         # Check that recipe is not already under devtool control
         result = runCmd('devtool status')
@@ -1273,13 +1431,16 @@ class DevtoolTests(DevtoolBase):
         self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory')
         # Try modifying a recipe
         self.track_for_cleanup(self.workspacedir)
-        recipe = 'mdadm'
+        recipe = self.config.get(
+               'DevtoolTests', '_setup_test_devtool_finish_modify_recipe')
+        prefix = self.config.get(
+               'DevtoolTests', '_setup_test_devtool_finish_modify_prefix')
         oldrecipefile = get_bb_var('FILE', recipe)
         recipedir = os.path.dirname(oldrecipefile)
         result = runCmd('git status --porcelain .', cwd=recipedir)
         if result.output.strip():
             self.fail('Recipe directory for %s contains uncommitted changes' % recipe)
-        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
         self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
         result = runCmd('devtool modify %s %s' % (recipe, tempdir))
@@ -1289,7 +1450,7 @@ class DevtoolTests(DevtoolBase):
         self.assertIn(recipe, result.output)
         self.assertIn(tempdir, result.output)
         # Make a change to the source
-        result = runCmd('sed -i \'/^#include "mdadm.h"/a \\/* Here is a new comment *\\/\' maps.c', cwd=tempdir)
+        result = runCmd('sed -i \'/^#include "%s.h"/a \\/* Here is a new comment *\\/\' maps.c' % recipe, cwd=tempdir)
         result = runCmd('git status --porcelain', cwd=tempdir)
         self.assertIn('M maps.c', result.output)
         result = runCmd('git commit maps.c -m "Add a comment to the code"', cwd=tempdir)
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 08/20] oeqa.selftest.imagefeatures: Split configuration from code
  2016-08-08 16:22 [PATCH 00/20] oeqa: Split configuration from the code Jose Lamego
                   ` (6 preceding siblings ...)
  2016-08-08 16:22 ` [PATCH 07/20] oeqa.selftest.devtool: " Jose Lamego
@ 2016-08-08 16:22 ` Jose Lamego
  2016-08-08 16:22 ` [PATCH 09/20] oeqa.selftest.layerappend: " Jose Lamego
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Jose Lamego @ 2016-08-08 16:22 UTC (permalink / raw)
  To: openembedded-core

Improve oeqa-selftest capabilities and UX by placing
test configuration features and variables into a separate
configuration file.

[Yocto 9389]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 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

diff --git a/meta/lib/oeqa/selftest/conf/imagefeatures.conf b/meta/lib/oeqa/selftest/conf/imagefeatures.conf
new file mode 100644
index 0000000..23e9dd5
--- /dev/null
+++ b/meta/lib/oeqa/selftest/conf/imagefeatures.conf
@@ -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
diff --git a/meta/lib/oeqa/selftest/imagefeatures.py b/meta/lib/oeqa/selftest/imagefeatures.py
index 08e382f..654a020 100644
--- a/meta/lib/oeqa/selftest/imagefeatures.py
+++ b/meta/lib/oeqa/selftest/imagefeatures.py
@@ -5,11 +5,17 @@ from oeqa.utils.sshcontrol import SSHControl
 import os
 import sys
 import logging
+from oeqa.utils.readconfig import conffile
+
 
 class ImageFeatures(oeSelfTest):
 
-    test_user = 'tester'
-    root_user = 'root'
+    @classmethod
+    def setUpClass(cls):
+        # Get test configurations from configuration file
+        cls.config = conffile(__file__)
+        cls.test_user = cls.config.get('imagefeatures', 'test_user')
+        cls.root_user = cls.config.get('imagefeatures', 'root_user')
 
     @testcase(1107)
     def test_non_root_user_can_connect_via_ssh_without_password(self):
@@ -22,15 +28,22 @@ class ImageFeatures(oeSelfTest):
         AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
         """
 
-        features = 'EXTRA_IMAGE_FEATURES = "ssh-server-openssh empty-root-password allow-empty-password"\n'
-        features += 'INHERIT += "extrausers"\n'
-        features += 'EXTRA_USERS_PARAMS = "useradd -p \'\' {}; usermod -s /bin/sh {};"'.format(self.test_user, self.test_user)
+        features = eval(
+                 self.config.get(
+                     'imagefeatures',
+                     'test_non_root_user_can_connect_via_ssh_without_password_\
+features'))
+        image = self.config.get(
+              'imagefeatures',
+              'test_non_root_user_can_connect_via_ssh_without_password_image')
+        features += 'EXTRA_USERS_PARAMS = "useradd -p \'\' {}; usermod -s \
+/bin/sh {};"'.format(self.test_user, self.test_user)
         self.write_config(features)
 
         # Build a core-image-minimal
-        bitbake('core-image-minimal')
+        bitbake(image)
 
-        with runqemu("core-image-minimal") as qemu:
+        with runqemu(image) as qemu:
             # Attempt to ssh with each user into qemu with empty password
             for user in [self.root_user, self.test_user]:
                 ssh = SSHControl(ip=qemu.ip, logfile=qemu.sshlog, user=user)
@@ -48,15 +61,19 @@ class ImageFeatures(oeSelfTest):
         AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
         """
 
-        features = 'EXTRA_IMAGE_FEATURES = "ssh-server-openssh allow-empty-password"\n'
-        features += 'INHERIT += "extrausers"\n'
-        features += 'EXTRA_USERS_PARAMS = "useradd -p \'\' {}; usermod -s /bin/sh {};"'.format(self.test_user, self.test_user)
+        features = eval(
+                 self.config.get('imagefeatures', 'test_all_users_can_connect_\
+via_ssh_without_password_features'))
+        image = self.config.get('imagefeatures',  'test_all_users_can_connect_\
+via_ssh_without_password_image')
+        features += 'EXTRA_USERS_PARAMS = "useradd -p \'\' {}; usermod -s \
+/bin/sh {};"'.format(self.test_user, self.test_user)
         self.write_config(features)
 
         # Build a core-image-minimal
-        bitbake('core-image-minimal')
+        bitbake(image)
 
-        with runqemu("core-image-minimal") as qemu:
+        with runqemu(image) as qemu:
             # Attempt to ssh with each user into qemu with empty password
             for user in [self.root_user, self.test_user]:
                 ssh = SSHControl(ip=qemu.ip, logfile=qemu.sshlog, user=user)
@@ -66,7 +83,6 @@ class ImageFeatures(oeSelfTest):
                 else:
                     self.assertEqual(status, 0, 'ssh to user tester failed with %s' % output)
 
-
     @testcase(1116)
     def test_clutter_image_can_be_built(self):
         """
@@ -91,12 +107,15 @@ class ImageFeatures(oeSelfTest):
         AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
         """
 
-        features = 'DISTRO_FEATURES_append = " wayland"\n'
-        features += 'CORE_IMAGE_EXTRA_INSTALL += "wayland weston"'
+        features = eval(self.config.get(
+                        'imagefeatures',
+                        'test_wayland_support_in_image_features'))
+        image = self.config.get(
+                    'imagefeatures', 'test_wayland_support_in_image_image')
         self.write_config(features)
 
         # Build a core-image-weston
-        bitbake('core-image-weston')
+        bitbake(image)
 
     def test_bmap(self):
         """
@@ -107,10 +126,10 @@ class ImageFeatures(oeSelfTest):
         Author:      Ed Bartosh <ed.bartosh@linux.intel.com>
         """
 
-        features = 'IMAGE_FSTYPES += " ext4 ext4.bmap"'
+        features = self.config.get('imagefeatures', 'test_bmap_features')
+        image_name = self.config.get('imagefeatures', 'test_bmap_image')
         self.write_config(features)
 
-        image_name = 'core-image-minimal'
         bitbake(image_name)
 
         deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE')
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 09/20] oeqa.selftest.layerappend: Split configuration from code
  2016-08-08 16:22 [PATCH 00/20] oeqa: Split configuration from the code Jose Lamego
                   ` (7 preceding siblings ...)
  2016-08-08 16:22 ` [PATCH 08/20] oeqa.selftest.imagefeatures: " Jose Lamego
@ 2016-08-08 16:22 ` Jose Lamego
  2016-08-08 16:22 ` [PATCH 10/20] oeqa.selftest.lic-checksum: " Jose Lamego
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Jose Lamego @ 2016-08-08 16:22 UTC (permalink / raw)
  To: openembedded-core

Improve oeqa-selftest capabilities and UX by placing
test configuration features and variables into a separate
configuration file.

[Yocto 9389]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 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

diff --git a/meta/lib/oeqa/selftest/conf/layerappend.conf b/meta/lib/oeqa/selftest/conf/layerappend.conf
new file mode 100644
index 0000000..11d4520
--- /dev/null
+++ b/meta/lib/oeqa/selftest/conf/layerappend.conf
@@ -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
diff --git a/meta/lib/oeqa/selftest/layerappend.py b/meta/lib/oeqa/selftest/layerappend.py
index 4de5034..e005952 100644
--- a/meta/lib/oeqa/selftest/layerappend.py
+++ b/meta/lib/oeqa/selftest/layerappend.py
@@ -8,44 +8,22 @@ 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 LayerAppendTests(oeSelfTest):
-    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}/
-}
-
-"""
+class LayerAppendTests(oeSelfTest):
 
-    append2 = """
-FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+    @classmethod
+    def setUpClass(cls):
+        # Get test configurations from configuration file
+        cls.config = conffile(__file__)
+        cls.layerconf = eval(cls.config.get('LayerAppendTests', 'layerconf'))
+        cls.recipe = eval(cls.config.get('LayerAppendTests', 'recipe'))
+        cls.append = eval(cls.config.get('LayerAppendTests', 'append'))
+        cls.append2 = eval(cls.config.get('LayerAppendTests', 'append2'))
+        cls.layerappend = eval(cls.config.get(
+                                        'LayerAppendTests', 'layerappend'))
 
-SRC_URI_append += "file://appendtest.txt"
-"""
     layerappend = ''
 
     def tearDownLocal(self):
@@ -54,46 +32,60 @@ SRC_URI_append += "file://appendtest.txt"
 
     @testcase(1196)
     def test_layer_appends(self):
+        layername = self.config.get(
+                  'LayerAppendTests', 'layer_appends_layername')
+        dirname = self.config.get(
+                'LayerAppendTests', 'layer_appends_dirname')
         corebase = get_bb_var("COREBASE")
         stagingdir = get_bb_var("STAGING_DIR_TARGET")
         for l in ["0", "1", "2"]:
-            layer = os.path.join(corebase, "meta-layertest" + l)
+            layer = os.path.join(corebase, "meta-%s" % layername + l)
             self.assertFalse(os.path.exists(layer))
             os.mkdir(layer)
             os.mkdir(layer + "/conf")
             with open(layer + "/conf/layer.conf", "w") as f:
                 f.write(self.layerconf.replace("INT", l))
-            os.mkdir(layer + "/recipes-test")
+            os.mkdir(layer + "/%s" % dirname)
             if l == "0":
-                with open(layer + "/recipes-test/layerappendtest.bb", "w") as f:
+                with open(layer +
+                          "/%s/layerappendtest.bb" % dirname, "w") as f:
                     f.write(self.recipe)
             elif l == "1":
-                with open(layer + "/recipes-test/layerappendtest.bbappend", "w") as f:
+                with open(layer +
+                          "/%s/layerappendtest.bbappend" % dirname, "w") as f:
                     f.write(self.append)
-                os.mkdir(layer + "/recipes-test/layerappendtest")
-                with open(layer + "/recipes-test/layerappendtest/appendtest.txt", "w") as f:
+                os.mkdir(layer + "/%s/layerappendtest" % dirname)
+                with open(layer +
+                          "/%s/layerappendtest/appendtest.txt" % dirname,
+                          "w") as f:
                     f.write("Layer 1 test")
             elif l == "2":
-                with open(layer + "/recipes-test/layerappendtest.bbappend", "w") as f:
+                with open(layer + "/%s/layerappendtest.bbappend" % dirname,
+                          "w") as f:
                     f.write(self.append2)
-                os.mkdir(layer + "/recipes-test/layerappendtest")
-                with open(layer + "/recipes-test/layerappendtest/appendtest.txt", "w") as f:
+                os.mkdir(layer + "/%s/layerappendtest" % dirname)
+                with open(layer +
+                          "/%s/layerappendtest/appendtest.txt" % dirname,
+                          "w") as f:
                     f.write("Layer 2 test")
             self.track_for_cleanup(layer)
 
-        self.layerappend = "BBLAYERS += \"{0}/meta-layertest0 {0}/meta-layertest1 {0}/meta-layertest2\"".format(corebase)
+        self.layerappend = "BBLAYERS += \"{0}/meta-%s0 {0}/meta-%s1 {0}/meta-\
+%s2\"".format(corebase) % (layername, layername, layername)
         ftools.append_file(self.builddir + "/conf/bblayers.conf", self.layerappend)
         bitbake("layerappendtest")
         data = ftools.read_file(stagingdir + "/appendtest.txt")
         self.assertEqual(data, "Layer 2 test")
-        os.remove(corebase + "/meta-layertest2/recipes-test/layerappendtest/appendtest.txt")
+        os.remove(corebase +
+                  "/meta-%s2/%s/layerappendtest/appendtest.txt"
+                  % (layername, dirname))
         bitbake("layerappendtest")
         data = ftools.read_file(stagingdir + "/appendtest.txt")
         self.assertEqual(data, "Layer 1 test")
-        with open(corebase + "/meta-layertest2/recipes-test/layerappendtest/appendtest.txt", "w") as f:
+        with open(corebase +
+                  "/meta-%s2/%s/layerappendtest/appendtest.txt"
+                  % (layername, dirname), "w") as f:
             f.write("Layer 2 test")
         bitbake("layerappendtest")
         data = ftools.read_file(stagingdir + "/appendtest.txt")
         self.assertEqual(data, "Layer 2 test")
-
-
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 10/20] oeqa.selftest.lic-checksum: Split configuration from code
  2016-08-08 16:22 [PATCH 00/20] oeqa: Split configuration from the code Jose Lamego
                   ` (8 preceding siblings ...)
  2016-08-08 16:22 ` [PATCH 09/20] oeqa.selftest.layerappend: " Jose Lamego
@ 2016-08-08 16:22 ` Jose Lamego
  2016-08-08 16:22 ` [PATCH 11/20] oeqa.selftest.manifest: " Jose Lamego
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Jose Lamego @ 2016-08-08 16:22 UTC (permalink / raw)
  To: openembedded-core

Improve oeqa-selftest capabilities and UX by placing
test configuration features and variables into a separate
configuration file.

[Yocto 9389]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 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

diff --git a/meta/lib/oeqa/selftest/conf/lic-checksum.conf b/meta/lib/oeqa/selftest/conf/lic-checksum.conf
new file mode 100644
index 0000000..262b8b1
--- /dev/null
+++ b/meta/lib/oeqa/selftest/conf/lic-checksum.conf
@@ -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
diff --git a/meta/lib/oeqa/selftest/lic-checksum.py b/meta/lib/oeqa/selftest/lic-checksum.py
index df44c97..78590fc 100644
--- a/meta/lib/oeqa/selftest/lic-checksum.py
+++ b/meta/lib/oeqa/selftest/lic-checksum.py
@@ -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:
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 11/20] oeqa.selftest.manifest: Split configuration from code
  2016-08-08 16:22 [PATCH 00/20] oeqa: Split configuration from the code Jose Lamego
                   ` (9 preceding siblings ...)
  2016-08-08 16:22 ` [PATCH 10/20] oeqa.selftest.lic-checksum: " Jose Lamego
@ 2016-08-08 16:22 ` Jose Lamego
  2016-08-08 16:23 ` [PATCH 12/20] oeqa.selftest.oescripts: " Jose Lamego
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Jose Lamego @ 2016-08-08 16:22 UTC (permalink / raw)
  To: openembedded-core

Improve oeqa-selftest capabilities and UX by placing
test configuration features and variables into a separate
configuration file.

[Yocto 9389]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 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

diff --git a/meta/lib/oeqa/selftest/conf/manifest.conf b/meta/lib/oeqa/selftest/conf/manifest.conf
new file mode 100644
index 0000000..ac5ad56
--- /dev/null
+++ b/meta/lib/oeqa/selftest/conf/manifest.conf
@@ -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
diff --git a/meta/lib/oeqa/selftest/manifest.py b/meta/lib/oeqa/selftest/manifest.py
index 44d0404..2f7cd29 100644
--- a/meta/lib/oeqa/selftest/manifest.py
+++ b/meta/lib/oeqa/selftest/manifest.py
@@ -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"\
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 12/20] oeqa.selftest.oescripts: Split configuration from code
  2016-08-08 16:22 [PATCH 00/20] oeqa: Split configuration from the code Jose Lamego
                   ` (10 preceding siblings ...)
  2016-08-08 16:22 ` [PATCH 11/20] oeqa.selftest.manifest: " Jose Lamego
@ 2016-08-08 16:23 ` Jose Lamego
  2016-08-08 16:23 ` [PATCH 13/20] oeqa.selftest.pkgdata: " Jose Lamego
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Jose Lamego @ 2016-08-08 16:23 UTC (permalink / raw)
  To: openembedded-core

Improve oeqa-selftest capabilities and UX by placing
test configuration features and variables into a separate
configuration file.

[Yocto 9389]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 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

diff --git a/meta/lib/oeqa/selftest/conf/oescripts.conf b/meta/lib/oeqa/selftest/conf/oescripts.conf
new file mode 100644
index 0000000..815c45e
--- /dev/null
+++ b/meta/lib/oeqa/selftest/conf/oescripts.conf
@@ -0,0 +1,6 @@
+[TestScripts]
+cleanup_workdir_package = gzip
+cleanup_workdir_old_version = 1.3.12
+
+[BuildhistoryDiffTests]
+buildhistory_diff_target = xcursor-transparent-theme
diff --git a/meta/lib/oeqa/selftest/oescripts.py b/meta/lib/oeqa/selftest/oescripts.py
index 31cd508..5c734b50 100644
--- a/meta/lib/oeqa/selftest/oescripts.py
+++ b/meta/lib/oeqa/selftest/oescripts.py
@@ -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'))
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 13/20] oeqa.selftest.pkgdata: Split configuration from code
  2016-08-08 16:22 [PATCH 00/20] oeqa: Split configuration from the code Jose Lamego
                   ` (11 preceding siblings ...)
  2016-08-08 16:23 ` [PATCH 12/20] oeqa.selftest.oescripts: " Jose Lamego
@ 2016-08-08 16:23 ` Jose Lamego
  2016-08-08 16:23 ` [PATCH 14/20] oeqa.selftest.prservice: " Jose Lamego
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Jose Lamego @ 2016-08-08 16:23 UTC (permalink / raw)
  To: openembedded-core

Improve oeqa-selftest capabilities and UX by placing
test configuration features and variables into a separate
configuration file.

[Yocto 9389]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 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

diff --git a/meta/lib/oeqa/selftest/conf/pkgdata.conf b/meta/lib/oeqa/selftest/conf/pkgdata.conf
new file mode 100644
index 0000000..4d7a667
--- /dev/null
+++ b/meta/lib/oeqa/selftest/conf/pkgdata.conf
@@ -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
diff --git a/meta/lib/oeqa/selftest/pkgdata.py b/meta/lib/oeqa/selftest/pkgdata.py
index 5a63f89..f2a5c22 100644
--- a/meta/lib/oeqa/selftest/pkgdata.py
+++ b/meta/lib/oeqa/selftest/pkgdata.py
@@ -8,107 +8,197 @@ 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 OePkgdataUtilTests(oeSelfTest):
 
     @classmethod
     def setUpClass(cls):
+        # Get test configurations from configuration file
+        cls.config = conffile(__file__)
         # Ensure we have the right data in pkgdata
         logger = logging.getLogger("selftest")
         logger.info('Running bitbake to generate pkgdata')
-        bitbake('glibc busybox zlib bash')
+        package_1 = cls.config.get(
+                  'OePkgdataUtilTests', 'setUpClass_package_1')
+        package_2 = cls.config.get(
+                  'OePkgdataUtilTests', 'setUpClass_package_2')
+        package_3 = cls.config.get(
+                  'OePkgdataUtilTests', 'setupClass_package_3')
+        package_4 = cls.config.get(
+                  'OePkgdataUtilTests', 'setupClass_package_4')
+        bitbake('%s %s %s %s' % (package_1, package_2, package_3, package_4))
 
     @testcase(1203)
     def test_lookup_pkg(self):
+        package_1 = self.config.get(
+                  'OePkgdataUtilTests', 'lookup_pkg_package_1')
+        package_2 = self.config.get(
+                  'OePkgdataUtilTests', 'lookup_pkg_package_2')
+        package_3 = self.config.get(
+                  'OePkgdataUtilTests', 'lookup_pkg_package_3')
+        package_4 = self.config.get(
+                  'OePkgdataUtilTests', 'lookup_pkg_package_4')
+        package_5 = self.config.get(
+                  'OePkgdataUtilTests', 'lookup_pkg_package_5')
+        package_6 = self.config.get(
+                  'OePkgdataUtilTests', 'lookup_pkg_package_6')
         # Forward tests
-        result = runCmd('oe-pkgdata-util lookup-pkg "glibc busybox"')
-        self.assertEqual(result.output, 'libc6\nbusybox')
-        result = runCmd('oe-pkgdata-util lookup-pkg zlib-dev')
-        self.assertEqual(result.output, 'libz-dev')
-        result = runCmd('oe-pkgdata-util lookup-pkg nonexistentpkg', ignore_status=True)
+        result = runCmd(
+               'oe-pkgdata-util lookup-pkg "%s %s"' % (package_1, package_2))
+        self.assertEqual(result.output, '%s\n%s' % (package_3, package_2))
+        result = runCmd('oe-pkgdata-util lookup-pkg %s' % package_4)
+        self.assertEqual(result.output, package_5)
+        result = runCmd('oe-pkgdata-util lookup-pkg %s' % package_6,
+                        ignore_status=True)
         self.assertEqual(result.status, 1, "Status different than 1. output: %s" % result.output)
         self.assertEqual(result.output, 'ERROR: The following packages could not be found: nonexistentpkg')
         # Reverse tests
-        result = runCmd('oe-pkgdata-util lookup-pkg -r "libc6 busybox"')
-        self.assertEqual(result.output, 'glibc\nbusybox')
-        result = runCmd('oe-pkgdata-util lookup-pkg -r libz-dev')
-        self.assertEqual(result.output, 'zlib-dev')
-        result = runCmd('oe-pkgdata-util lookup-pkg -r nonexistentpkg', ignore_status=True)
+        result = runCmd('oe-pkgdata-util lookup-pkg -r "%s %s"'
+                        % (package_3, package_2))
+        self.assertEqual(result.output, '%s\n%s' % (package_1, package_2))
+        result = runCmd('oe-pkgdata-util lookup-pkg -r %s' % package_5)
+        self.assertEqual(result.output, package_4)
+        result = runCmd('oe-pkgdata-util lookup-pkg -r %s' % package_6,
+                        ignore_status=True)
         self.assertEqual(result.status, 1, "Status different than 1. output: %s" % result.output)
-        self.assertEqual(result.output, 'ERROR: The following packages could not be found: nonexistentpkg')
+        self.assertEqual(result.output, 'ERROR: The following packages could \
+not be found: %s' % package_6)
 
     @testcase(1205)
     def test_read_value(self):
-        result = runCmd('oe-pkgdata-util read-value PN libz1')
-        self.assertEqual(result.output, 'zlib')
-        result = runCmd('oe-pkgdata-util read-value PKGSIZE bash')
+        package_1 = self.config.get(
+                  'OePkgdataUtilTests', 'read_value_package_1')
+        package_2 = self.config.get(
+                  'OePkgdataUtilTests', 'read_value_package_2')
+        package_3 = self.config.get(
+                  'OePkgdataUtilTests', 'read_value_package_3')
+        result = runCmd('oe-pkgdata-util read-value PN %s' % package_1)
+        self.assertEqual(result.output, package_2)
+        result = runCmd('oe-pkgdata-util read-value PKGSIZE %s' % package_3)
         pkgsize = int(result.output.strip())
         self.assertGreater(pkgsize, 1, "Size should be greater than 1. %s" % result.output)
 
     @testcase(1198)
     def test_find_path(self):
-        result = runCmd('oe-pkgdata-util find-path /lib/libc.so.6')
-        self.assertEqual(result.output, 'glibc: /lib/libc.so.6')
-        result = runCmd('oe-pkgdata-util find-path /bin/bash')
-        self.assertEqual(result.output, 'bash: /bin/bash')
+        package_1 = self.config.get(
+                  'OePkgdataUtilTests', 'find_path_package_1')
+        package_2 = self.config.get(
+                  'OePkgdataUtilTests', 'find_path_package_2')
+        package_3 = self.config.get(
+                  'OePkgdataUtilTests', 'find_path_package_3')
+        result = runCmd('oe-pkgdata-util find-path /lib/%s' % package_1)
+        self.assertEqual(result.output, '%s: /lib/%s' % (package_2, package_1))
+        result = runCmd('oe-pkgdata-util find-path /bin/%s' % package_3)
+        self.assertEqual(result.output, '%s: /bin/%s' % (package_3, package_3))
         result = runCmd('oe-pkgdata-util find-path /not/exist', ignore_status=True)
         self.assertEqual(result.status, 1, "Status different than 1. output: %s" % result.output)
         self.assertEqual(result.output, 'ERROR: Unable to find any package producing path /not/exist')
 
     @testcase(1204)
     def test_lookup_recipe(self):
-        result = runCmd('oe-pkgdata-util lookup-recipe "libc6-staticdev busybox"')
-        self.assertEqual(result.output, 'glibc\nbusybox')
-        result = runCmd('oe-pkgdata-util lookup-recipe libz-dbg')
-        self.assertEqual(result.output, 'zlib')
-        result = runCmd('oe-pkgdata-util lookup-recipe nonexistentpkg', ignore_status=True)
+        package_1 = self.config.get(
+                  'OePkgdataUtilTests', 'lookup_recipe_package_1')
+        package_2 = self.config.get(
+                  'OePkgdataUtilTests', 'lookup_recipe_package_2')
+        package_3 = self.config.get(
+                  'OePkgdataUtilTests', 'lookup_recipe_package_3')
+        package_4 = self.config.get(
+                  'OePkgdataUtilTests', 'lookup_recipe_package_4')
+        package_5 = self.config.get(
+                  'OePkgdataUtilTests', 'lookup_recipe_package_5')
+        package_6 = self.config.get(
+                  'OePkgdataUtilTests', 'lookup_recipe_package_6')
+        result = runCmd('oe-pkgdata-util lookup-recipe "%s %s"'
+                        % (package_1, package_2))
+        self.assertEqual(result.output, '%s\n%s' % (package_3, package_2))
+        result = runCmd('oe-pkgdata-util lookup-recipe %s' % package_4)
+        self.assertEqual(result.output, package_5)
+        result = runCmd('oe-pkgdata-util lookup-recipe %s' % package_6,
+                        ignore_status=True)
         self.assertEqual(result.status, 1, "Status different than 1. output: %s" % result.output)
-        self.assertEqual(result.output, 'ERROR: The following packages could not be found: nonexistentpkg')
+        self.assertEqual(result.output, 'ERROR: The following packages could \
+not be found: %s' % package_6)
 
     @testcase(1202)
     def test_list_pkgs(self):
+        package_1 = self.config.get(
+                  'OePkgdataUtilTests', 'list_pkgs_package_1')
+        package_2 = self.config.get(
+                  'OePkgdataUtilTests', 'list_pkgs_package_2')
+        package_3 = self.config.get(
+                  'OePkgdataUtilTests', 'list_pkgs_package_3')
+        package_4 = self.config.get(
+                  'OePkgdataUtilTests', 'list_pkgs_package_4')
+        package_5 = self.config.get(
+                  'OePkgdataUtilTests', 'list_pkgs_package_5')
+        package_6 = self.config.get(
+                  'OePkgdataUtilTests', 'list_pkgs_package_6')
+        package_7 = self.config.get(
+                  'OePkgdataUtilTests', 'list_pkgs_package_7')
         # No arguments
-        result = runCmd('oe-pkgdata-util list-pkgs')
+        result = runCmd('oe-pkgdata-util %s' % package_1)
         pkglist = result.output.split()
-        self.assertIn('glibc-utils', pkglist, "Listed packages: %s" % result.output)
-        self.assertIn('zlib-dev', pkglist, "Listed packages: %s" % result.output)
+        self.assertIn(package_2, pkglist,
+                      "Listed packages: %s" % result.output)
+        self.assertIn(package_3, pkglist,
+                      "Listed packages: %s" % result.output)
         # No pkgspec, runtime
         result = runCmd('oe-pkgdata-util list-pkgs -r')
         pkglist = result.output.split()
-        self.assertIn('libc6-utils', pkglist, "Listed packages: %s" % result.output)
-        self.assertIn('libz-dev', pkglist, "Listed packages: %s" % result.output)
+        self.assertIn(package_4, pkglist,
+                      "Listed packages: %s" % result.output)
+        self.assertIn(package_5, pkglist,
+                      "Listed packages: %s" % result.output)
         # With recipe specified
-        result = runCmd('oe-pkgdata-util list-pkgs -p zlib')
+        result = runCmd('oe-pkgdata-util list-pkgs -p %s' % package_6)
         pkglist = sorted(result.output.split())
         try:
-            pkglist.remove('zlib-ptest') # in case ptest is disabled
+            pkglist.remove('%s-ptest' % package_6)  # in case ptest is disabled
         except ValueError:
             pass
-        self.assertEqual(pkglist, ['zlib', 'zlib-dbg', 'zlib-dev', 'zlib-doc', 'zlib-staticdev'], "Packages listed after remove: %s" % result.output)
+        self.assertEqual(
+            pkglist, [package_6, '%s-dbg' % package_6, '%s-dev' % package_6,
+                      '%s-doc' % package_6, '%s-staticdev' % package_6],
+            "Packages listed after remove: %s" % result.output)
         # With recipe specified, runtime
-        result = runCmd('oe-pkgdata-util list-pkgs -p zlib -r')
+        result = runCmd('oe-pkgdata-util %s -p %s -r' % (package_1, package_6))
         pkglist = sorted(result.output.split())
         try:
-            pkglist.remove('libz-ptest') # in case ptest is disabled
+            pkglist.remove('%s-ptest' % package_7)  # in case ptest is disabled
         except ValueError:
             pass
-        self.assertEqual(pkglist, ['libz-dbg', 'libz-dev', 'libz-doc', 'libz-staticdev', 'libz1'], "Packages listed after remove: %s" % result.output)
+        self.assertEqual(
+            pkglist, ['%s-dbg' % package_7, '%s-dev' % package_7,
+                      '%s-doc' % package_7, '%s-staticdev' % package_7,
+                      '%s1' % package_7],
+            "Packages listed after remove: %s" % result.output)
         # With recipe specified and unpackaged
-        result = runCmd('oe-pkgdata-util list-pkgs -p zlib -u')
+        result = runCmd('oe-pkgdata-util %s -p %s -u' % (package_1, package_6))
         pkglist = sorted(result.output.split())
-        self.assertIn('zlib-locale', pkglist, "Listed packages: %s" % result.output)
+        self.assertIn('%s-locale' % package_6, pkglist,
+                      "Listed packages: %s" % result.output)
         # With recipe specified and unpackaged, runtime
-        result = runCmd('oe-pkgdata-util list-pkgs -p zlib -u -r')
+        result = runCmd(
+               'oe-pkgdata-util %s -p %s -u -r' % (package_1, package_6))
         pkglist = sorted(result.output.split())
-        self.assertIn('libz-locale', pkglist, "Listed packages: %s" % result.output)
+        self.assertIn('%s-locale' % package_7, pkglist,
+                      "Listed packages: %s" % result.output)
         # With recipe specified and pkgspec
-        result = runCmd('oe-pkgdata-util list-pkgs -p zlib "*-d*"')
+        result = runCmd(
+               'oe-pkgdata-util %s -p %s "*-d*"' % (package_1, package_6))
         pkglist = sorted(result.output.split())
-        self.assertEqual(pkglist, ['zlib-dbg', 'zlib-dev', 'zlib-doc'], "Packages listed: %s" % result.output)
+        self.assertEqual(
+            pkglist, ['%s-dbg' % package_6, '%s-dev' % package_6, '%s-doc'
+                      % package_6], "Packages listed: %s" % result.output)
         # With recipe specified and pkgspec, runtime
-        result = runCmd('oe-pkgdata-util list-pkgs -p zlib -r "*-d*"')
+        result = runCmd(
+               'oe-pkgdata-util %s -p %s -r "*-d*"' % (package_1, package_6))
         pkglist = sorted(result.output.split())
-        self.assertEqual(pkglist, ['libz-dbg', 'libz-dev', 'libz-doc'], "Packages listed: %s" % result.output)
+        self.assertEqual(
+            pkglist, ['%s-dbg' % package_7, '%s-dev' % package_7, '%s-doc'
+                      % package_7], "Packages listed: %s" % result.output)
 
     @testcase(1201)
     def test_list_pkg_files(self):
@@ -124,103 +214,172 @@ class OePkgdataUtilTests(oeSelfTest):
                     curpkg = line.split(':')[0]
                     files[curpkg] = []
             return files
+        # Get test configurations from configuration file
+        package_1 = self.config.get(
+                  'OePkgdataUtilTests', 'list_pkg_files_package_1')
+        package_2 = self.config.get(
+                  'OePkgdataUtilTests', 'list_pkg_files_package_2')
         base_libdir = get_bb_var('base_libdir')
         libdir = get_bb_var('libdir')
         includedir = get_bb_var('includedir')
         mandir = get_bb_var('mandir')
         # Test recipe-space package name
-        result = runCmd('oe-pkgdata-util list-pkg-files zlib-dev zlib-doc')
+        result = runCmd('oe-pkgdata-util list-pkg-files %s-dev %s-doc'
+                        % (package_1, package_1))
         files = splitoutput(result.output)
-        self.assertIn('zlib-dev', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertIn('zlib-doc', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertIn(os.path.join(includedir, 'zlib.h'), files['zlib-dev'])
-        self.assertIn(os.path.join(mandir, 'man3/zlib.3'), files['zlib-doc'])
+        self.assertIn('%s-dev' % package_1, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertIn('%s-doc' % package_1, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertIn(os.path.join(includedir, '%s.h' % package_1),
+                      files['%s-dev' % package_1])
+        self.assertIn(os.path.join(mandir, 'man3/%s.3' % package_1),
+                      files['%s-doc' % package_1])
         # Test runtime package name
-        result = runCmd('oe-pkgdata-util list-pkg-files -r libz1 libz-dev')
+        result = runCmd('oe-pkgdata-util list-pkg-files -r %s1 %s-dev'
+                        % (package_2, package_2))
         files = splitoutput(result.output)
-        self.assertIn('libz1', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertIn('libz-dev', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertGreater(len(files['libz1']), 1)
-        libspec = os.path.join(base_libdir, 'libz.so.1.*')
+        self.assertIn('%s1' % package_2, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertIn('%s-dev' % package_2, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertGreater(len(files['%s1' % package_2]), 1)
+        libspec = os.path.join(base_libdir, '%s.so.1.*' % package_2)
         found = False
-        for fileitem in files['libz1']:
+        for fileitem in files['%s1' % package_2]:
             if fnmatch.fnmatchcase(fileitem, libspec):
                 found = True
                 break
-        self.assertTrue(found, 'Could not find zlib library file %s in libz1 package file list: %s' % (libspec, files['libz1']))
-        self.assertIn(os.path.join(includedir, 'zlib.h'), files['libz-dev'])
+        self.assertTrue(found, 'Could not find %s library file %s in %s1 \
+package file list: %s' % (package_1, libspec, package_2,
+                          files['%s1' % package_2]))
+        self.assertIn(os.path.join(includedir, '%s.h' % package_1),
+                      files['%s-dev' % package_2])
         # Test recipe
-        result = runCmd('oe-pkgdata-util list-pkg-files -p zlib')
+        result = runCmd('oe-pkgdata-util list-pkg-files -p %s' % package_1)
         files = splitoutput(result.output)
-        self.assertIn('zlib-dbg', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertIn('zlib-doc', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertIn('zlib-dev', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertIn('zlib-staticdev', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertIn('zlib', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertNotIn('zlib-locale', list(files.keys()), "listed pkgs. files: %s" %result.output)
+        self.assertIn('%s-dbg' % package_1, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertIn('%s-doc' % package_1, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertIn('%s-dev' % package_1, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertIn('%s-staticdev' % package_1, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertIn(package_1, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertNotIn('%s-locale' % package_1, list(files.keys()),
+                         "listed pkgs. files: %s" % result.output)
         # (ignore ptest, might not be there depending on config)
-        self.assertIn(os.path.join(includedir, 'zlib.h'), files['zlib-dev'])
-        self.assertIn(os.path.join(mandir, 'man3/zlib.3'), files['zlib-doc'])
-        self.assertIn(os.path.join(libdir, 'libz.a'), files['zlib-staticdev'])
+        self.assertIn(os.path.join(includedir, '%s.h' % package_1),
+                      files['%s-dev' % package_1])
+        self.assertIn(os.path.join(mandir, 'man3/%s.3' % package_1),
+                      files['%s-doc' % package_1])
+        self.assertIn(os.path.join(libdir, '%s.a' % package_2),
+                      files['%s-staticdev' % package_1])
         # Test recipe, runtime
-        result = runCmd('oe-pkgdata-util list-pkg-files -p zlib -r')
+        result = runCmd('oe-pkgdata-util list-pkg-files -p %s -r' % package_1)
         files = splitoutput(result.output)
-        self.assertIn('libz-dbg', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertIn('libz-doc', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertIn('libz-dev', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertIn('libz-staticdev', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertIn('libz1', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertNotIn('libz-locale', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertIn(os.path.join(includedir, 'zlib.h'), files['libz-dev'])
-        self.assertIn(os.path.join(mandir, 'man3/zlib.3'), files['libz-doc'])
-        self.assertIn(os.path.join(libdir, 'libz.a'), files['libz-staticdev'])
+        self.assertIn('%s-dbg' % package_2, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertIn('%s-doc' % package_2, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertIn('%s-dev' % package_2, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertIn('%s-staticdev' % package_2, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertIn('%s1' % package_2, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertNotIn('%s-locale' % package_2, list(files.keys()),
+                         "listed pkgs. files: %s" % result.output)
+        self.assertIn(os.path.join(includedir, '%s.h' % package_1),
+                      files['%s-dev' % package_2])
+        self.assertIn(os.path.join(mandir, 'man3/%s.3' % package_1),
+                      files['%s-doc' % package_2])
+        self.assertIn(os.path.join(libdir, '%s.a' % package_2),
+                      files['%s-staticdev' % package_2])
         # Test recipe, unpackaged
-        result = runCmd('oe-pkgdata-util list-pkg-files -p zlib -u')
+        result = runCmd('oe-pkgdata-util list-pkg-files -p %s -u' % package_1)
         files = splitoutput(result.output)
-        self.assertIn('zlib-dbg', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertIn('zlib-doc', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertIn('zlib-dev', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertIn('zlib-staticdev', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertIn('zlib', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertIn('zlib-locale', list(files.keys()), "listed pkgs. files: %s" %result.output) # this is the key one
-        self.assertIn(os.path.join(includedir, 'zlib.h'), files['zlib-dev'])
-        self.assertIn(os.path.join(mandir, 'man3/zlib.3'), files['zlib-doc'])
-        self.assertIn(os.path.join(libdir, 'libz.a'), files['zlib-staticdev'])
+        self.assertIn('%s-dbg' % package_1, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertIn('%s-doc' % package_1, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertIn('%s-dev' % package_1, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertIn('%s-staticdev' % package_1, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertIn(package_1, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        # this is the key one
+        self.assertIn('%s-locale' % package_1, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertIn(os.path.join(includedir, '%s.h' % package_1),
+                      files['%s-dev' % package_1])
+        self.assertIn(os.path.join(mandir, 'man3/%s.3' % package_1),
+                      files['%s-doc' % package_1])
+        self.assertIn(os.path.join(libdir, '%s.a' % package_2),
+                      files['%s-staticdev' % package_1])
         # Test recipe, runtime, unpackaged
-        result = runCmd('oe-pkgdata-util list-pkg-files -p zlib -r -u')
+        result = runCmd(
+               'oe-pkgdata-util list-pkg-files -p %s -r -u' % package_1)
         files = splitoutput(result.output)
-        self.assertIn('libz-dbg', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertIn('libz-doc', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertIn('libz-dev', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertIn('libz-staticdev', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertIn('libz1', list(files.keys()), "listed pkgs. files: %s" %result.output)
-        self.assertIn('libz-locale', list(files.keys()), "listed pkgs. files: %s" %result.output) # this is the key one
-        self.assertIn(os.path.join(includedir, 'zlib.h'), files['libz-dev'])
-        self.assertIn(os.path.join(mandir, 'man3/zlib.3'), files['libz-doc'])
-        self.assertIn(os.path.join(libdir, 'libz.a'), files['libz-staticdev'])
+        self.assertIn('%s-dbg' % package_2, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertIn('%s-doc' % package_2, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertIn('%s-dev' % package_2, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertIn('%s-staticdev' % package_2, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertIn('%s1' % package_2, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        # this is the key one
+        self.assertIn('%s-locale' % package_2, list(files.keys()),
+                      "listed pkgs. files: %s" % result.output)
+        self.assertIn(os.path.join(includedir, '%s.h' % package_1),
+                      files['%s-dev' % package_2])
+        self.assertIn(os.path.join(mandir, 'man3/%s.3' % package_1),
+                      files['%s-doc' % package_2])
+        self.assertIn(os.path.join(libdir, '%s.a' % package_2),
+                      files['%s-staticdev' % package_2])
 
     @testcase(1200)
     def test_glob(self):
-        tempdir = tempfile.mkdtemp(prefix='pkgdataqa')
+        # Get test configurations from configuration file
+        package_1 = self.config.get('OePkgdataUtilTests', 'glob_package_1')
+        package_2 = self.config.get('OePkgdataUtilTests', 'glob_package_2')
+        package_3 = self.config.get('OePkgdataUtilTests', 'glob_package_3')
+        package_4 = self.config.get('OePkgdataUtilTests', 'glob_package_4')
+        prefix = self.config.get('OePkgdataUtilTests', 'glob_prefix')
+        tempdir = tempfile.mkdtemp(prefix)
         self.track_for_cleanup(tempdir)
         pkglistfile = os.path.join(tempdir, 'pkglist')
         with open(pkglistfile, 'w') as f:
-            f.write('libc6\n')
-            f.write('libz1\n')
-            f.write('busybox\n')
+            f.write('%s\n' % package_1)
+            f.write('%s1\n' % package_2)
+            f.write('%s\n' % package_3)
         result = runCmd('oe-pkgdata-util glob %s "*-dev"' % pkglistfile)
-        desiredresult = ['libc6-dev', 'libz-dev', 'busybox-dev']
+        desiredresult = ['%s-dev' % package_1, '%s-dev' % package_2,
+                         '%s-dev' % package_3]
         self.assertEqual(sorted(result.output.split()), sorted(desiredresult))
         # The following should not error (because when we use this during rootfs construction, sometimes the complementary package won't exist)
         result = runCmd('oe-pkgdata-util glob %s "*-nonexistent"' % pkglistfile)
         self.assertEqual(result.output, '')
         # Test exclude option
-        result = runCmd('oe-pkgdata-util glob %s "*-dev *-dbg" -x "^libz"' % pkglistfile)
+        result = runCmd('oe-pkgdata-util glob %s "*-dev *-dbg" -x "^%s"'
+                        % (pkglistfile, package_2))
         resultlist = result.output.split()
-        self.assertNotIn('libz-dev', resultlist)
-        self.assertNotIn('libz-dbg', resultlist)
+        self.assertNotIn('%s-dev' % package_2, resultlist)
+        self.assertNotIn('%s-dbg' % package_2, resultlist)
 
     @testcase(1206)
     def test_specify_pkgdatadir(self):
-        result = runCmd('oe-pkgdata-util -p %s lookup-pkg glibc' % get_bb_var('PKGDATA_DIR'))
-        self.assertEqual(result.output, 'libc6')
+        # Get test configurations from configuration file
+        package_1 = self.config.get(
+                  'OePkgdataUtilTests', 'specify_pkgdatadir_package_1')
+        package_2 = self.config.get(
+                  'OePkgdataUtilTests', 'specify_pkgdatadir_package_2')
+        result = runCmd('oe-pkgdata-util -p %s lookup-pkg %s'
+                        % (get_bb_var('PKGDATA_DIR'), package_1))
+        self.assertEqual(result.output, package_2)
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 14/20] oeqa.selftest.prservice: Split configuration from code
  2016-08-08 16:22 [PATCH 00/20] oeqa: Split configuration from the code Jose Lamego
                   ` (12 preceding siblings ...)
  2016-08-08 16:23 ` [PATCH 13/20] oeqa.selftest.pkgdata: " Jose Lamego
@ 2016-08-08 16:23 ` Jose Lamego
  2016-08-08 16:23 ` [PATCH 15/20] oeqa.selftest.recipetool: " Jose Lamego
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Jose Lamego @ 2016-08-08 16:23 UTC (permalink / raw)
  To: openembedded-core

Improve oeqa-selftest capabilities and UX by placing
test configuration features and variables into a separate
configuration file.

[Yocto 9389]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 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

diff --git a/meta/lib/oeqa/selftest/conf/prservice.conf b/meta/lib/oeqa/selftest/conf/prservice.conf
new file mode 100644
index 0000000..2d5f315
--- /dev/null
+++ b/meta/lib/oeqa/selftest/conf/prservice.conf
@@ -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
diff --git a/meta/lib/oeqa/selftest/prservice.py b/meta/lib/oeqa/selftest/prservice.py
index 1b9a510..af8ffec 100644
--- a/meta/lib/oeqa/selftest/prservice.py
+++ b/meta/lib/oeqa/selftest/prservice.py
@@ -10,9 +10,16 @@ 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.network import get_free_port
+from oeqa.utils.readconfig import conffile
+
 
 class BitbakePrTests(oeSelfTest):
- 
+
+    @classmethod
+    def setUpClass(cls):
+        # Get test configurations from configuration file
+        cls.config = conffile(__file__)
+
     def get_pr_version(self, package_name):
         pkgdata_dir = get_bb_var('PKGDATA_DIR')
         package_data_file = os.path.join(pkgdata_dir, 'runtime', package_name)
@@ -91,35 +98,81 @@ class BitbakePrTests(oeSelfTest):
 
     @testcase(930)
     def test_import_export_replace_db(self):
-        self.run_test_pr_export_import('m4')
+        package = self.config.get(
+                'BitbakePrTests', 'import_export_replace_db_package')
+        self.run_test_pr_export_import(package)
 
     @testcase(931)
     def test_import_export_override_db(self):
-        self.run_test_pr_export_import('m4', replace_current_db=False)
+        package = self.config.get(
+                'BitbakePrTests', 'import_export_override_db_package')
+        self.run_test_pr_export_import(package, replace_current_db=False)
 
     @testcase(932)
     def test_pr_service_rpm_arch_dep(self):
-        self.run_test_pr_service('m4', 'rpm', 'do_package')
+        # Test configuration is taken from conf file
+        package = self.config.get(
+                'BitbakePrTests', 'pr_service_rpm_arch_dep_package')
+        package_type = self.config.get(
+                     'BitbakePrTests', 'pr_service_rpm_arch_dep_package_type')
+        track_task = self.config.get(
+                   'BitbakePrTests', 'pr_service_rpm_arch_dep_track_task')
+        self.run_test_pr_service(package, package_type, track_task)
 
     @testcase(934)
     def test_pr_service_deb_arch_dep(self):
-        self.run_test_pr_service('m4', 'deb', 'do_package')
+        # Get test configurations from configuration file
+        package = self.config.get(
+                'BitbakePrTests', 'pr_service_deb_arch_dep_package')
+        package_type = self.config.get(
+                     'BitbakePrTests', 'pr_service_deb_arch_dep_package_type')
+        track_task = self.config.get(
+                   'BitbakePrTests', 'pr_service_deb_arch_dep_track_task')
+        self.run_test_pr_service(package, package_type, track_task)
 
     @testcase(933)
     def test_pr_service_ipk_arch_dep(self):
-        self.run_test_pr_service('m4', 'ipk', 'do_package')
+        # Get test configurations from configuration file
+        package = self.config.get(
+                'BitbakePrTests', 'pr_service_ipk_arch_dep_package')
+        package_type = self.config.get(
+                     'BitbakePrTests', 'pr_service_ipk_arch_dep_package_type')
+        track_task = self.config.get(
+                   'BitbakePrTests', 'pr_service_ipk_arch_dep_track_task')
+        self.run_test_pr_service(package, package_type, track_task)
 
     @testcase(935)
     def test_pr_service_rpm_arch_indep(self):
-        self.run_test_pr_service('xcursor-transparent-theme', 'rpm', 'do_package')
+        # Get test configurations from configuration file
+        package = self.config.get(
+                'BitbakePrTests', 'pr_service_rpm_arch_indep_package')
+        package_type = self.config.get(
+                    'BitbakePrTests', 'pr_service_rpm_arch_indep_package_type')
+        track_task = self.config.get(
+                   'BitbakePrTests', 'pr_service_rpm_arch_indep_track_task')
+        self.run_test_pr_service(package, package_type, track_task)
 
     @testcase(937)
     def test_pr_service_deb_arch_indep(self):
-        self.run_test_pr_service('xcursor-transparent-theme', 'deb', 'do_package')
+        # Get test configurations from configuration file
+        package = self.config.get(
+                'BitbakePrTests', 'pr_service_deb_arch_indep_package')
+        package_type = self.config.get(
+                    'BitbakePrTests', 'pr_service_deb_arch_indep_package_type')
+        track_task = self.config.get(
+                   'BitbakePrTests', 'pr_service_deb_arch_indep_track_task')
+        self.run_test_pr_service(package, package_type, track_task)
 
     @testcase(936)
     def test_pr_service_ipk_arch_indep(self):
-        self.run_test_pr_service('xcursor-transparent-theme', 'ipk', 'do_package')
+        # Get test configurations from configuration file
+        package = self.config.get(
+                'BitbakePrTests', 'pr_service_ipk_arch_indep_package')
+        package_type = self.config.get(
+                    'BitbakePrTests', 'pr_service_ipk_arch_indep_package_type')
+        track_task = self.config.get(
+                   'BitbakePrTests', 'pr_service_ipk_arch_indep_track_task')
+        self.run_test_pr_service(package, package_type, track_task)
 
     @testcase(1419)
     def test_stopping_prservice_message(self):
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 15/20] oeqa.selftest.recipetool: Split configuration from code
  2016-08-08 16:22 [PATCH 00/20] oeqa: Split configuration from the code Jose Lamego
                   ` (13 preceding siblings ...)
  2016-08-08 16:23 ` [PATCH 14/20] oeqa.selftest.prservice: " Jose Lamego
@ 2016-08-08 16:23 ` Jose Lamego
  2016-08-08 16:23 ` [PATCH 16/20] oeqa.selftest.runtime-test: " Jose Lamego
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Jose Lamego @ 2016-08-08 16:23 UTC (permalink / raw)
  To: openembedded-core

Improve oeqa-selftest capabilities and UX by placing
test configuration features and variables into a separate
configuration file.

[Yocto 9389]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 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

diff --git a/meta/lib/oeqa/selftest/conf/recipetool.conf b/meta/lib/oeqa/selftest/conf/recipetool.conf
new file mode 100644
index 0000000..254c634
--- /dev/null
+++ b/meta/lib/oeqa/selftest/conf/recipetool.conf
@@ -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
+
diff --git a/meta/lib/oeqa/selftest/recipetool.py b/meta/lib/oeqa/selftest/recipetool.py
index db1f8de..0468163 100644
--- a/meta/lib/oeqa/selftest/recipetool.py
+++ b/meta/lib/oeqa/selftest/recipetool.py
@@ -6,7 +6,7 @@ import urllib.parse
 from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer
 from oeqa.utils.decorators import testcase
 from oeqa.selftest import devtool
-
+from oeqa.utils.readconfig import conffile
 
 templayerdir = None
 
@@ -66,10 +66,25 @@ class RecipetoolBase(devtool.DevtoolBase):
 class RecipetoolTests(RecipetoolBase):
     @classmethod
     def setUpClass(cls):
+        # Get test configurations from configuration file
+        cls.config = conffile(__file__)
+        logger_name = cls.config.get(
+                    'RecipetoolTests', 'setupclass_logger_name')
+        logger_info = cls.config.get(
+                    'RecipetoolTests', 'setupclass_logger_info')
+        recipe_1 = cls.config.get(
+                 'RecipetoolTests', 'setupclass_recipe_1')
+        recipe_2 = cls.config.get(
+                 'RecipetoolTests', 'setupclass_recipe_2')
+        recipe_3 = cls.config.get(
+                 'RecipetoolTests', 'setupclass_recipe_3')
+        cls.append_testfile = cls.config.get(
+                    'RecipetoolTests', 'recipetool_appendfile_append_testfile')
         # Ensure we have the right data in shlibs/pkgdata
-        logger = logging.getLogger("selftest")
-        logger.info('Running bitbake to generate pkgdata')
-        bitbake('-c packagedata base-files coreutils busybox selftest-recipetool-appendfile')
+        logger = logging.getLogger(logger_name)
+        logger.info(logger_info)
+        bitbake('-c packagedata %s %s %s selftest-recipetool-appendfile'
+                % (recipe_1, recipe_2, recipe_3))
 
     @classmethod
     def tearDownClass(cls):
@@ -90,10 +105,17 @@ class RecipetoolTests(RecipetoolBase):
 
     @testcase(1177)
     def test_recipetool_appendfile_basic(self):
+        # Get test configurations from configuration file
+        recipe = self.config.get(
+               'RecipetoolTests', 'recipetool_appendfile_basic_recipe')
+        appendfile = self.config.get(
+                   'RecipetoolTests', 'recipetool_appendfile_appendfile')
         # Basic test
         expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n',
                         '\n']
-        _, output = self._try_recipetool_appendfile('base-files', '/etc/motd', self.testfile, '', expectedlines, ['motd'])
+        _, output = self._try_recipetool_appendfile(
+                  'base-files', '/etc/%s' % appendfile, self.testfile,
+                  '', expectedlines, [appendfile])
         self.assertNotIn('WARNING: ', output)
 
     @testcase(1183)
@@ -105,12 +127,22 @@ class RecipetoolTests(RecipetoolBase):
 
     @testcase(1176)
     def test_recipetool_appendfile_alternatives(self):
+        # Test configuration is taken from conf file
+        append_file = self.config.get(
+          'RecipetoolTests', 'recipetool_appendfile_alternatives_append_file')
+        error_msg = eval(self.config.get(
+            'RecipetoolTests', 'recipetool_appendfile_alternatives_error_msg'))
+        testfile_2 = self.config.get(
+            'RecipetoolTests', 'recipetool_appendfile_alternatives_testfile_2')
+        testrecipe = self.config.get(
+            'RecipetoolTests', 'recipetool_appendfile_alternatives_testrecipe')
         # Now try with a file we know should be an alternative
         # (this is very much a fake example, but one we know is reliably an alternative)
-        self._try_recipetool_appendfile_fail('/bin/ls', self.testfile, ['ERROR: File /bin/ls is an alternative possibly provided by the following recipes:', 'coreutils', 'busybox'])
+        self._try_recipetool_appendfile_fail(append_file, self.testfile,
+                                             error_msg)
         corebase = get_bb_var('COREBASE')
         # Need a test file - should be executable
-        testfile2 = os.path.join(corebase, 'oe-init-build-env')
+        testfile2 = os.path.join(corebase, testfile_2)
         testfile2name = os.path.basename(testfile2)
         expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n',
                          '\n',
@@ -120,25 +152,41 @@ class RecipetoolTests(RecipetoolBase):
                          '    install -d ${D}${base_bindir}\n',
                          '    install -m 0755 ${WORKDIR}/%s ${D}${base_bindir}/ls\n' % testfile2name,
                          '}\n']
-        self._try_recipetool_appendfile('coreutils', '/bin/ls', testfile2, '-r coreutils', expectedlines, [testfile2name])
+        self._try_recipetool_appendfile(testrecipe, append_file, testfile2,
+                                        '-r %s' % testrecipe, expectedlines,
+                                        [testfile2name])
         # Now try bbappending the same file again, contents should not change
-        bbappendfile, _ = self._try_recipetool_appendfile('coreutils', '/bin/ls', self.testfile, '-r coreutils', expectedlines, [testfile2name])
+        bbappendfile, _ = self._try_recipetool_appendfile(
+                        testrecipe, append_file, self.testfile,
+                        '-r %s' % testrecipe, expectedlines, [testfile2name])
         # But file should have
-        copiedfile = os.path.join(os.path.dirname(bbappendfile), 'coreutils', testfile2name)
+        copiedfile = os.path.join(
+                   os.path.dirname(bbappendfile), testrecipe, testfile2name)
         result = runCmd('diff -q %s %s' % (testfile2, copiedfile), ignore_status=True)
         self.assertNotEqual(result.status, 0, 'New file should have been copied but was not %s' % result.output)
 
     @testcase(1178)
     def test_recipetool_appendfile_binary(self):
+        # Test configuration is taken from conf file
+        append_file = self.config.get(
+                'RecipetoolTests', 'recipetool_appendfile_binary_append_file')
+        testrecipe = self.config.get(
+                'RecipetoolTests', 'recipetool_appendfile_binary_testrecipe')
         # Try appending a binary file
         # /bin/ls can be a symlink to /usr/bin/ls
-        ls = os.path.realpath("/bin/ls")
-        result = runCmd('recipetool appendfile %s /bin/ls %s -r coreutils' % (self.templayerdir, ls))
+        ls = os.path.realpath(append_file)
+        result = runCmd('recipetool appendfile %s %s %s -r %s'
+                        % (self.templayerdir, append_file, ls, testrecipe))
         self.assertIn('WARNING: ', result.output)
         self.assertIn('is a binary', result.output)
 
     @testcase(1173)
     def test_recipetool_appendfile_add(self):
+        # Test configuration is taken from conf file
+        append_file = self.config.get(
+                    'RecipetoolTests', 'recipetool_appendfile_add_append_file')
+        testfile_2 = self.config.get(
+                   'RecipetoolTests', 'recipetool_appendfile_add_testfile_2')
         corebase = get_bb_var('COREBASE')
         # Try arbitrary file add to a recipe
         expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n',
@@ -149,10 +197,12 @@ class RecipetoolTests(RecipetoolBase):
                          '    install -d ${D}${datadir}\n',
                          '    install -m 0644 ${WORKDIR}/testfile ${D}${datadir}/something\n',
                          '}\n']
-        self._try_recipetool_appendfile('netbase', '/usr/share/something', self.testfile, '-r netbase', expectedlines, ['testfile'])
+        self._try_recipetool_appendfile(append_file, '/usr/share/something',
+                                        self.testfile, '-r %s' % append_file,
+                                        expectedlines, ['testfile'])
         # Try adding another file, this time where the source file is executable
         # (so we're testing that, plus modifying an existing bbappend)
-        testfile2 = os.path.join(corebase, 'oe-init-build-env')
+        testfile2 = os.path.join(corebase, testfile_2)
         testfile2name = os.path.basename(testfile2)
         expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n',
                          '\n',
@@ -165,10 +215,14 @@ class RecipetoolTests(RecipetoolBase):
                          '    install -m 0644 ${WORKDIR}/testfile ${D}${datadir}/something\n',
                          '    install -m 0755 ${WORKDIR}/%s ${D}${datadir}/scriptname\n' % testfile2name,
                          '}\n']
-        self._try_recipetool_appendfile('netbase', '/usr/share/scriptname', testfile2, '-r netbase', expectedlines, ['testfile', testfile2name])
+        self._try_recipetool_appendfile(
+            append_file, '/usr/share/scriptname', testfile2,
+            '-r %s' % append_file, expectedlines, ['testfile', testfile2name])
 
     @testcase(1174)
     def test_recipetool_appendfile_add_bindir(self):
+        append_file = self.config.get(
+            'RecipetoolTests', 'recipetool_appendfile_add_bindir_append_file')
         # Try arbitrary file add to a recipe, this time to a location such that should be installed as executable
         expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n',
                          '\n',
@@ -178,11 +232,16 @@ class RecipetoolTests(RecipetoolBase):
                          '    install -d ${D}${bindir}\n',
                          '    install -m 0755 ${WORKDIR}/testfile ${D}${bindir}/selftest-recipetool-testbin\n',
                          '}\n']
-        _, output = self._try_recipetool_appendfile('netbase', '/usr/bin/selftest-recipetool-testbin', self.testfile, '-r netbase', expectedlines, ['testfile'])
+        _, output = self._try_recipetool_appendfile(
+                  append_file, '/usr/bin/selftest-recipetool-testbin',
+                  self.testfile, '-r %s' % append_file,
+                  expectedlines, ['testfile'])
         self.assertNotIn('WARNING: ', output)
 
     @testcase(1175)
     def test_recipetool_appendfile_add_machine(self):
+        append_file = self.config.get(
+                    'RecipetoolTests', 'recipetool_appendfile_add_append_file')
         # Try arbitrary file add to a recipe, this time to a location such that should be installed as executable
         expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n',
                          '\n',
@@ -194,7 +253,10 @@ class RecipetoolTests(RecipetoolBase):
                          '    install -d ${D}${datadir}\n',
                          '    install -m 0644 ${WORKDIR}/testfile ${D}${datadir}/something\n',
                          '}\n']
-        _, output = self._try_recipetool_appendfile('netbase', '/usr/share/something', self.testfile, '-r netbase -m mymachine', expectedlines, ['mymachine/testfile'])
+        _, output = self._try_recipetool_appendfile(
+                  append_file, '/usr/share/something', self.testfile,
+                  '-r %s -m mymachine' % append_file, expectedlines,
+                  ['mymachine/testfile'])
         self.assertNotIn('WARNING: ', output)
 
     @testcase(1184)
@@ -355,8 +417,10 @@ class RecipetoolTests(RecipetoolBase):
             runCmd('rm -rf %s/recipes-*' % self.templayerdir)
             return bbappendfile
 
+        recipe = self.config.get(
+               'RecipetoolTests', 'recipetool_appendfile_wildcard_recipe')
         # Check without wildcard option
-        recipefn = os.path.basename(get_bb_var('FILE', 'base-files'))
+        recipefn = os.path.basename(get_bb_var('FILE', recipe))
         filename = try_appendfile_wc('')
         self.assertEqual(filename, recipefn.replace('.bb', '.bbappend'))
         # Now check with wildcard option
@@ -365,49 +429,98 @@ class RecipetoolTests(RecipetoolBase):
 
     @testcase(1193)
     def test_recipetool_create(self):
+        # Test configuration is taken from conf file
+        recipe = self.config.get(
+               'RecipetoolTests', 'recipetool_create_recipe')
+        recipe_file = self.config.get(
+                    'RecipetoolTests', 'recipetool_create_recipe_file')
+        srcuri = self.config.get(
+               'RecipetoolTests', 'recipetool_create_srcuri')
+        license = self.config.get(
+                'RecipetoolTests', 'recipetool_create_license')
+        licfileschksum = self.config.get(
+                       'RecipetoolTests', 'recipetool_create_licfileschksum')
+        src_uri = self.config.get(
+                'RecipetoolTests', 'recipetool_create_src_uri')
+        srcuri_md5sum = self.config.get(
+                      'RecipetoolTests', 'recipetool_create_srcuri_md5sum')
+        srcuri_sha256sum = self.config.get(
+                    'RecipetoolTests', 'recipetool_create_srcuri_sha256sum')
         # Try adding a recipe
-        tempsrc = os.path.join(self.tempdir, 'srctree')
+        tempsrc = os.path.join(self.tempdir, recipe)
         os.makedirs(tempsrc)
-        recipefile = os.path.join(self.tempdir, 'logrotate_3.8.7.bb')
-        srcuri = 'https://fedorahosted.org/releases/l/o/logrotate/logrotate-3.8.7.tar.gz'
+        recipefile = os.path.join(self.tempdir, recipe_file)
         result = runCmd('recipetool create -o %s %s -x %s' % (recipefile, srcuri, tempsrc))
         self.assertTrue(os.path.isfile(recipefile))
         checkvars = {}
-        checkvars['LICENSE'] = 'GPLv2'
-        checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=18810669f13b87348459e611d31ab760'
-        checkvars['SRC_URI'] = 'https://fedorahosted.org/releases/l/o/logrotate/logrotate-${PV}.tar.gz'
-        checkvars['SRC_URI[md5sum]'] = '99e08503ef24c3e2e3ff74cc5f3be213'
-        checkvars['SRC_URI[sha256sum]'] = 'f6ba691f40e30e640efa2752c1f9499a3f9738257660994de70a45fe00d12b64'
+        checkvars['LICENSE'] = license
+        checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=%s' % licfileschksum
+        checkvars['SRC_URI'] = src_uri
+        checkvars['SRC_URI[md5sum]'] = srcuri_md5sum
+        checkvars['SRC_URI[sha256sum]'] = srcuri_sha256sum
         self._test_recipe_contents(recipefile, checkvars, [])
 
     @testcase(1194)
     def test_recipetool_create_git(self):
+        # Test configuration is taken from conf file
+        recipes = eval(self.config.get(
+                        'RecipetoolTests', 'recipetool_create_git_recipes'))
+        recipe_1 = self.config.get(
+                 'RecipetoolTests', 'recipetool_create_git_recipe_1')
+        srcuri = self.config.get(
+               'RecipetoolTests', 'recipetool_create_git_srcuri')
+        rev = self.config.get(
+               'RecipetoolTests', 'recipetool_create_git_rev')
+        recipe_file = self.config.get(
+                    'RecipetoolTests', 'recipetool_create_git_recipe_file')
+        license = self.config.get(
+                'RecipetoolTests', 'recipetool_create_git_license')
+        licfileschksum = self.config.get(
+                    'RecipetoolTests', 'recipetool_create_git_licfileschksum')
+        pv = self.config.get('RecipetoolTests', 'recipetool_create_git_pv')
+        set_depends = eval(self.config.get(
+                      'RecipetoolTests', 'recipetool_create_git_set_depends'))
+        inherit_1 = self.config.get(
+                  'RecipetoolTests', 'recipetool_create_git_inherit_1')
+        inherit_2 = self.config.get(
+                  'RecipetoolTests', 'recipetool_create_git_inherit_2')
         # Ensure we have the right data in shlibs/pkgdata
-        bitbake('libpng pango libx11 libxext jpeg libcheck')
+        bitbake(recipes)
         # Try adding a recipe
-        tempsrc = os.path.join(self.tempdir, 'srctree')
+        tempsrc = os.path.join(self.tempdir, recipe_1)
         os.makedirs(tempsrc)
-        recipefile = os.path.join(self.tempdir, 'libmatchbox.bb')
-        srcuri = 'git://git.yoctoproject.org/libmatchbox'
-        result = runCmd(['recipetool', 'create', '-o', recipefile, srcuri + ";rev=9f7cf8895ae2d39c465c04cc78e918c157420269", '-x', tempsrc])
+        recipefile = os.path.join(self.tempdir, recipe_file)
+        result = runCmd(['recipetool', 'create', '-o', recipefile, srcuri +
+                         ";rev=%s" % rev, '-x', tempsrc])
         self.assertTrue(os.path.isfile(recipefile), 'recipetool did not create recipe file; output:\n%s' % result.output)
         checkvars = {}
-        checkvars['LICENSE'] = 'LGPLv2.1'
-        checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34'
+        checkvars['LICENSE'] = license
+        checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=%s' % licfileschksum
         checkvars['S'] = '${WORKDIR}/git'
-        checkvars['PV'] = '1.11+git${SRCPV}'
+        checkvars['PV'] = '%s+git${SRCPV}' % pv
         checkvars['SRC_URI'] = srcuri
-        checkvars['DEPENDS'] = set(['libcheck', 'libjpeg-turbo', 'libpng', 'libx11', 'libxext', 'pango'])
-        inherits = ['autotools', 'pkgconfig']
+        checkvars['DEPENDS'] = set(set_depends)
+        inherits = [inherit_1, inherit_2]
         self._test_recipe_contents(recipefile, checkvars, inherits)
 
     @testcase(1392)
     def test_recipetool_create_simple(self):
+        # Test configuration is taken from conf file
+        recipe = self.config.get(
+               'RecipetoolTests', 'recipetool_create_simple_recipe')
+        pv = self.config.get('RecipetoolTests', 'recipetool_create_simple_pv')
+        srcuri = self.config.get(
+               'RecipetoolTests', 'recipetool_create_simple_srcuri')
+        set_license = eval(self.config.get(
+                    'RecipetoolTests', 'recipetool_create_simple_set_license'))
+        set_fileschksum = eval(self.config.get(
+                'RecipetoolTests', 'recipetool_create_simple_set_fileschksum'))
+        s = self.config.get('RecipetoolTests', 'recipetool_create_simple_s')
+        inherits = self.config.get(
+                 'RecipetoolTests', 'recipetool_create_simple_inherits')
         # Try adding a recipe
-        temprecipe = os.path.join(self.tempdir, 'recipe')
+        temprecipe = os.path.join(self.tempdir, recipe)
         os.makedirs(temprecipe)
-        pv = '1.7.3.0'
-        srcuri = 'http://www.dest-unreach.org/socat/download/socat-%s.tar.bz2' % pv
         result = runCmd('recipetool create %s -o %s' % (srcuri, temprecipe))
         dirlist = os.listdir(temprecipe)
         if len(dirlist) > 1:
@@ -416,73 +529,117 @@ class RecipetoolTests(RecipetoolBase):
             self.fail('recipetool did not create recipe file; output:\n%s\ndirlist:\n%s' % (result.output, str(dirlist)))
         self.assertEqual(dirlist[0], 'socat_%s.bb' % pv, 'Recipe file incorrectly named')
         checkvars = {}
-        checkvars['LICENSE'] = set(['Unknown', 'GPLv2'])
-        checkvars['LIC_FILES_CHKSUM'] = set(['file://COPYING.OpenSSL;md5=5c9bccc77f67a8328ef4ebaf468116f4', 'file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263'])
+        checkvars['LICENSE'] = set(set_license)
+        checkvars['LIC_FILES_CHKSUM'] = set(set_fileschksum)
         # We don't check DEPENDS since they are variable for this recipe depending on what's in the sysroot
         checkvars['S'] = None
         checkvars['SRC_URI'] = srcuri.replace(pv, '${PV}')
-        inherits = ['autotools']
+        inherits = [inherits]
         self._test_recipe_contents(os.path.join(temprecipe, dirlist[0]), checkvars, inherits)
 
     @testcase(1418)
     def test_recipetool_create_cmake(self):
+        # Test configuration is taken from conf file
+        recipe = self.config.get(
+               'RecipetoolTests', 'recipetool_create_cmake_recipe')
+        recipe_file = self.config.get(
+                    'RecipetoolTests', 'recipetool_create_cmake_recipe_file')
+        srcuri = self.config.get(
+               'RecipetoolTests', 'recipetool_create_cmake_srcuri')
+        set_license = eval(self.config.get(
+                    'RecipetoolTests', 'recipetool_create_cmake_set_license'))
+        src_uri = self.config.get(
+                'RecipetoolTests', 'recipetool_create_cmake_src_uri')
+        md5sum = self.config.get(
+               'RecipetoolTests', 'recipetool_create_cmake_md5sum')
+        sha256sum = self.config.get(
+                  'RecipetoolTests', 'recipetool_create_cmake_sha256sum')
+        set_depends = eval(self.config.get(
+                    'RecipetoolTests', 'recipetool_create_cmake_set_depends'))
+        inherits_recipes = eval(self.config.get(
+                'RecipetoolTests', 'recipetool_create_cmake_inherits_recipes'))
         # Try adding a recipe
-        temprecipe = os.path.join(self.tempdir, 'recipe')
+        temprecipe = os.path.join(self.tempdir, recipe)
         os.makedirs(temprecipe)
-        recipefile = os.path.join(temprecipe, 'navit_0.5.0.bb')
-        srcuri = 'http://downloads.sourceforge.net/project/navit/v0.5.0/navit-0.5.0.tar.gz'
+        recipefile = os.path.join(temprecipe, recipe_file)
         result = runCmd('recipetool create -o %s %s' % (temprecipe, srcuri))
         self.assertTrue(os.path.isfile(recipefile))
         checkvars = {}
-        checkvars['LICENSE'] = set(['Unknown', 'GPLv2', 'LGPLv2'])
-        checkvars['SRC_URI'] = 'http://downloads.sourceforge.net/project/navit/v${PV}/navit-${PV}.tar.gz'
-        checkvars['SRC_URI[md5sum]'] = '242f398e979a6b8c0f3c802b63435b68'
-        checkvars['SRC_URI[sha256sum]'] = '13353481d7fc01a4f64e385dda460b51496366bba0fd2cc85a89a0747910e94d'
-        checkvars['DEPENDS'] = set(['freetype', 'zlib', 'openssl', 'glib-2.0', 'virtual/libgl', 'virtual/egl', 'gtk+', 'libpng', 'libsdl', 'freeglut', 'dbus-glib'])
-        inherits = ['cmake', 'python-dir', 'gettext', 'pkgconfig']
+        checkvars['LICENSE'] = set(set_license)
+        checkvars['SRC_URI'] = src_uri
+        checkvars['SRC_URI[md5sum]'] = md5sum
+        checkvars['SRC_URI[sha256sum]'] = sha256sum
+        checkvars['DEPENDS'] = set(set_depends)
+        inherits = inherits_recipes
         self._test_recipe_contents(recipefile, checkvars, inherits)
 
     def test_recipetool_create_github(self):
+        recipe_file = self.config.get(
+                    'RecipetoolTests', 'recipetool_create_github_recipe_file')
+        srcuri = self.config.get(
+               'RecipetoolTests', 'recipetool_create_github_srcuri')
+        license = self.config.get(
+                'RecipetoolTests', 'recipetool_create_github_license')
+        git_srcuri = self.config.get(
+                   'RecipetoolTests', 'recipetool_create_github_git_srcuri')
+        inherits = eval(self.config.get(
+                 'RecipetoolTests', 'recipetool_create_github_inherits'))
         # Basic test to see if github URL mangling works
         temprecipe = os.path.join(self.tempdir, 'recipe')
         os.makedirs(temprecipe)
-        recipefile = os.path.join(temprecipe, 'meson_git.bb')
-        srcuri = 'https://github.com/mesonbuild/meson'
+        recipefile = os.path.join(temprecipe, recipe_file)
         result = runCmd('recipetool create -o %s %s' % (temprecipe, srcuri))
         self.assertTrue(os.path.isfile(recipefile))
         checkvars = {}
-        checkvars['LICENSE'] = set(['Apache-2.0'])
-        checkvars['SRC_URI'] = 'git://github.com/mesonbuild/meson;protocol=https'
-        inherits = ['setuptools']
+        checkvars['LICENSE'] = set([license])
+        checkvars['SRC_URI'] = git_srcuri
         self._test_recipe_contents(recipefile, checkvars, inherits)
 
     def test_recipetool_create_github_tarball(self):
         # Basic test to ensure github URL mangling doesn't apply to release tarballs
         temprecipe = os.path.join(self.tempdir, 'recipe')
         os.makedirs(temprecipe)
-        pv = '0.32.0'
-        recipefile = os.path.join(temprecipe, 'meson_%s.bb' % pv)
-        srcuri = 'https://github.com/mesonbuild/meson/releases/download/%s/meson-%s.tar.gz' % (pv, pv)
+        pv = self.config.get(
+           'RecipetoolTests', 'recipetool_create_github_tarball_pv')
+        recipe_file = self.config.get(
+             'RecipetoolTests', 'recipetool_create_github_tarball_recipe_file')
+        src_uri = self.config.get(
+               'RecipetoolTests', 'recipetool_create_github_tarball_srcuri')
+        inherits = self.config.get(
+                'RecipetoolTests', 'recipetool_create_github_tarball_inherits')
+        license = self.config.get(
+                'RecipetoolTests', 'recipetool_create_github_tarball_license')
+        recipefile = os.path.join(temprecipe, '%s_%s.bb' % (recipe_file, pv))
+        srcuri = '%s%s/%s-%s.tar.gz' % (src_uri, pv, recipe_file, pv)
         result = runCmd('recipetool create -o %s %s' % (temprecipe, srcuri))
         self.assertTrue(os.path.isfile(recipefile))
         checkvars = {}
-        checkvars['LICENSE'] = set(['Apache-2.0'])
-        checkvars['SRC_URI'] = 'https://github.com/mesonbuild/meson/releases/download/${PV}/meson-${PV}.tar.gz'
-        inherits = ['setuptools']
+        checkvars['LICENSE'] = set([license])
+        checkvars['SRC_URI'] = '%s${PV}/%s-${PV}.tar.gz' % (src_uri,
+                                                            recipe_file)
+        inherits = [inherits]
         self._test_recipe_contents(recipefile, checkvars, inherits)
 
     def test_recipetool_create_git_http(self):
+        recipe_file = self.config.get(
+                   'RecipetoolTests', 'recipetool_create_git_http_recipe_file')
+        srcuri = self.config.get(
+               'RecipetoolTests', 'recipetool_create_git_http_srcuri')
+        git_srcuri = self.config.get(
+                   'RecipetoolTests', 'recipetool_create_git_http_git_srcuri')
+        license = self.config.get(
+                'RecipetoolTests', 'recipetool_create_git_http_license')
+        inherits = eval(self.config.get('RecipetoolTests',
+                                        'recipetool_create_git_http_inherits'))
         # Basic test to check http git URL mangling works
         temprecipe = os.path.join(self.tempdir, 'recipe')
         os.makedirs(temprecipe)
-        recipefile = os.path.join(temprecipe, 'matchbox-terminal_git.bb')
-        srcuri = 'http://git.yoctoproject.org/git/matchbox-terminal'
+        recipefile = os.path.join(temprecipe, recipe_file)
         result = runCmd('recipetool create -o %s %s' % (temprecipe, srcuri))
         self.assertTrue(os.path.isfile(recipefile))
         checkvars = {}
-        checkvars['LICENSE'] = set(['GPLv2'])
-        checkvars['SRC_URI'] = 'git://git.yoctoproject.org/git/matchbox-terminal;protocol=http'
-        inherits = ['pkgconfig', 'autotools']
+        checkvars['LICENSE'] = set([license])
+        checkvars['SRC_URI'] = git_srcuri
         self._test_recipe_contents(recipefile, checkvars, inherits)
 
 class RecipetoolAppendsrcBase(RecipetoolBase):
@@ -576,44 +733,57 @@ class RecipetoolAppendsrcBase(RecipetoolBase):
 
 class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase):
 
+    @classmethod
+    def setUpClass(cls):
+        # Get test configurations from configuration file
+        cls.config = conffile(__file__)
+        cls.base_files = cls.config.get(
+            'RecipetoolAppendsrcTests', 'recipetool_appendsrcfile_base_files')
+        cls.file_1 = cls.config.get(
+                'RecipetoolAppendsrcTests', 'recipetool_appendsrcfile_file_1')
+        cls.recipe = cls.config.get(
+                'RecipetoolAppendsrcTests', 'recipetool_appendsrcfile_recipe')
+        cls.filepath = cls.config.get(
+            'RecipetoolAppendsrcTests', 'recipetool_appendsrcfile_filepath')
+
     @testcase(1273)
     def test_recipetool_appendsrcfile_basic(self):
-        self._test_appendsrcfile('base-files', 'a-file')
+        self._test_appendsrcfile(self.base_files, self.file_1)
 
     @testcase(1274)
     def test_recipetool_appendsrcfile_basic_wildcard(self):
-        testrecipe = 'base-files'
-        self._test_appendsrcfile(testrecipe, 'a-file', options='-w')
+        testrecipe = self.base_files
+        self._test_appendsrcfile(testrecipe, self.file_1, options='-w')
         recipefile = get_bb_var('FILE', testrecipe)
         bbappendfile = self._check_bbappend(testrecipe, recipefile, self.templayerdir)
         self.assertEqual(os.path.basename(bbappendfile), '%s_%%.bbappend' % testrecipe)
 
     @testcase(1281)
     def test_recipetool_appendsrcfile_subdir_basic(self):
-        self._test_appendsrcfile('base-files', 'a-file', 'tmp')
+        self._test_appendsrcfile(self.base_files, self.file_1, 'tmp')
 
     @testcase(1282)
     def test_recipetool_appendsrcfile_subdir_basic_dirdest(self):
-        self._test_appendsrcfile('base-files', destdir='tmp')
+        self._test_appendsrcfile(self.base_files, destdir='tmp')
 
     @testcase(1280)
     def test_recipetool_appendsrcfile_srcdir_basic(self):
-        testrecipe = 'bash'
+        testrecipe = self.recipe
         srcdir = get_bb_var('S', testrecipe)
         workdir = get_bb_var('WORKDIR', testrecipe)
         subdir = os.path.relpath(srcdir, workdir)
-        self._test_appendsrcfile(testrecipe, 'a-file', srcdir=subdir)
+        self._test_appendsrcfile(testrecipe, self.file_1, srcdir=subdir)
 
     @testcase(1275)
     def test_recipetool_appendsrcfile_existing_in_src_uri(self):
-        testrecipe = 'base-files'
+        testrecipe = self.base_files
         filepath = self._get_first_file_uri(testrecipe)
         self.assertTrue(filepath, 'Unable to test, no file:// uri found in SRC_URI for %s' % testrecipe)
         self._test_appendsrcfile(testrecipe, filepath, has_src_uri=False)
 
     @testcase(1276)
     def test_recipetool_appendsrcfile_existing_in_src_uri_diff_params(self):
-        testrecipe = 'base-files'
+        testrecipe = self.base_files
         subdir = 'tmp'
         filepath = self._get_first_file_uri(testrecipe)
         self.assertTrue(filepath, 'Unable to test, no file:// uri found in SRC_URI for %s' % testrecipe)
@@ -623,8 +793,8 @@ class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase):
 
     @testcase(1277)
     def test_recipetool_appendsrcfile_replace_file_srcdir(self):
-        testrecipe = 'bash'
-        filepath = 'Makefile.in'
+        testrecipe = self.recipe
+        filepath = self.filepath
         srcdir = get_bb_var('S', testrecipe)
         workdir = get_bb_var('WORKDIR', testrecipe)
         subdir = os.path.relpath(srcdir, workdir)
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 16/20] oeqa.selftest.runtime-test: Split configuration from code
  2016-08-08 16:22 [PATCH 00/20] oeqa: Split configuration from the code Jose Lamego
                   ` (14 preceding siblings ...)
  2016-08-08 16:23 ` [PATCH 15/20] oeqa.selftest.recipetool: " Jose Lamego
@ 2016-08-08 16:23 ` Jose Lamego
  2016-08-08 16:23 ` [PATCH 17/20] oeqa.selftest.signing: " Jose Lamego
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Jose Lamego @ 2016-08-08 16:23 UTC (permalink / raw)
  To: openembedded-core

Improve oeqa-selftest capabilities and UX by placing
test configuration features and variables into a separate
configuration file.

[Yocto 9389]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 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

diff --git a/meta/lib/oeqa/selftest/conf/runtime-test.conf b/meta/lib/oeqa/selftest/conf/runtime-test.conf
new file mode 100644
index 0000000..6c331ba
--- /dev/null
+++ b/meta/lib/oeqa/selftest/conf/runtime-test.conf
@@ -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
diff --git a/meta/lib/oeqa/selftest/runtime-test.py b/meta/lib/oeqa/selftest/runtime-test.py
index c2d5b45..627716d 100644
--- a/meta/lib/oeqa/selftest/runtime-test.py
+++ b/meta/lib/oeqa/selftest/runtime-test.py
@@ -2,9 +2,18 @@ from oeqa.selftest.base import oeSelfTest
 from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu
 from oeqa.utils.decorators import testcase
 import os
+from oeqa.utils.readconfig import conffile
+
 
 class TestExport(oeSelfTest):
 
+    @classmethod
+    def setUpClass(cls):
+        # Get test configurations from configuration file
+        cls.config = conffile(__file__)
+        cls.features = cls.config.get('TestExport', 'setUpClass_features')
+        cls.image = cls.config.get('TestExport', 'setUpClass_image')
+
     def test_testexport_basic(self):
         """
         Summary: Check basic testexport functionality with only ping test enabled.
@@ -15,23 +24,18 @@ class TestExport(oeSelfTest):
         Author: Mariano Lopez <mariano.lopez@intel.com>
         """
 
-        features = 'INHERIT += "testexport"\n'
-        # These aren't the actual IP addresses but testexport class needs something defined
-        features += 'TEST_SERVER_IP = "192.168.7.1"\n'
-        features += 'TEST_TARGET_IP = "192.168.7.1"\n'
-        features += 'TEST_SUITES = "ping"\n'
-        self.write_config(features)
+        self.write_config(self.features)
 
         # Build tesexport for core-image-minimal
-        bitbake('core-image-minimal')
-        bitbake('-c testexport core-image-minimal')
+        bitbake(self.image)
+        bitbake('-c testexport %s' % self.image)
 
         # Verify if TEST_EXPORT_DIR was created
-        testexport_dir = get_bb_var('TEST_EXPORT_DIR', 'core-image-minimal')
+        testexport_dir = get_bb_var('TEST_EXPORT_DIR', self.image)
         isdir = os.path.isdir(testexport_dir)
         self.assertEqual(True, isdir, 'Failed to create testexport dir: %s' % testexport_dir)
 
-        with runqemu('core-image-minimal') as qemu:
+        with runqemu(self.image) as qemu:
             # Attempt to run runexported.py to perform ping test
             runexported_path = os.path.join(testexport_dir, "runexported.py")
             testdata_path = os.path.join(testexport_dir, "testdata.json")
@@ -43,49 +47,16 @@ class TestExport(oeSelfTest):
             failure = True if 'FAIL' in result.output else False
             self.assertNotEqual(True, failure, 'ping test failed')
 
-    def test_testexport_sdk(self):
-        """
-        Summary: Check sdk functionality for testexport.
-        Expected: 1. testexport directory must be created.
-                  2. SDK tarball must exists.
-                  3. Uncompressing of tarball must succeed.
-                  4. Check if the SDK directory is added to PATH.
-                  5. Run tar from the SDK directory.
-        Product: oe-core
-        Author: Mariano Lopez <mariano.lopez@intel.com>
-        """
-
-        features = 'INHERIT += "testexport"\n'
-        # These aren't the actual IP addresses but testexport class needs something defined
-        features += 'TEST_SERVER_IP = "192.168.7.1"\n'
-        features += 'TEST_TARGET_IP = "192.168.7.1"\n'
-        features += 'TEST_SUITES = "ping"\n'
-        features += 'TEST_SUITES_TAGS = "selftest_sdk"\n'
-        features += 'TEST_EXPORT_SDK_ENABLED = "1"\n'
-        features += 'TEST_EXPORT_SDK_PACKAGES = "nativesdk-tar"\n'
-        self.write_config(features)
-
-        # Build tesexport for core-image-minimal
-        bitbake('core-image-minimal')
-        bitbake('-c testexport core-image-minimal')
-
-        # Check for SDK
-        testexport_dir = get_bb_var('TEST_EXPORT_DIR', 'core-image-minimal')
-        sdk_dir = get_bb_var('TEST_EXPORT_SDK_DIR', 'core-image-minimal')
-        tarball_name = "%s.sh" % get_bb_var('TEST_EXPORT_SDK_NAME', 'core-image-minimal')
-        tarball_path = os.path.join(testexport_dir, sdk_dir, tarball_name)
-        self.assertEqual(os.path.isfile(tarball_path), True, "Couldn't find SDK tarball: %s" % tarball_path)
-
-        # Run runexported.py
-        runexported_path = os.path.join(testexport_dir, "runexported.py")
-        testdata_path = os.path.join(testexport_dir, "testdata.json")
-        cmd = "%s %s" % (runexported_path, testdata_path)
-        result = runCmd(cmd)
-        self.assertEqual(0, result.status, 'runexported.py returned a non 0 status')
-
 
 class TestImage(oeSelfTest):
 
+    @classmethod
+    def setUpClass(cls):
+        # Get test configurations from configuration file
+        cls.config = conffile(__file__)
+        cls.features = cls.config.get('TestImage', 'setUpClass_features')
+        cls.image = cls.config.get('TestImage', 'setUpClass_image')
+
     def test_testimage_install(self):
         """
         Summary: Check install packages functionality for testimage/testexport.
@@ -95,11 +66,8 @@ class TestImage(oeSelfTest):
         Author: Mariano Lopez <mariano.lopez@intel.com>
         """
 
-        features = 'INHERIT += "testimage"\n'
-        features += 'TEST_SUITES = "ping ssh selftest"\n'
-        features += 'TEST_SUITES_TAGS = "selftest_package_install"\n'
-        self.write_config(features)
+        self.write_config(self.features)
 
         # Build core-image-sato and testimage
-        bitbake('core-image-full-cmdline socat')
-        bitbake('-c testimage core-image-full-cmdline')
+        bitbake('%s socat' % self.image)
+        bitbake('-c testimage %s' % self.image)
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 17/20] oeqa.selftest.signing: Split configuration from code
  2016-08-08 16:22 [PATCH 00/20] oeqa: Split configuration from the code Jose Lamego
                   ` (15 preceding siblings ...)
  2016-08-08 16:23 ` [PATCH 16/20] oeqa.selftest.runtime-test: " Jose Lamego
@ 2016-08-08 16:23 ` Jose Lamego
  2016-08-08 16:23 ` [PATCH 18/20] oeqa.selftest.sstatetests: " Jose Lamego
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Jose Lamego @ 2016-08-08 16:23 UTC (permalink / raw)
  To: openembedded-core

Improve oeqa-selftest capabilities and UX by placing
test configuration features and variables into a separate
configuration file.

[Yocto 9389]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 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

diff --git a/meta/lib/oeqa/selftest/conf/signing.conf b/meta/lib/oeqa/selftest/conf/signing.conf
new file mode 100644
index 0000000..c95d247
--- /dev/null
+++ b/meta/lib/oeqa/selftest/conf/signing.conf
@@ -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
diff --git a/meta/lib/oeqa/selftest/signing.py b/meta/lib/oeqa/selftest/signing.py
index 4c12d6d..8ce45c3 100644
--- a/meta/lib/oeqa/selftest/signing.py
+++ b/meta/lib/oeqa/selftest/signing.py
@@ -7,13 +7,12 @@ import shutil
 import tempfile
 from oeqa.utils.decorators import testcase
 from oeqa.utils.ftools import write_file
+from oeqa.utils.readconfig import conffile
 
 
 class Signing(oeSelfTest):
 
     gpg_dir = ""
-    pub_key_path = ""
-    secret_key_path = ""
 
     @classmethod
     def setUpClass(cls):
@@ -21,11 +20,19 @@ class Signing(oeSelfTest):
         if not shutil.which("gpg"):
             raise AssertionError("This test needs GnuPG")
 
-        cls.gpg_home_dir = tempfile.TemporaryDirectory(prefix="oeqa-signing-")
+        cls.config = conffile(__file__)
+        prefix = cls.config.get('Signing', 'setUpClass_prefix')
+        pub_keyname = cls.config.get('Signing', 'setUpClass_pub_keyname')
+        secret_keyname = cls.config.get('Signing', 'setUpClass_secret_keyname')
+        cls.test_recipe = cls.config.get('Signing', 'setUpClass_test_recipe')
+        cls.passphrase = cls.config.get('Signing', 'setUpClass_passphrase')
+        cls.gpg_home_dir = tempfile.TemporaryDirectory(prefix)
         cls.gpg_dir = cls.gpg_home_dir.name
 
-        cls.pub_key_path = os.path.join(cls.testlayer_path, 'files', 'signing', "key.pub")
-        cls.secret_key_path = os.path.join(cls.testlayer_path, 'files', 'signing', "key.secret")
+        cls.pub_key_path = os.path.join(cls.testlayer_path, 'files', 'signing',
+                                        pub_keyname)
+        cls.secret_key_path = os.path.join(cls.testlayer_path, 'files',
+                                           'signing', secret_keyname)
 
         runCmd('gpg --homedir %s --import %s %s' % (cls.gpg_dir, cls.pub_key_path, cls.secret_key_path))
 
@@ -40,32 +47,36 @@ class Signing(oeSelfTest):
         """
         import oe.packagedata
 
+        # Test configuration is taken from conf file
+        inherit = self.config.get('Signing', 'signing_packages_inherit')
+        passphrase = self.config.get('Signing', 'setupClass_passphrase')
+        name = self.config.get('Signing', 'signing_packages_name')
         package_classes = get_bb_var('PACKAGE_CLASSES')
         if 'package_rpm' not in package_classes:
             self.skipTest('This test requires RPM Packaging.')
 
-        test_recipe = 'ed'
-
-        feature = 'INHERIT += "sign_rpm"\n'
-        feature += 'RPM_GPG_PASSPHRASE = "test123"\n'
-        feature += 'RPM_GPG_NAME = "testuser"\n'
+        feature = 'INHERIT += "%s"\n' % inherit
+        feature += 'RPM_GPG_PASSPHRASE = "%s"\n' % passphrase
+        feature += 'RPM_GPG_NAME = "%s"\n' % name
         feature += 'RPM_GPG_PUBKEY = "%s"\n' % self.pub_key_path
         feature += 'GPG_PATH = "%s"\n' % self.gpg_dir
 
         self.write_config(feature)
 
-        bitbake('-c cleansstate %s' % test_recipe)
-        bitbake(test_recipe)
-        self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe)
+        bitbake('-c cleansstate %s' % self.test_recipe)
+        bitbake(self.test_recipe)
+        self.add_command_to_tearDown('bitbake -c clean %s' % self.test_recipe)
 
-        pkgdatadir = get_bb_var('PKGDATA_DIR', test_recipe)
-        pkgdata = oe.packagedata.read_pkgdatafile(pkgdatadir + "/runtime/ed")
+        pkgdatadir = get_bb_var('PKGDATA_DIR', self.test_recipe)
+        pkgdata = oe.packagedata.read_pkgdatafile(pkgdatadir + "/runtime/%s"
+                                                  % self.test_recipe)
         if 'PKGE' in pkgdata:
             pf = pkgdata['PN'] + "-" + pkgdata['PKGE'] + pkgdata['PKGV'] + '-' + pkgdata['PKGR']
         else:
             pf = pkgdata['PN'] + "-" + pkgdata['PKGV'] + '-' + pkgdata['PKGR']
-        deploy_dir_rpm = get_bb_var('DEPLOY_DIR_RPM', test_recipe)
-        package_arch = get_bb_var('PACKAGE_ARCH', test_recipe).replace('-', '_')
+        deploy_dir_rpm = get_bb_var('DEPLOY_DIR_RPM', self.test_recipe)
+        package_arch = get_bb_var(
+                     'PACKAGE_ARCH', self.test_recipe).replace('-', '_')
         staging_bindir_native = get_bb_var('STAGING_BINDIR_NATIVE')
 
         pkg_deploy = os.path.join(deploy_dir_rpm, package_arch, '.'.join((pf, package_arch, 'rpm')))
@@ -92,13 +103,12 @@ class Signing(oeSelfTest):
         AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
         """
 
-        test_recipe = 'ed'
-
         builddir = os.environ.get('BUILDDIR')
         sstatedir = os.path.join(builddir, 'test-sstate')
 
-        self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe)
-        self.add_command_to_tearDown('bitbake -c cleansstate %s' % test_recipe)
+        self.add_command_to_tearDown('bitbake -c clean %s' % self.test_recipe)
+        self.add_command_to_tearDown('bitbake -c cleansstate %s'
+                                     % self.test_recipe)
         self.add_command_to_tearDown('rm -rf %s' % sstatedir)
 
         # Determine the pub key signature
@@ -108,18 +118,20 @@ class Signing(oeSelfTest):
         pub_key = pub_key.group(1)
 
         feature = 'SSTATE_SIG_KEY ?= "%s"\n' % pub_key
-        feature += 'SSTATE_SIG_PASSPHRASE ?= "test123"\n'
+        feature += 'SSTATE_SIG_PASSPHRASE ?= "%s"\n' % self.passphrase
         feature += 'SSTATE_VERIFY_SIG ?= "1"\n'
         feature += 'GPG_PATH = "%s"\n' % self.gpg_dir
         feature += 'SSTATE_DIR = "%s"\n' % sstatedir
 
         self.write_config(feature)
 
-        bitbake('-c cleansstate %s' % test_recipe)
-        bitbake(test_recipe)
+        bitbake('-c cleansstate %s' % self.test_recipe)
+        bitbake(self.test_recipe)
 
-        recipe_sig = glob.glob(sstatedir + '/*/*:ed:*_package.tgz.sig')
-        recipe_tgz = glob.glob(sstatedir + '/*/*:ed:*_package.tgz')
+        recipe_sig = glob.glob(
+                   sstatedir + '/*/*:%s:*_package.tgz.sig' % self.test_recipe)
+        recipe_tgz = glob.glob(
+                   sstatedir + '/*/*:%s:*_package.tgz' % self.test_recipe)
 
         self.assertEqual(len(recipe_sig), 1, 'Failed to find .sig file.')
         self.assertEqual(len(recipe_tgz), 1, 'Failed to find .tgz file.')
@@ -132,6 +144,21 @@ class Signing(oeSelfTest):
 
 class LockedSignatures(oeSelfTest):
 
+    @classmethod
+    def setUpClass(cls):
+        # Get test configurations from configuration file
+        cls.config = conffile(__file__)
+        cls.test_recipe = cls.config.get(
+                        'Signing', 'setupClass_test_recipe')
+        cls.locked_sigs_file = cls.config.get(
+                    'LockedSignatures', 'locked_signatures_locked_sigs_file')
+        cls.feature = cls.config.get(
+                    'LockedSignatures', 'locked_signatures_feature')
+        cls.recipe_dir = cls.config.get(
+                       'LockedSignatures', 'locked_signatures_recipe_dir')
+        cls.summary = cls.config.get(
+                    'LockedSignatures', 'locked_signatures_summary')
+
     @testcase(1420)
     def test_locked_signatures(self):
         """
@@ -142,37 +169,41 @@ class LockedSignatures(oeSelfTest):
         AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
         """
 
-        test_recipe = 'ed'
-        locked_sigs_file = 'locked-sigs.inc'
-
-        self.add_command_to_tearDown('rm -f %s' % os.path.join(self.builddir, locked_sigs_file))
+        self.add_command_to_tearDown(
+            'rm -f %s' % os.path.join(self.builddir, self.locked_sigs_file))
 
-        bitbake(test_recipe)
+        bitbake(self.test_recipe)
         # Generate locked sigs include file
-        bitbake('-S none %s' % test_recipe)
+        bitbake('-S none %s' % self.test_recipe)
 
-        feature = 'require %s\n' % locked_sigs_file
-        feature += 'SIGGEN_LOCKEDSIGS_TASKSIG_CHECK = "warn"\n'
-        self.write_config(feature)
+        self.write_config(self.feature)
 
         # Build a locked recipe
-        bitbake(test_recipe)
+        bitbake(self.test_recipe)
 
         # Make a change that should cause the locked task signature to change
-        recipe_append_file = test_recipe + '_' + get_bb_var('PV', test_recipe) + '.bbappend'
-        recipe_append_path = os.path.join(self.testlayer_path, 'recipes-test', test_recipe, recipe_append_file)
-        feature = 'SUMMARY += "test locked signature"\n'
-
-        os.mkdir(os.path.join(self.testlayer_path, 'recipes-test', test_recipe))
+        recipe_append_file = self.test_recipe + '_' + get_bb_var(
+                                        'PV', self.test_recipe) + '.bbappend'
+        recipe_append_path = os.path.join(
+                           self.testlayer_path, self.recipe_dir,
+                           self.test_recipe, recipe_append_file)
+        feature = 'SUMMARY += "%s"\n' % self.summary
+
+        os.mkdir(os.path.join(self.testlayer_path, self.recipe_dir,
+                              self.test_recipe))
         write_file(recipe_append_path, feature)
 
-        self.add_command_to_tearDown('rm -rf %s' % os.path.join(self.testlayer_path, 'recipes-test', test_recipe))
+        self.add_command_to_tearDown(
+            'rm -rf %s' % os.path.join(self.testlayer_path,
+                                       self.recipe_dir, self.test_recipe))
 
         # Build the recipe again
-        ret = bitbake(test_recipe)
+        ret = bitbake(self.test_recipe)
 
         # Verify you get the warning and that the real task *isn't* run (i.e. the locked signature has worked)
-        patt = r'WARNING: The %s:do_package sig is computed to be \S+, but the sig is locked to \S+ in SIGGEN_LOCKEDSIGS\S+' % test_recipe
+        patt = (r'WARNING: The %s:do_package sig is computed to be \S+, '
+                r'but the sig is locked to \S+ in SIGGEN_LOCKEDSIGS\S+'
+                % self.test_recipe)
         found_warn = re.search(patt, ret.output)
 
         self.assertIsNotNone(found_warn, "Didn't find the expected warning message. Output: %s" % ret.output)
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 18/20] oeqa.selftest.sstatetests: Split configuration from code
  2016-08-08 16:22 [PATCH 00/20] oeqa: Split configuration from the code Jose Lamego
                   ` (16 preceding siblings ...)
  2016-08-08 16:23 ` [PATCH 17/20] oeqa.selftest.signing: " Jose Lamego
@ 2016-08-08 16:23 ` Jose Lamego
  2016-08-08 16:23 ` [PATCH 19/20] oeqa.selftest.wic: " Jose Lamego
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 25+ messages in thread
From: Jose Lamego @ 2016-08-08 16:23 UTC (permalink / raw)
  To: openembedded-core

Improve oeqa-selftest capabilities and UX by placing
test configuration features and variables into a separate
configuration file.

[Yocto 9389]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 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

diff --git a/meta/lib/oeqa/selftest/conf/sstatetests.conf b/meta/lib/oeqa/selftest/conf/sstatetests.conf
new file mode 100644
index 0000000..23c87c4
--- /dev/null
+++ b/meta/lib/oeqa/selftest/conf/sstatetests.conf
@@ -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
+
diff --git a/meta/lib/oeqa/selftest/sstatetests.py b/meta/lib/oeqa/selftest/sstatetests.py
index 07212ac..814c6d0 100644
--- a/meta/lib/oeqa/selftest/sstatetests.py
+++ b/meta/lib/oeqa/selftest/sstatetests.py
@@ -11,9 +11,29 @@ 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.decorators import testcase
+from oeqa.utils.readconfig import conffile
+
 
 class SStateTests(SStateBase):
 
+    @classmethod
+    def setUpClass(cls):
+        # Get test configurations from configuration file
+        cls.config = conffile(__file__)
+        cls.prefix = cls.config.get('SStateTests', 'setUpClass_prefix')
+        cls.recipe1 = cls.config.get('SStateTests', 'setUpClass_recipe1')
+        cls.recipe2 = cls.config.get('SStateTests', 'setUpClass_recipe2')
+        cls.recipe3 = cls.config.get('SStateTests', 'setUpClass_recipe3')
+        cls.recipe4 = cls.config.get('SStateTests', 'setUpClass_recipe4')
+        cls.recipe5 = cls.config.get('SStateTests', 'setUpClass_recipe5')
+        cls.recipe6 = cls.config.get('SStateTests', 'setUpClass_recipe6')
+        cls.pattern = cls.config.get('SStateTests', 'setUpClass_pattern')
+        cls.machine1 = cls.config.get('SStateTests', 'setUpClass_machine1')
+        cls.machine2 = cls.config.get('SStateTests', 'setUpClass_machine2')
+        cls.machine3 = cls.config.get('SStateTests', 'setUpClass_machine3')
+        cls.machine4 = cls.config.get('SStateTests', 'setUpClass_machine4')
+        cls.image = cls.config.get('SStateTests', 'setUpClass_image')
+
     # Test sstate files creation and their location
     def run_test_sstate_creation(self, targets, distro_specific=True, distro_nonspecific=True, temp_sstate_location=True, should_pass=True):
         self.config_sstate(temp_sstate_location)
@@ -42,20 +62,29 @@ class SStateTests(SStateBase):
     @testcase(975)
     def test_sstate_creation_distro_specific_pass(self):
         targetarch = get_bb_var('TUNE_ARCH')
-        self.run_test_sstate_creation(['binutils-cross-'+ targetarch, 'binutils-native'], distro_specific=True, distro_nonspecific=False, temp_sstate_location=True)
+        self.run_test_sstate_creation(
+            [self.prefix + targetarch, self.recipe1], distro_specific=True,
+            distro_nonspecific=False, temp_sstate_location=True)
 
     @testcase(1374)
     def test_sstate_creation_distro_specific_fail(self):
         targetarch = get_bb_var('TUNE_ARCH')
-        self.run_test_sstate_creation(['binutils-cross-'+ targetarch, 'binutils-native'], distro_specific=False, distro_nonspecific=True, temp_sstate_location=True, should_pass=False)
+        self.run_test_sstate_creation(
+            [self.prefix + targetarch, self.recipe1],
+            distro_specific=False, distro_nonspecific=True,
+            temp_sstate_location=True, should_pass=False)
 
     @testcase(976)
     def test_sstate_creation_distro_nonspecific_pass(self):
-        self.run_test_sstate_creation(['glibc-initial'], distro_specific=False, distro_nonspecific=True, temp_sstate_location=True)
+        self.run_test_sstate_creation(
+            [self.recipe2], distro_specific=False,
+            distro_nonspecific=True, temp_sstate_location=True)
 
     @testcase(1375)
     def test_sstate_creation_distro_nonspecific_fail(self):
-        self.run_test_sstate_creation(['glibc-initial'], distro_specific=True, distro_nonspecific=False, temp_sstate_location=True, should_pass=False)
+        self.run_test_sstate_creation(
+            [self.recipe2], distro_specific=True, distro_nonspecific=False,
+            temp_sstate_location=True, should_pass=False)
 
 
     # Test the sstate files deletion part of the do_cleansstate task
@@ -78,16 +107,24 @@ class SStateTests(SStateBase):
     @testcase(977)
     def test_cleansstate_task_distro_specific_nonspecific(self):
         targetarch = get_bb_var('TUNE_ARCH')
-        self.run_test_cleansstate_task(['binutils-cross-' + targetarch, 'binutils-native', 'glibc-initial'], distro_specific=True, distro_nonspecific=True, temp_sstate_location=True)
+        self.run_test_cleansstate_task(
+            [self.prefix + targetarch, self.recipe1, self.recipe2],
+            distro_specific=True, distro_nonspecific=True,
+            temp_sstate_location=True)
 
     @testcase(1376)
     def test_cleansstate_task_distro_nonspecific(self):
-        self.run_test_cleansstate_task(['glibc-initial'], distro_specific=False, distro_nonspecific=True, temp_sstate_location=True)
+        self.run_test_cleansstate_task(
+            [self.recipe2], distro_specific=False,
+            distro_nonspecific=True, temp_sstate_location=True)
 
     @testcase(1377)
     def test_cleansstate_task_distro_specific(self):
         targetarch = get_bb_var('TUNE_ARCH')
-        self.run_test_cleansstate_task(['binutils-cross-'+ targetarch, 'binutils-native', 'glibc-initial'], distro_specific=True, distro_nonspecific=False, temp_sstate_location=True)
+        self.run_test_cleansstate_task(
+            [self.prefix + targetarch, self.recipe1, self.recipe2],
+            distro_specific=True, distro_nonspecific=False,
+            temp_sstate_location=True)
 
 
     # Test rebuilding of distro-specific sstate files
@@ -125,16 +162,20 @@ class SStateTests(SStateBase):
     @testcase(175)
     def test_rebuild_distro_specific_sstate_cross_native_targets(self):
         targetarch = get_bb_var('TUNE_ARCH')
-        self.run_test_rebuild_distro_specific_sstate(['binutils-cross-' + targetarch, 'binutils-native'], temp_sstate_location=True)
+        self.run_test_rebuild_distro_specific_sstate(
+            [self.prefix + targetarch, self.recipe1],
+            temp_sstate_location=True)
 
     @testcase(1372)
     def test_rebuild_distro_specific_sstate_cross_target(self):
         targetarch = get_bb_var('TUNE_ARCH')
-        self.run_test_rebuild_distro_specific_sstate(['binutils-cross-' + targetarch], temp_sstate_location=True)
+        self.run_test_rebuild_distro_specific_sstate(
+            [self.prefix + targetarch], temp_sstate_location=True)
 
     @testcase(1373)
     def test_rebuild_distro_specific_sstate_native_target(self):
-        self.run_test_rebuild_distro_specific_sstate(['binutils-native'], temp_sstate_location=True)
+        self.run_test_rebuild_distro_specific_sstate(
+            [self.recipe1], temp_sstate_location=True)
 
 
     # Test the sstate-cache-management script. Each element in the global_config list is used with the corresponding element in the target_config list
@@ -186,7 +227,9 @@ class SStateTests(SStateBase):
         target_config = []
         global_config.append('')
         target_config.append('PR = "0"')
-        self.run_test_sstate_cache_management_script('m4', global_config,  target_config, ignore_patterns=['populate_lic'])
+        self.run_test_sstate_cache_management_script(
+            self.recipe3, global_config,  target_config,
+            ignore_patterns=[self.pattern])
 
     @testcase(978)
     def test_sstate_cache_management_script_using_pr_2(self):
@@ -196,29 +239,35 @@ class SStateTests(SStateBase):
         target_config.append('PR = "0"')
         global_config.append('')
         target_config.append('PR = "1"')
-        self.run_test_sstate_cache_management_script('m4', global_config,  target_config, ignore_patterns=['populate_lic'])
+        self.run_test_sstate_cache_management_script(
+            self.recipe3, global_config,  target_config,
+            ignore_patterns=[self.pattern])
 
     @testcase(979)
     def test_sstate_cache_management_script_using_pr_3(self):
         global_config = []
         target_config = []
-        global_config.append('MACHINE = "qemux86-64"')
+        global_config.append('MACHINE = "%s"' % self.machine1)
         target_config.append('PR = "0"')
         global_config.append(global_config[0])
         target_config.append('PR = "1"')
-        global_config.append('MACHINE = "qemux86"')
+        global_config.append('MACHINE = "%s"' % self.machine2)
         target_config.append('PR = "1"')
-        self.run_test_sstate_cache_management_script('m4', global_config,  target_config, ignore_patterns=['populate_lic'])
+        self.run_test_sstate_cache_management_script(
+            self.recipe3, global_config,  target_config,
+            ignore_patterns=[self.pattern])
 
     @testcase(974)
     def test_sstate_cache_management_script_using_machine(self):
         global_config = []
         target_config = []
-        global_config.append('MACHINE = "qemux86-64"')
+        global_config.append('MACHINE = "%s"' % self.machine1)
         target_config.append('')
-        global_config.append('MACHINE = "qemux86"')
+        global_config.append('MACHINE = "%s"' % self.machine2)
         target_config.append('')
-        self.run_test_sstate_cache_management_script('m4', global_config,  target_config, ignore_patterns=['populate_lic'])
+        self.run_test_sstate_cache_management_script(
+            self.recipe3, global_config, target_config,
+            ignore_patterns=[self.pattern])
 
     @testcase(1270)
     def test_sstate_32_64_same_hash(self):
@@ -231,29 +280,27 @@ class SStateTests(SStateBase):
 
         topdir = get_bb_var('TOPDIR')
         targetvendor = get_bb_var('TARGET_VENDOR')
-        self.write_config("""
-MACHINE = "qemux86"
-TMPDIR = "${TOPDIR}/tmp-sstatesamehash"
-BUILD_ARCH = "x86_64"
-BUILD_OS = "linux"
-SDKMACHINE = "x86_64"
-""")
+        features1 = self.config.get(
+                  'SStateTests', 'sstate_32_64_same_hash_features_1')
+        features2 = self.config.get(
+                  'SStateTests', 'sstate_32_64_same_hash_features_2')
+        arch1 = self.config.get(
+              'SStateTests', 'sstate_32_64_same_hash_arch1')
+        arch2 = self.config.get(
+              'SStateTests', 'sstate_32_64_same_hash_arch2')
+        features1 += '\nTMPDIR = \"${TOPDIR}/tmp-sstatesamehash\"'
+        self.write_config(features1)
         self.track_for_cleanup(topdir + "/tmp-sstatesamehash")
-        bitbake("core-image-sato -S none")
-        self.write_config("""
-MACHINE = "qemux86"
-TMPDIR = "${TOPDIR}/tmp-sstatesamehash2"
-BUILD_ARCH = "i686"
-BUILD_OS = "linux"
-SDKMACHINE = "i686"
-""")
+        bitbake("%s -S none" % self.image)
+        features2 += '\nTMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\"'
+        self.write_config(features2)
         self.track_for_cleanup(topdir + "/tmp-sstatesamehash2")
-        bitbake("core-image-sato -S none")
+        bitbake("%s -S none" % self.image)
 
         def get_files(d):
             f = []
             for root, dirs, files in os.walk(d):
-                if "core-image-sato" in root:
+                if self.image in root:
                     # SDKMACHINE changing will change
                     # do_rootfs/do_testimage/do_build stamps of images which
                     # is safe to ignore.
@@ -262,7 +309,14 @@ SDKMACHINE = "i686"
             return f
         files1 = get_files(topdir + "/tmp-sstatesamehash/stamps/")
         files2 = get_files(topdir + "/tmp-sstatesamehash2/stamps/")
-        files2 = [x.replace("tmp-sstatesamehash2", "tmp-sstatesamehash").replace("i686-linux", "x86_64-linux").replace("i686" + targetvendor + "-linux", "x86_64" + targetvendor + "-linux", ) for x in files2]
+        files2 = [x.replace("tmp-sstatesamehash2",
+                            "tmp-sstatesamehash").replace("%s-linux" % arch2,
+                  "%s-linux" % arch1).replace("%s" % arch2 +
+                                              targetvendor +
+                                              "-linux", "%s" % arch1 +
+                                              targetvendor +
+                                              "-linux", )
+                  for x in files2]
         self.maxDiff = None
         self.assertCountEqual(files1, files2)
 
@@ -281,13 +335,13 @@ TMPDIR = \"${TOPDIR}/tmp-sstatesamehash\"
 NATIVELSBSTRING = \"DistroA\"
 """)
         self.track_for_cleanup(topdir + "/tmp-sstatesamehash")
-        bitbake("core-image-sato -S none")
+        bitbake("%s -S none" % self.image)
         self.write_config("""
 TMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\"
 NATIVELSBSTRING = \"DistroB\"
 """)
         self.track_for_cleanup(topdir + "/tmp-sstatesamehash2")
-        bitbake("core-image-sato -S none")
+        bitbake("%s -S none" % self.image)
 
         def get_files(d):
             f = []
@@ -314,22 +368,22 @@ NATIVELSBSTRING = \"DistroB\"
         targetvendor = get_bb_var('TARGET_VENDOR')
         self.write_config("""
 TMPDIR = \"${TOPDIR}/tmp-sstatesamehash\"
-MACHINE = \"qemux86\"
-""")
+MACHINE = \"%s\"
+""" % self.machine2)
         self.track_for_cleanup(topdir + "/tmp-sstatesamehash")
-        bitbake("world meta-toolchain -S none")
+        bitbake("world %s -S none" % self.recipe4)
         self.write_config("""
 TMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\"
-MACHINE = \"qemuarm\"
-""")
+MACHINE = \"%s\"
+""" % self.machine3)
         self.track_for_cleanup(topdir + "/tmp-sstatesamehash2")
-        bitbake("world meta-toolchain -S none")
+        bitbake("world %s -S none" % self.recipe4)
 
         def get_files(d):
             f = {}
             for root, dirs, files in os.walk(d):
                 for name in files:
-                    if "meta-environment" in root or "cross-canadian" in root:
+                    if self.recipe5 in root or self.recipe6 in root:
                         continue
                     if "do_build" not in name:
                         # 1.4.1+gitAUTOINC+302fca9f4c-r0.do_package_write_ipk.sigdata.f3a2a38697da743f0dbed8b56aafcf79
@@ -361,30 +415,30 @@ MACHINE = \"qemuarm\"
         targetvendor = get_bb_var('TARGET_VENDOR')
         self.write_config("""
 TMPDIR = \"${TOPDIR}/tmp-sstatesamehash\"
-MACHINE = \"qemux86\"
+MACHINE = \"%s\"
 require conf/multilib.conf
 MULTILIBS = "multilib:lib32"
 DEFAULTTUNE_virtclass-multilib-lib32 = "x86"
-""")
+""" % self.machine2)
         self.track_for_cleanup(topdir + "/tmp-sstatesamehash")
         bitbake("world meta-toolchain -S none")
         self.write_config("""
 TMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\"
-MACHINE = \"qemux86copy\"
+MACHINE = \"%s\"
 require conf/multilib.conf
 MULTILIBS = "multilib:lib32"
 DEFAULTTUNE_virtclass-multilib-lib32 = "x86"
-""")
+""" % self.machine4)
         self.track_for_cleanup(topdir + "/tmp-sstatesamehash2")
-        bitbake("world meta-toolchain -S none")
+        bitbake("world %s -S none" % self.recipe4)
 
         def get_files(d):
             f = []
             for root, dirs, files in os.walk(d):
                 for name in files:
-                    if "meta-environment" in root or "cross-canadian" in root:
+                    if self.recipe5 in root or self.recipe6 in root:
                         continue
-                    if "qemux86copy-" in root or "qemux86-" in root:
+                    if "%s-" % self.machine4 in root or "%s-" % self.machine2 in root:
                         continue
                     if "do_build" not in name and "do_populate_sdk" not in name:
                         f.append(os.path.join(root, name))
@@ -416,7 +470,7 @@ http_proxy = ""
 """)
         self.track_for_cleanup(topdir + "/tmp-sstatesamehash")
         self.track_for_cleanup(topdir + "/download1")
-        bitbake("world meta-toolchain -S none")
+        bitbake("world %s -S none" % self.recipe4)
         self.write_config("""
 TMPDIR = "${TOPDIR}/tmp-sstatesamehash2"
 BB_NUMBER_THREADS = "2"
@@ -431,7 +485,7 @@ http_proxy = "http://example.com/"
 """)
         self.track_for_cleanup(topdir + "/tmp-sstatesamehash2")
         self.track_for_cleanup(topdir + "/download2")
-        bitbake("world meta-toolchain -S none")
+        bitbake("world %s -S none" % self.recipe4)
 
         def get_files(d):
             f = {}
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 19/20] oeqa.selftest.wic: Split configuration from code
  2016-08-08 16:22 [PATCH 00/20] oeqa: Split configuration from the code Jose Lamego
                   ` (17 preceding siblings ...)
  2016-08-08 16:23 ` [PATCH 18/20] oeqa.selftest.sstatetests: " Jose Lamego
@ 2016-08-08 16:23 ` Jose Lamego
  2016-08-09  7:26   ` Ed Bartosh
  2016-08-08 16:23 ` [PATCH 20/20] oeqa.utils.readconfig: Read self-test configuration file Jose Lamego
  2016-08-09 12:09 ` [PATCH 00/20] oeqa: Split configuration from the code Richard Purdie
  20 siblings, 1 reply; 25+ messages in thread
From: Jose Lamego @ 2016-08-08 16:23 UTC (permalink / raw)
  To: openembedded-core

Improve oeqa-selftest capabilities and UX by placing
test configuration features and variables into a separate
configuration file.

[Yocto 9389]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 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

diff --git a/meta/lib/oeqa/selftest/conf/wic.conf b/meta/lib/oeqa/selftest/conf/wic.conf
new file mode 100644
index 0000000..e2afb8d
--- /dev/null
+++ b/meta/lib/oeqa/selftest/conf/wic.conf
@@ -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
+
diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index e550785..dc81457 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -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
+    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')
+
     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)
             Wic.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)))
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 20/20] oeqa.utils.readconfig: Read self-test configuration file
  2016-08-08 16:22 [PATCH 00/20] oeqa: Split configuration from the code Jose Lamego
                   ` (18 preceding siblings ...)
  2016-08-08 16:23 ` [PATCH 19/20] oeqa.selftest.wic: " Jose Lamego
@ 2016-08-08 16:23 ` Jose Lamego
  2016-08-09  9:19   ` Joshua G Lock
  2016-08-09 12:09 ` [PATCH 00/20] oeqa: Split configuration from the code Richard Purdie
  20 siblings, 1 reply; 25+ messages in thread
From: Jose Lamego @ 2016-08-08 16:23 UTC (permalink / raw)
  To: openembedded-core

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.

[Yocto 9389]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 meta/lib/oeqa/utils/readconfig.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 meta/lib/oeqa/utils/readconfig.py

diff --git a/meta/lib/oeqa/utils/readconfig.py b/meta/lib/oeqa/utils/readconfig.py
new file mode 100644
index 0000000..1534ce7
--- /dev/null
+++ b/meta/lib/oeqa/utils/readconfig.py
@@ -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
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH 19/20] oeqa.selftest.wic: Split configuration from code
  2016-08-08 16:23 ` [PATCH 19/20] oeqa.selftest.wic: " Jose Lamego
@ 2016-08-09  7:26   ` Ed Bartosh
  2016-08-09 15:20     ` Jose Lamego
  0 siblings, 1 reply; 25+ messages in thread
From: Ed Bartosh @ 2016-08-09  7:26 UTC (permalink / raw)
  To: Jose Lamego; +Cc: openembedded-core

Hi Jose,

On Mon, Aug 08, 2016 at 09:23:07AM -0700, Jose Lamego wrote:
> 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.

> [Yocto 9389]
> 
> Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
> ---
>  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
> 
> diff --git a/meta/lib/oeqa/selftest/conf/wic.conf b/meta/lib/oeqa/selftest/conf/wic.conf
> new file mode 100644
> index 0000000..e2afb8d
> --- /dev/null
> +++ b/meta/lib/oeqa/selftest/conf/wic.conf
> @@ -0,0 +1,10 @@
> +[Wic]
> +setUpClass_image1 = core-image-minimal
> +setUpClass_image2 = minimal
setUpClass_image2 is not used in the code.

> +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.


> +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.

> diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
> index e550785..dc81457 100644
> --- a/meta/lib/oeqa/selftest/wic.py
> +++ b/meta/lib/oeqa/selftest/wic.py
> @@ -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
> +    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.

> +
>      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.

>              Wic.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)))
> -- 
> 1.8.3.1
> 
> -- 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core

-- 
--
Regards,
Ed


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 20/20] oeqa.utils.readconfig: Read self-test configuration file
  2016-08-08 16:23 ` [PATCH 20/20] oeqa.utils.readconfig: Read self-test configuration file Jose Lamego
@ 2016-08-09  9:19   ` Joshua G Lock
  0 siblings, 0 replies; 25+ messages in thread
From: Joshua G Lock @ 2016-08-09  9:19 UTC (permalink / raw)
  To: Jose Lamego, openembedded-core

On Mon, 2016-08-08 at 09:23 -0700, Jose Lamego wrote:
> 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.

> 
> [Yocto 9389]
> 
> Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
> ---
>  meta/lib/oeqa/utils/readconfig.py | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>  create mode 100644 meta/lib/oeqa/utils/readconfig.py
> 
> diff --git a/meta/lib/oeqa/utils/readconfig.py
> b/meta/lib/oeqa/utils/readconfig.py
> new file mode 100644
> index 0000000..1534ce7
> --- /dev/null
> +++ b/meta/lib/oeqa/utils/readconfig.py
> @@ -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))

This seems like it would be simpler with os.path.splitext()[1] ?

> +    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.

> +    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
> -- 
> 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


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 00/20] oeqa: Split configuration from the code
  2016-08-08 16:22 [PATCH 00/20] oeqa: Split configuration from the code Jose Lamego
                   ` (19 preceding siblings ...)
  2016-08-08 16:23 ` [PATCH 20/20] oeqa.utils.readconfig: Read self-test configuration file Jose Lamego
@ 2016-08-09 12:09 ` Richard Purdie
  20 siblings, 0 replies; 25+ messages in thread
From: Richard Purdie @ 2016-08-09 12:09 UTC (permalink / raw)
  To: Jose Lamego, openembedded-core, Lock, Joshua

On Mon, 2016-08-08 at 09:22 -0700, Jose Lamego wrote:
> 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


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 19/20] oeqa.selftest.wic: Split configuration from code
  2016-08-09  7:26   ` Ed Bartosh
@ 2016-08-09 15:20     ` Jose Lamego
  0 siblings, 0 replies; 25+ messages in thread
From: Jose Lamego @ 2016-08-09 15:20 UTC (permalink / raw)
  To: ed.bartosh; +Cc: openembedded-core


[-- Attachment #1.1: Type: text/plain, Size: 19052 bytes --]

Hi Ed, thanks for your quick response.

On 08/09/2016 02:26 AM, Ed Bartosh wrote:
> Hi Jose,
> 
> On Mon, Aug 08, 2016 at 09:23:07AM -0700, Jose Lamego wrote:
>> 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.
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.
> 
>> [Yocto 9389]
>>
>> Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
>> ---
>>  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
>>
>> diff --git a/meta/lib/oeqa/selftest/conf/wic.conf b/meta/lib/oeqa/selftest/conf/wic.conf
>> new file mode 100644
>> index 0000000..e2afb8d
>> --- /dev/null
>> +++ b/meta/lib/oeqa/selftest/conf/wic.conf
>> @@ -0,0 +1,10 @@
>> +[Wic]
>> +setUpClass_image1 = core-image-minimal
>> +setUpClass_image2 = minimal
> setUpClass_image2 is not used in the code.
> 
>> +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.
setUpClass_image1 could be renamed to setUpClass_bitbakeImage1
setUpClass_image3 could be renamed to setClass_wicImage
setUpClass_image5 to setUpClass_bitbakeImage2
> 
> 
>> +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.
> 
>> diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
>> index e550785..dc81457 100644
>> --- a/meta/lib/oeqa/selftest/wic.py
>> +++ b/meta/lib/oeqa/selftest/wic.py
>> @@ -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
>> +    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.
> 
>> +
>>      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.

> 
> The same is true for pretty much all the changes.
> 
>>              Wic.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)))
>> -- 
>> 1.8.3.1
>>
>> -- 
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
> 

-- 
Jose Lamego | OTC Embedded Platforms & Tools | GDC


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 501 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2016-08-09 15:20 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-08 16:22 [PATCH 00/20] oeqa: Split configuration from the code Jose Lamego
2016-08-08 16:22 ` [PATCH 01/20] oeqa.selftest.archiver: Split configuration from code Jose Lamego
2016-08-08 16:22 ` [PATCH 02/20] oeqa.selftest._sstatetests_noauto: " Jose Lamego
2016-08-08 16:22 ` [PATCH 03/20] oeqa.selftest.bblayers: " Jose Lamego
2016-08-08 16:22 ` [PATCH 04/20] oeqa.selftest.bbtests: " Jose Lamego
2016-08-08 16:22 ` [PATCH 05/20] oeqa.selftest.buildhistory: " Jose Lamego
2016-08-08 16:22 ` [PATCH 06/20] oeqa.selftest.buildoptions: " Jose Lamego
2016-08-08 16:22 ` [PATCH 07/20] oeqa.selftest.devtool: " Jose Lamego
2016-08-08 16:22 ` [PATCH 08/20] oeqa.selftest.imagefeatures: " Jose Lamego
2016-08-08 16:22 ` [PATCH 09/20] oeqa.selftest.layerappend: " Jose Lamego
2016-08-08 16:22 ` [PATCH 10/20] oeqa.selftest.lic-checksum: " Jose Lamego
2016-08-08 16:22 ` [PATCH 11/20] oeqa.selftest.manifest: " Jose Lamego
2016-08-08 16:23 ` [PATCH 12/20] oeqa.selftest.oescripts: " Jose Lamego
2016-08-08 16:23 ` [PATCH 13/20] oeqa.selftest.pkgdata: " Jose Lamego
2016-08-08 16:23 ` [PATCH 14/20] oeqa.selftest.prservice: " Jose Lamego
2016-08-08 16:23 ` [PATCH 15/20] oeqa.selftest.recipetool: " Jose Lamego
2016-08-08 16:23 ` [PATCH 16/20] oeqa.selftest.runtime-test: " Jose Lamego
2016-08-08 16:23 ` [PATCH 17/20] oeqa.selftest.signing: " Jose Lamego
2016-08-08 16:23 ` [PATCH 18/20] oeqa.selftest.sstatetests: " Jose Lamego
2016-08-08 16:23 ` [PATCH 19/20] oeqa.selftest.wic: " Jose Lamego
2016-08-09  7:26   ` Ed Bartosh
2016-08-09 15:20     ` Jose Lamego
2016-08-08 16:23 ` [PATCH 20/20] oeqa.utils.readconfig: Read self-test configuration file Jose Lamego
2016-08-09  9:19   ` Joshua G Lock
2016-08-09 12:09 ` [PATCH 00/20] oeqa: Split configuration from the code Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox