[OE-core] [PATCH 10/32] oeqa/core/context: Add support of OETestContextExecutor

Aníbal Limón anibal.limon at linux.intel.com
Tue Dec 6 21:43:55 UTC 2016


The OETestContextExecutor class supports to use oe-test for run core
test component also is a base class for the other test components
(runtime, sdk, selftest).

Te principal functionality is to support cmdline parsing and execution
of OETestContext, the test components could extend the common options
to provide specific ones. The common options between test components
are test data file, output log and test cases path's to scan.

Also it initializes the logger to be passed to the whole OEQA framework.

[YOCTO #10230]

Signed-off-by: Aníbal Limón <anibal.limon at linux.intel.com>
Signed-off-by: Mariano Lopez <mariano.lopez at linux.intel.com>
---
 meta/lib/oeqa/core/context.py | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/meta/lib/oeqa/core/context.py b/meta/lib/oeqa/core/context.py
index d5caf53..c7d6db3 100644
--- a/meta/lib/oeqa/core/context.py
+++ b/meta/lib/oeqa/core/context.py
@@ -148,7 +148,7 @@ class OETestContextExecutor(object):
 
     default_cases = [os.path.join(os.path.abspath(os.path.dirname(__file__)),
             'cases/example')]
-    default_test_data = os.path.join(default_cases[0], 'data.json')
+    default_data = os.path.join(default_cases[0], 'data.json')
 
     def register_commands(self, logger, subparsers):
         self.parser = subparsers.add_parser(self.name, help=self.help,
@@ -160,12 +160,12 @@ class OETestContextExecutor(object):
                 default=self.default_output_log,
                 help="results output log, default: %s" % self.default_output_log)
 
-        if self.default_test_data:
-            self.parser.add_argument('--test-data-file', action='store',
-                    default=self.default_test_data,
-                    help="data file to load, default: %s" % self.default_test_data)
+        if self.default_data:
+            self.parser.add_argument('--data-file', action='store',
+                    default=self.default_data,
+                    help="data file to load, default: %s" % self.default_data)
         else:
-            self.parser.add_argument('--test-data-file', action='store',
+            self.parser.add_argument('--data-file', action='store',
                     help="data file to load")
 
         if self.default_cases:
@@ -197,11 +197,11 @@ class OETestContextExecutor(object):
         self.tc_kwargs['run'] = {}
 
         self.tc_kwargs['init']['logger'] = self._setup_logger(logger, args)
-        if args.test_data_file:
-            self.tc_kwargs['init']['td'] = json.load(
-                    open(args.test_data_file, "r"))
+        if args.data_file:
+            self.tc_kwargs['init']['d'] = json.load(
+                    open(args.data_file, "r"))
         else:
-            self.tc_kwargs['init']['td'] = {}
+            self.tc_kwargs['init']['d'] = {}
 
         self.module_paths = args.CASES_PATHS
 
-- 
2.1.4




More information about the Openembedded-core mailing list