[PATCH 01/20] oeqa.selftest.archiver: Split configuration from code

Jose Lamego
2016-08-08T16:23:19Z

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