[OE-core] [PATCH 12/20] oeqa.selftest.oescripts: Split configuration from code
Jose Lamego
jose.a.lamego at linux.intel.com
Mon Aug 8 16:23:00 UTC 2016
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 at 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
More information about the Openembedded-core
mailing list