From: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 4/4] testsdk.bbclass: write testresult to json files
Date: Tue, 23 Oct 2018 13:57:22 +0800 [thread overview]
Message-ID: <1540274242-78226-4-git-send-email-ee.peng.yeoh@intel.com> (raw)
In-Reply-To: <1540274242-78226-1-git-send-email-ee.peng.yeoh@intel.com>
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
next prev parent reply other threads:[~2018-10-23 6:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
-- 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 4/4] testsdk.bbclass: " Yeoh Ee Peng
2018-10-22 6:54 [PATCH 1/4] oeqa/core/runner: " Yeoh Ee Peng
2018-10-22 6:54 ` [PATCH 4/4] testsdk.bbclass: " Yeoh Ee Peng
2018-10-12 6:33 [PATCH 1/4] oeqa/core/runner: " Yeoh Ee Peng
2018-10-12 6:33 ` [PATCH 4/4] testsdk.bbclass: " Yeoh Ee Peng
2018-10-02 9:22 [PATCH 1/4] oeqa/runner: " Yeoh Ee Peng
2018-10-02 9:22 ` [PATCH 4/4] testsdk.bbclass: " Yeoh Ee Peng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1540274242-78226-4-git-send-email-ee.peng.yeoh@intel.com \
--to=ee.peng.yeoh@intel.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox