summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-10-29 13:49:14 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-16 14:31:27 +0000
commite331378e17a07da3e024b2780f25d648b95b574f (patch)
tree984ca41cc52d2a9593d7da0da686376a80e55a51 /meta/classes
parent6512ffb0908bc267533369b21cb62b9e9d248876 (diff)
downloadpoky-e331378e17a07da3e024b2780f25d648b95b574f.tar.gz
testimage: Improvements to the json logging
Tweak the preceeding commit to: * Add STARTTIME to the identifier to make it unique * Log DISTRO * Use LOG_DIR * Store the layer config in a more natural json format * Drop '_' function prefixes (From OE-Core rev: fd07da4d46a8167807f6ce872497fbdc812494ad) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/testimage.bbclass28
1 files changed, 14 insertions, 14 deletions
diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass
index e95ce0c9e3..a9e8b499dd 100644
--- a/meta/classes/testimage.bbclass
+++ b/meta/classes/testimage.bbclass
@@ -132,29 +132,29 @@ def testimage_sanity(d):
132 bb.fatal('When TEST_TARGET is set to "simpleremote" ' 132 bb.fatal('When TEST_TARGET is set to "simpleremote" '
133 'TEST_TARGET_IP and TEST_SERVER_IP are needed too.') 133 'TEST_TARGET_IP and TEST_SERVER_IP are needed too.')
134 134
135def _get_testimage_configuration(d, test_type, pid, machine): 135def get_testimage_configuration(d, test_type, machine):
136 import platform 136 import platform
137 from oeqa.utils.metadata import get_layers
137 configuration = {'TEST_TYPE': test_type, 138 configuration = {'TEST_TYPE': test_type,
138 'PROCESS_ID': pid,
139 'MACHINE': machine, 139 'MACHINE': machine,
140 'DISTRO': d.getVar("DISTRO"),
140 'IMAGE_BASENAME': d.getVar("IMAGE_BASENAME"), 141 'IMAGE_BASENAME': d.getVar("IMAGE_BASENAME"),
141 'IMAGE_PKGTYPE': d.getVar("IMAGE_PKGTYPE"), 142 'IMAGE_PKGTYPE': d.getVar("IMAGE_PKGTYPE"),
142 'HOST_DISTRO': ('-'.join(platform.linux_distribution())).replace(' ', '-')} 143 'STARTTIME': d.getVar("DATETIME"),
143 layers = (d.getVar("BBLAYERS") or "").split() 144 'HOST_DISTRO': ('-'.join(platform.linux_distribution())).replace(' ', '-'),
144 for l in layers: 145 'LAYERS': get_layers(d.getVar("BBLAYERS"))}
145 configuration['%s_BRANCH_REV' % os.path.basename(l)] = '%s:%s' % (base_get_metadata_git_branch(l, None).strip(),
146 base_get_metadata_git_revision(l, None))
147 return configuration 146 return configuration
147get_testimage_configuration[vardepsexclude] = "DATETIME"
148 148
149def _get_testimage_json_result_dir(d): 149def get_testimage_json_result_dir(d):
150 json_result_dir = os.path.join(d.getVar("WORKDIR"), 'oeqa') 150 json_result_dir = os.path.join(d.getVar("LOG_DIR"), 'oeqa')
151 custom_json_result_dir = d.getVar("OEQA_JSON_RESULT_DIR") 151 custom_json_result_dir = d.getVar("OEQA_JSON_RESULT_DIR")
152 if custom_json_result_dir: 152 if custom_json_result_dir:
153 json_result_dir = custom_json_result_dir 153 json_result_dir = custom_json_result_dir
154 return json_result_dir 154 return json_result_dir
155 155
156def _get_testimage_result_id(configuration): 156def get_testimage_result_id(configuration):
157 return '%s_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['MACHINE']) 157 return '%s_%s_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['MACHINE'], configuration['STARTTIME'])
158 158
159def testimage_main(d): 159def testimage_main(d):
160 import os 160 import os
@@ -323,10 +323,10 @@ def testimage_main(d):
323 # Show results (if we have them) 323 # Show results (if we have them)
324 if not results: 324 if not results:
325 bb.fatal('%s - FAILED - tests were interrupted during execution' % pn, forcelog=True) 325 bb.fatal('%s - FAILED - tests were interrupted during execution' % pn, forcelog=True)
326 configuration = _get_testimage_configuration(d, 'runtime', os.getpid(), machine) 326 configuration = get_testimage_configuration(d, 'runtime', machine)
327 results.logDetails(_get_testimage_json_result_dir(d), 327 results.logDetails(get_testimage_json_result_dir(d),
328 configuration, 328 configuration,
329 _get_testimage_result_id(configuration)) 329 get_testimage_result_id(configuration))
330 results.logSummary(pn) 330 results.logSummary(pn)
331 if not results.wasSuccessful(): 331 if not results.wasSuccessful():
332 bb.fatal('%s - FAILED - check the task log and the ssh log' % pn, forcelog=True) 332 bb.fatal('%s - FAILED - check the task log and the ssh log' % pn, forcelog=True)