* [PATCH 2/4] oeqa/selftest/context: write testresult to json files
2018-10-12 6:33 [PATCH 1/4] oeqa/core/runner: " Yeoh Ee Peng
@ 2018-10-12 6:33 ` Yeoh Ee Peng
0 siblings, 0 replies; 7+ messages in thread
From: Yeoh Ee Peng @ 2018-10-12 6:33 UTC (permalink / raw)
To: openembedded-core
As part of the solution to replace Testopia to store testresult,
OEQA selftest need to output testresult into json files, where
these json testresult files will be stored into git repository
by the future test-case-management tools.
By default, oe-selftest will write json testresult into files.
To disable this, provide '-s' argument to oe-selftest execution.
Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
---
meta/lib/oeqa/selftest/context.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py
index c78947e..61b4afb 100644
--- a/meta/lib/oeqa/selftest/context.py
+++ b/meta/lib/oeqa/selftest/context.py
@@ -73,6 +73,9 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
parser.add_argument('--machine', required=False, choices=['random', 'all'],
help='Run tests on different machines (random/all).')
+
+ parser.add_argument('-s', '--skip-export-json', action='store_true',
+ help='Skip the output test result in json format to files.')
parser.set_defaults(func=self.run)
@@ -99,8 +102,8 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
return cases_paths
def _process_args(self, logger, args):
- args.output_log = '%s-results-%s.log' % (self.name,
- time.strftime("%Y%m%d%H%M%S"))
+ args.test_start_time = time.strftime("%Y%m%d%H%M%S")
+ args.output_log = '%s-results-%s.log' % (self.name, args.test_start_time)
args.test_data_file = None
args.CASES_PATHS = None
@@ -222,6 +225,11 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
rc = self.tc.runTests(**self.tc_kwargs['run'])
rc.logDetails()
rc.logSummary(self.name)
+ if not args.skip_export_json:
+ json_result_dir = os.path.join(os.path.dirname(os.path.abspath(args.output_log)),
+ 'json_testresults-%s' % args.test_start_time,
+ 'oe-selftest')
+ rc.logDetailsInJson(json_result_dir)
return rc
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] oeqa/selftest/context: write testresult to json files
2018-10-22 6:54 [PATCH 1/4] oeqa/core/runner: " Yeoh Ee Peng
@ 2018-10-22 6:54 ` Yeoh Ee Peng
0 siblings, 0 replies; 7+ messages in thread
From: Yeoh Ee Peng @ 2018-10-22 6:54 UTC (permalink / raw)
To: openembedded-core
As part of the solution to replace Testopia to store testresult,
OEQA selftest need to output testresult into json files, where
these json testresult files will be stored into git repository
by the future test-case-management tools.
To configure multiple instances of bitbake to write json testresult
to a single testresult file, user will define the variable
"OEQA_JSON_RESULT_COMMON_DIR" with the common directory for writing
json testresult.
Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
---
meta/lib/oeqa/selftest/context.py | 35 ++++++++++++++++++++++++++++++++---
1 file changed, 32 insertions(+), 3 deletions(-)
diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py
index c78947e..e053183 100644
--- a/meta/lib/oeqa/selftest/context.py
+++ b/meta/lib/oeqa/selftest/context.py
@@ -99,8 +99,8 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
return cases_paths
def _process_args(self, logger, args):
- args.output_log = '%s-results-%s.log' % (self.name,
- time.strftime("%Y%m%d%H%M%S"))
+ args.test_start_time = time.strftime("%Y%m%d%H%M%S")
+ args.output_log = '%s-results-%s.log' % (self.name, args.test_start_time)
args.test_data_file = None
args.CASES_PATHS = None
@@ -204,6 +204,32 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
self.tc.logger.info("Running bitbake -e to test the configuration is valid/parsable")
runCmd("bitbake -e")
+ def _get_json_result_dir(self, args):
+ json_result_dir = os.path.join(os.path.dirname(os.path.abspath(args.output_log)),
+ 'json_testresults-%s' % args.test_start_time,
+ 'oe-selftest')
+ if "OEQA_JSON_RESULT_COMMON_DIR" in self.tc.td:
+ json_result_dir = self.tc.td["OEQA_JSON_RESULT_COMMON_DIR"]
+
+ return json_result_dir
+
+ def _get_configuration(self, args):
+ import platform
+ from oeqa.utils.metadata import metadata_from_bb
+
+ metadata = metadata_from_bb()
+ return {'TEST_TYPE': 'oeselftest',
+ 'BRANCH': metadata['layers']['meta']['branch'],
+ 'COMMIT': metadata['layers']['meta']['commit'],
+ 'START_TIME': args.test_start_time,
+ 'MACHINE': self.tc.td["MACHINE"],
+ 'HOST_DISTRO': platform.linux_distribution(),
+ 'HOST_NAME': metadata['hostname']}
+
+ def _get_result_id(self, configuration):
+ distro = '_'.join(configuration['HOST_DISTRO'])
+ return '%s-%s-%s' % (configuration['TEST_TYPE'], distro, configuration['MACHINE'])
+
def _internal_run(self, logger, args):
self.module_paths = self._get_cases_paths(
self.tc_kwargs['init']['td']['BBPATH'].split(':'))
@@ -220,7 +246,10 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
else:
self._pre_run()
rc = self.tc.runTests(**self.tc_kwargs['run'])
- rc.logDetails()
+ configuration = self._get_configuration(args)
+ rc.logDetails(self._get_json_result_dir(args),
+ configuration,
+ self._get_result_id(configuration))
rc.logSummary(self.name)
return rc
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] oeqa/selftest/context: write testresult to json files
2018-10-22 10:34 [PATCH 1/4] oeqa/core/runner: " Yeoh Ee Peng
@ 2018-10-22 10:34 ` Yeoh Ee Peng
0 siblings, 0 replies; 7+ messages in thread
From: Yeoh Ee Peng @ 2018-10-22 10:34 UTC (permalink / raw)
To: openembedded-core
As part of the solution to replace Testopia to store testresult,
OEQA selftest need to output testresult into json files, where
these json testresult files will be stored into git repository
by the future test-case-management tools.
To configure multiple instances of bitbake to write json testresult
to a single testresult file at custom direcotry, user will define
the variable "OEQA_JSON_RESULT_DIR" with the custom directory for writing
json testresult.
Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
---
meta/lib/oeqa/selftest/context.py | 36 +++++++++++++++++++++++++++++++++---
1 file changed, 33 insertions(+), 3 deletions(-)
diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py
index c78947e..59d4b59 100644
--- a/meta/lib/oeqa/selftest/context.py
+++ b/meta/lib/oeqa/selftest/context.py
@@ -99,8 +99,8 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
return cases_paths
def _process_args(self, logger, args):
- args.output_log = '%s-results-%s.log' % (self.name,
- time.strftime("%Y%m%d%H%M%S"))
+ args.test_start_time = time.strftime("%Y%m%d%H%M%S")
+ args.output_log = '%s-results-%s.log' % (self.name, args.test_start_time)
args.test_data_file = None
args.CASES_PATHS = None
@@ -204,6 +204,33 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
self.tc.logger.info("Running bitbake -e to test the configuration is valid/parsable")
runCmd("bitbake -e")
+ def _get_json_result_dir(self, args):
+ json_result_dir = os.path.join(os.path.dirname(os.path.abspath(args.output_log)), 'oeqa')
+ if "OEQA_JSON_RESULT_DIR" in self.tc.td:
+ json_result_dir = self.tc.td["OEQA_JSON_RESULT_DIR"]
+
+ return json_result_dir
+
+ def _get_configuration(self, args):
+ import platform
+ from oeqa.utils.metadata import metadata_from_bb
+ metadata = metadata_from_bb()
+ configuration = {'TEST_TYPE': 'oeselftest',
+ 'START_TIME': args.test_start_time,
+ 'MACHINE': self.tc.td["MACHINE"],
+ 'HOST_DISTRO': platform.linux_distribution(),
+ 'HOST_NAME': metadata['hostname']}
+ layers = metadata['layers']
+ for l in layers:
+ configuration['%s_BRANCH_REV' % os.path.basename(l)] = '%s:%s' % (
+ metadata['layers'][l]['branch'],
+ metadata['layers'][l]['commit'])
+ return configuration
+
+ def _get_result_id(self, configuration):
+ distro = '_'.join(configuration['HOST_DISTRO'])
+ return '%s-%s-%s' % (configuration['TEST_TYPE'], distro, configuration['MACHINE'])
+
def _internal_run(self, logger, args):
self.module_paths = self._get_cases_paths(
self.tc_kwargs['init']['td']['BBPATH'].split(':'))
@@ -220,7 +247,10 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
else:
self._pre_run()
rc = self.tc.runTests(**self.tc_kwargs['run'])
- rc.logDetails()
+ configuration = self._get_configuration(args)
+ rc.logDetails(self._get_json_result_dir(args),
+ configuration,
+ self._get_result_id(configuration))
rc.logSummary(self.name)
return rc
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 1/4] oeqa/core/runner: write testresult to json files
@ 2018-10-23 5:57 Yeoh Ee Peng
2018-10-23 5:57 ` [PATCH 2/4] oeqa/selftest/context: " Yeoh Ee Peng
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Yeoh Ee Peng @ 2018-10-23 5:57 UTC (permalink / raw)
To: openembedded-core
As part of the solution to replace Testopia to store testresult,
OEQA need to output testresult into single json file, where json
testresult file will be stored in git repository by the future
test-case-management tools.
The json testresult file will store more than one set of results,
where each set of results was uniquely identified by the result_id.
The result_id would be like "runtime-qemux86-core-image-sato", where
it was a runtime test with target machine equal to qemux86 and running
on core-image-sato image. The json testresult file will only store
the latest test content for a given result_id. The json testresult
file contains the configuration (eg. COMMIT, BRANCH, MACHINE, IMAGE),
result (eg. PASSED, FAILED, ERROR), test log, and result_id.
Based on the destination json testresult file directory provided,
it could have multiple instances of bitbake trying to write json
testresult to a single testresult file, using locking a lockfile
alongside the results file directory to prevent races.
Also the library class inside this patch will be reused by the future
test-case-management tools to write json testresult for manual test
case executed.
Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
---
meta/lib/oeqa/core/runner.py | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/meta/lib/oeqa/core/runner.py b/meta/lib/oeqa/core/runner.py
index f1dd080..d6d5afe 100644
--- a/meta/lib/oeqa/core/runner.py
+++ b/meta/lib/oeqa/core/runner.py
@@ -6,6 +6,7 @@ import time
import unittest
import logging
import re
+import json
from unittest import TextTestResult as _TestResult
from unittest import TextTestRunner as _TestRunner
@@ -119,8 +120,9 @@ class OETestResult(_TestResult):
self.successes.append((test, None))
super(OETestResult, self).addSuccess(test)
- def logDetails(self):
+ def logDetails(self, json_file_dir=None, configuration=None, result_id=None):
self.tc.logger.info("RESULTS:")
+ result = {}
for case_name in self.tc._registry['cases']:
case = self.tc._registry['cases'][case_name]
@@ -137,6 +139,11 @@ class OETestResult(_TestResult):
t = " (" + "{0:.2f}".format(self.endtime[case.id()] - self.starttime[case.id()]) + "s)"
self.tc.logger.info("RESULTS - %s - Testcase %s: %s%s" % (case.id(), oeid, status, t))
+ result[case.id()] = {'status': status, 'log': log}
+
+ if json_file_dir:
+ tresultjsonhelper = OETestResultJSONHelper()
+ tresultjsonhelper.dump_testresult_file(json_file_dir, configuration, result_id, result)
class OEListTestsResult(object):
def wasSuccessful(self):
@@ -249,3 +256,29 @@ class OETestRunner(_TestRunner):
self._list_tests_module(suite)
return OEListTestsResult()
+
+class OETestResultJSONHelper(object):
+
+ testresult_filename = 'testresults.json'
+
+ def _get_existing_testresults_if_available(self, write_dir):
+ testresults = {}
+ file = os.path.join(write_dir, self.testresult_filename)
+ if os.path.exists(file):
+ with open(file, "r") as f:
+ testresults = json.load(f)
+ return testresults
+
+ def _write_file(self, write_dir, file_name, file_content):
+ file_path = os.path.join(write_dir, file_name)
+ with open(file_path, 'w') as the_file:
+ the_file.write(file_content)
+
+ def dump_testresult_file(self, write_dir, configuration, result_id, test_result):
+ bb.utils.mkdirhier(write_dir)
+ lf = bb.utils.lockfile(os.path.join(write_dir, 'jsontestresult.lock'))
+ test_results = self._get_existing_testresults_if_available(write_dir)
+ test_results[result_id] = {'configuration': configuration, 'result': test_result}
+ json_testresults = json.dumps(test_results, sort_keys=True, indent=4)
+ self._write_file(write_dir, self.testresult_filename, json_testresults)
+ bb.utils.unlockfile(lf)
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] oeqa/selftest/context: write testresult to json files
2018-10-23 5:57 [PATCH 1/4] oeqa/core/runner: write testresult to json files Yeoh Ee Peng
@ 2018-10-23 5:57 ` Yeoh Ee Peng
2018-10-23 5:57 ` [PATCH 3/4] testimage.bbclass: " Yeoh Ee Peng
2018-10-23 5:57 ` [PATCH 4/4] testsdk.bbclass: " Yeoh Ee Peng
2 siblings, 0 replies; 7+ messages in thread
From: Yeoh Ee Peng @ 2018-10-23 5:57 UTC (permalink / raw)
To: openembedded-core
As part of the solution to replace Testopia to store testresult,
OEQA selftest need to output testresult into json files, where
these json testresult files will be stored into git repository
by the future test-case-management tools.
By default, json testresult file will be written to "oeqa"
directory under the oe-selftest log directory.
To configure multiple instances of bitbake to write json testresult
to a single testresult file at custom directory, user will define
the variable "OEQA_JSON_RESULT_DIR" with the custom directory for
json testresult.
Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
---
meta/lib/oeqa/selftest/context.py | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py
index c78947e..ee83a91 100644
--- a/meta/lib/oeqa/selftest/context.py
+++ b/meta/lib/oeqa/selftest/context.py
@@ -99,8 +99,8 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
return cases_paths
def _process_args(self, logger, args):
- args.output_log = '%s-results-%s.log' % (self.name,
- time.strftime("%Y%m%d%H%M%S"))
+ args.test_start_time = time.strftime("%Y%m%d%H%M%S")
+ args.output_log = '%s-results-%s.log' % (self.name, args.test_start_time)
args.test_data_file = None
args.CASES_PATHS = None
@@ -204,6 +204,31 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
self.tc.logger.info("Running bitbake -e to test the configuration is valid/parsable")
runCmd("bitbake -e")
+ def _get_json_result_dir(self, args):
+ json_result_dir = os.path.join(os.path.dirname(os.path.abspath(args.output_log)), 'oeqa')
+ if "OEQA_JSON_RESULT_DIR" in self.tc.td:
+ json_result_dir = self.tc.td["OEQA_JSON_RESULT_DIR"]
+
+ return json_result_dir
+
+ def _get_configuration(self, args):
+ import platform
+ from oeqa.utils.metadata import metadata_from_bb
+ metadata = metadata_from_bb()
+ configuration = {'TEST_TYPE': 'oeselftest',
+ 'START_TIME': args.test_start_time,
+ 'MACHINE': self.tc.td["MACHINE"],
+ 'HOST_DISTRO': ('-'.join(platform.linux_distribution())).replace(' ', '-'),
+ 'HOST_NAME': metadata['hostname']}
+ layers = metadata['layers']
+ for l in layers:
+ configuration['%s_BRANCH_REV' % os.path.basename(l)] = '%s:%s' % (metadata['layers'][l]['branch'],
+ metadata['layers'][l]['commit'])
+ return configuration
+
+ def _get_result_id(self, configuration):
+ return '%s_%s_%s' % (configuration['TEST_TYPE'], configuration['HOST_DISTRO'], configuration['MACHINE'])
+
def _internal_run(self, logger, args):
self.module_paths = self._get_cases_paths(
self.tc_kwargs['init']['td']['BBPATH'].split(':'))
@@ -220,7 +245,10 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
else:
self._pre_run()
rc = self.tc.runTests(**self.tc_kwargs['run'])
- rc.logDetails()
+ configuration = self._get_configuration(args)
+ rc.logDetails(self._get_json_result_dir(args),
+ configuration,
+ self._get_result_id(configuration))
rc.logSummary(self.name)
return rc
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] testimage.bbclass: write testresult to json files
2018-10-23 5:57 [PATCH 1/4] oeqa/core/runner: write testresult to json files Yeoh Ee Peng
2018-10-23 5:57 ` [PATCH 2/4] oeqa/selftest/context: " Yeoh Ee Peng
@ 2018-10-23 5:57 ` Yeoh Ee Peng
2018-10-23 5:57 ` [PATCH 4/4] testsdk.bbclass: " Yeoh Ee Peng
2 siblings, 0 replies; 7+ messages in thread
From: Yeoh Ee Peng @ 2018-10-23 5:57 UTC (permalink / raw)
To: openembedded-core
As part of the solution to replace Testopia to store testresult,
OEQA testimage need to output testresult into json files, where
these json testresult files will be stored into git repository
by the future test-case-management tools.
By default, json testresult file will be written to "oeqa"
directory under the "WORKDIR" directory.
To configure multiple instances of bitbake to write json testresult
to a single testresult file at custom directory, user will define
the variable "OEQA_JSON_RESULT_DIR" with the custom directory for
json testresult.
Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
---
meta/classes/testimage.bbclass | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass
index 2642a72..109eecc 100644
--- a/meta/classes/testimage.bbclass
+++ b/meta/classes/testimage.bbclass
@@ -2,7 +2,7 @@
#
# Released under the MIT license (see COPYING.MIT)
-
+inherit metadata_scm
# testimage.bbclass enables testing of qemu images using python unittests.
# Most of the tests are commands run on target image over ssh.
# To use it add testimage to global inherit and call your target image with -c testimage
@@ -141,6 +141,30 @@ def testimage_sanity(d):
bb.fatal('When TEST_TARGET is set to "simpleremote" '
'TEST_TARGET_IP and TEST_SERVER_IP are needed too.')
+def _get_testimage_configuration(d, test_type, pid, machine):
+ import platform
+ configuration = {'TEST_TYPE': test_type,
+ 'PROCESS_ID': pid,
+ 'MACHINE': machine,
+ 'IMAGE_BASENAME': d.getVar("IMAGE_BASENAME"),
+ 'IMAGE_PKGTYPE': d.getVar("IMAGE_PKGTYPE"),
+ 'HOST_DISTRO': ('-'.join(platform.linux_distribution())).replace(' ', '-')}
+ layers = (d.getVar("BBLAYERS") or "").split()
+ for l in layers:
+ configuration['%s_BRANCH_REV' % os.path.basename(l)] = '%s:%s' % (base_get_metadata_git_branch(l, None).strip(),
+ base_get_metadata_git_revision(l, None))
+ return configuration
+
+def _get_testimage_json_result_dir(d):
+ json_result_dir = os.path.join(d.getVar("WORKDIR"), 'oeqa')
+ custom_json_result_dir = d.getVar("OEQA_JSON_RESULT_DIR")
+ if custom_json_result_dir:
+ json_result_dir = custom_json_result_dir
+ return json_result_dir
+
+def _get_testimage_result_id(configuration):
+ return '%s_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['MACHINE'])
+
def testimage_main(d):
import os
import json
@@ -308,7 +332,10 @@ def testimage_main(d):
# Show results (if we have them)
if not results:
bb.fatal('%s - FAILED - tests were interrupted during execution' % pn, forcelog=True)
- results.logDetails()
+ configuration = _get_testimage_configuration(d, 'runtime', os.getpid(), machine)
+ results.logDetails(_get_testimage_json_result_dir(d),
+ configuration,
+ _get_testimage_result_id(configuration))
results.logSummary(pn)
if not results.wasSuccessful():
bb.fatal('%s - FAILED - check the task log and the ssh log' % pn, forcelog=True)
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] testsdk.bbclass: write testresult to json files
2018-10-23 5:57 [PATCH 1/4] oeqa/core/runner: write testresult to json files Yeoh Ee Peng
2018-10-23 5:57 ` [PATCH 2/4] oeqa/selftest/context: " Yeoh Ee Peng
2018-10-23 5:57 ` [PATCH 3/4] testimage.bbclass: " Yeoh Ee Peng
@ 2018-10-23 5:57 ` Yeoh Ee Peng
2 siblings, 0 replies; 7+ messages in thread
From: Yeoh Ee Peng @ 2018-10-23 5:57 UTC (permalink / raw)
To: openembedded-core
As part of the solution to replace Testopia to store testresult,
OEQA sdk and sdkext need to output testresult into json files, where
these json testresult files will be stored into git repository
by the future test-case-management tools.
By default, json testresult file will be written to "oeqa"
directory under the "WORKDIR" directory.
To configure multiple instances of bitbake to write json testresult
to a single testresult file at custom directory, user will define
the variable "OEQA_JSON_RESULT_DIR" with the custom directory for
json testresult.
Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
---
meta/classes/testsdk.bbclass | 36 ++++++++++++++++++++++++++++++++----
1 file changed, 32 insertions(+), 4 deletions(-)
diff --git a/meta/classes/testsdk.bbclass b/meta/classes/testsdk.bbclass
index d3f475d..a6c3627 100644
--- a/meta/classes/testsdk.bbclass
+++ b/meta/classes/testsdk.bbclass
@@ -14,6 +14,30 @@
#
# where "<image-name>" is an image like core-image-sato.
+def _get_sdk_configuration(d, test_type, pid):
+ import platform
+ configuration = {'TEST_TYPE': test_type,
+ 'PROCESS_ID': pid,
+ 'SDK_MACHINE': d.getVar("SDKMACHINE"),
+ 'IMAGE_BASENAME': d.getVar("IMAGE_BASENAME"),
+ 'IMAGE_PKGTYPE': d.getVar("IMAGE_PKGTYPE"),
+ 'HOST_DISTRO': ('-'.join(platform.linux_distribution())).replace(' ', '-')}
+ layers = (d.getVar("BBLAYERS") or "").split()
+ for l in layers:
+ configuration['%s_BRANCH_REV' % os.path.basename(l)] = '%s:%s' % (base_get_metadata_git_branch(l, None).strip(),
+ base_get_metadata_git_revision(l, None))
+ return configuration
+
+def _get_sdk_json_result_dir(d):
+ json_result_dir = os.path.join(d.getVar("WORKDIR"), 'oeqa')
+ custom_json_result_dir = d.getVar("OEQA_JSON_RESULT_DIR")
+ if custom_json_result_dir:
+ json_result_dir = custom_json_result_dir
+ return json_result_dir
+
+def _get_sdk_result_id(configuration):
+ return '%s_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['SDK_MACHINE'])
+
def testsdk_main(d):
import os
import subprocess
@@ -80,8 +104,10 @@ def testsdk_main(d):
component = "%s %s" % (pn, OESDKTestContextExecutor.name)
context_msg = "%s:%s" % (os.path.basename(tcname), os.path.basename(sdk_env))
-
- result.logDetails()
+ configuration = _get_sdk_configuration(d, 'sdk', os.getpid())
+ result.logDetails(_get_sdk_json_result_dir(d),
+ configuration,
+ _get_sdk_result_id(configuration))
result.logSummary(component, context_msg)
if not result.wasSuccessful():
@@ -184,8 +210,10 @@ def testsdkext_main(d):
component = "%s %s" % (pn, OESDKExtTestContextExecutor.name)
context_msg = "%s:%s" % (os.path.basename(tcname), os.path.basename(sdk_env))
-
- result.logDetails()
+ configuration = _get_sdk_configuration(d, 'sdkext', os.getpid())
+ result.logDetails(_get_sdk_json_result_dir(d),
+ configuration,
+ _get_sdk_result_id(configuration))
result.logSummary(component, context_msg)
if not result.wasSuccessful():
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-10-23 6:12 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-23 5:57 [PATCH 1/4] oeqa/core/runner: write testresult to json files Yeoh Ee Peng
2018-10-23 5:57 ` [PATCH 2/4] oeqa/selftest/context: " Yeoh Ee Peng
2018-10-23 5:57 ` [PATCH 3/4] testimage.bbclass: " Yeoh Ee Peng
2018-10-23 5:57 ` [PATCH 4/4] testsdk.bbclass: " Yeoh Ee Peng
-- strict thread matches above, loose matches on Subject: below --
2018-10-22 10:34 [PATCH 1/4] oeqa/core/runner: " Yeoh Ee Peng
2018-10-22 10:34 ` [PATCH 2/4] oeqa/selftest/context: " Yeoh Ee Peng
2018-10-22 6:54 [PATCH 1/4] oeqa/core/runner: " Yeoh Ee Peng
2018-10-22 6:54 ` [PATCH 2/4] oeqa/selftest/context: " Yeoh Ee Peng
2018-10-12 6:33 [PATCH 1/4] oeqa/core/runner: " Yeoh Ee Peng
2018-10-12 6:33 ` [PATCH 2/4] oeqa/selftest/context: " Yeoh Ee Peng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox