summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-10-29 13:49:24 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-10-29 17:26:47 +0000
commit1fd2d4acfcbdbcb8776606c62f62b73a472ce67b (patch)
treeafdb95d1363d60c70067eba3a04685a8cc134cd4 /meta/classes
parentfc16be17878486181d460416618f4f06d2be40e3 (diff)
downloadpoky-1fd2d4acfcbdbcb8776606c62f62b73a472ce67b.tar.gz
testsdk: Improvements to the json logging
Tweak the preceeding commit to: * Add STARTTIME to the identifier to make it unique * Add MACHINE to the identifier * Use LOG_DIR * Store the layer config in a more natural json format * Drop '_' function prefixes (From OE-Core rev: c272079d662237b1b9f87940c88cbadaeda9a9d1) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/testsdk.bbclass36
1 files changed, 18 insertions, 18 deletions
diff --git a/meta/classes/testsdk.bbclass b/meta/classes/testsdk.bbclass
index a6c362723f..5b9bf7b262 100644
--- a/meta/classes/testsdk.bbclass
+++ b/meta/classes/testsdk.bbclass
@@ -14,29 +14,29 @@
14# 14#
15# where "<image-name>" is an image like core-image-sato. 15# where "<image-name>" is an image like core-image-sato.
16 16
17def _get_sdk_configuration(d, test_type, pid): 17def get_sdk_configuration(d, test_type):
18 import platform 18 import platform
19 from oeqa.utils.metadata import get_layers
19 configuration = {'TEST_TYPE': test_type, 20 configuration = {'TEST_TYPE': test_type,
20 'PROCESS_ID': pid, 21 'MACHINE': d.getVar("MACHINE"),
21 'SDK_MACHINE': d.getVar("SDKMACHINE"), 22 'SDKMACHINE': d.getVar("SDKMACHINE"),
22 'IMAGE_BASENAME': d.getVar("IMAGE_BASENAME"), 23 'IMAGE_BASENAME': d.getVar("IMAGE_BASENAME"),
23 'IMAGE_PKGTYPE': d.getVar("IMAGE_PKGTYPE"), 24 'IMAGE_PKGTYPE': d.getVar("IMAGE_PKGTYPE"),
24 'HOST_DISTRO': ('-'.join(platform.linux_distribution())).replace(' ', '-')} 25 'STARTTIME': d.getVar("DATETIME"),
25 layers = (d.getVar("BBLAYERS") or "").split() 26 'HOST_DISTRO': ('-'.join(platform.linux_distribution())).replace(' ', '-'),
26 for l in layers: 27 'LAYERS': get_layers(d.getVar("BBLAYERS"))}
27 configuration['%s_BRANCH_REV' % os.path.basename(l)] = '%s:%s' % (base_get_metadata_git_branch(l, None).strip(),
28 base_get_metadata_git_revision(l, None))
29 return configuration 28 return configuration
29get_sdk_configuration[vardepsexclude] = "DATETIME"
30 30
31def _get_sdk_json_result_dir(d): 31def get_sdk_json_result_dir(d):
32 json_result_dir = os.path.join(d.getVar("WORKDIR"), 'oeqa') 32 json_result_dir = os.path.join(d.getVar("LOG_DIR"), 'oeqa')
33 custom_json_result_dir = d.getVar("OEQA_JSON_RESULT_DIR") 33 custom_json_result_dir = d.getVar("OEQA_JSON_RESULT_DIR")
34 if custom_json_result_dir: 34 if custom_json_result_dir:
35 json_result_dir = custom_json_result_dir 35 json_result_dir = custom_json_result_dir
36 return json_result_dir 36 return json_result_dir
37 37
38def _get_sdk_result_id(configuration): 38def get_sdk_result_id(configuration):
39 return '%s_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['SDK_MACHINE']) 39 return '%s_%s_%s_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['SDKMACHINE'], configuration['MACHINE'], configuration['STARTTIME'])
40 40
41def testsdk_main(d): 41def testsdk_main(d):
42 import os 42 import os
@@ -104,10 +104,10 @@ def testsdk_main(d):
104 104
105 component = "%s %s" % (pn, OESDKTestContextExecutor.name) 105 component = "%s %s" % (pn, OESDKTestContextExecutor.name)
106 context_msg = "%s:%s" % (os.path.basename(tcname), os.path.basename(sdk_env)) 106 context_msg = "%s:%s" % (os.path.basename(tcname), os.path.basename(sdk_env))
107 configuration = _get_sdk_configuration(d, 'sdk', os.getpid()) 107 configuration = get_sdk_configuration(d, 'sdk')
108 result.logDetails(_get_sdk_json_result_dir(d), 108 result.logDetails(get_sdk_json_result_dir(d),
109 configuration, 109 configuration,
110 _get_sdk_result_id(configuration)) 110 get_sdk_result_id(configuration))
111 result.logSummary(component, context_msg) 111 result.logSummary(component, context_msg)
112 112
113 if not result.wasSuccessful(): 113 if not result.wasSuccessful():
@@ -210,10 +210,10 @@ def testsdkext_main(d):
210 210
211 component = "%s %s" % (pn, OESDKExtTestContextExecutor.name) 211 component = "%s %s" % (pn, OESDKExtTestContextExecutor.name)
212 context_msg = "%s:%s" % (os.path.basename(tcname), os.path.basename(sdk_env)) 212 context_msg = "%s:%s" % (os.path.basename(tcname), os.path.basename(sdk_env))
213 configuration = _get_sdk_configuration(d, 'sdkext', os.getpid()) 213 configuration = get_sdk_configuration(d, 'sdkext')
214 result.logDetails(_get_sdk_json_result_dir(d), 214 result.logDetails(get_sdk_json_result_dir(d),
215 configuration, 215 configuration,
216 _get_sdk_result_id(configuration)) 216 get_sdk_result_id(configuration))
217 result.logSummary(component, context_msg) 217 result.logSummary(component, context_msg)
218 218
219 if not result.wasSuccessful(): 219 if not result.wasSuccessful():