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-10-29 17:26:47 +0000
commit8daaae42063c38b414522289a94009cdee421a05 (patch)
tree5c687d8fe6c1947542e65dd3f364d2036a14dd91 /meta/classes
parente73bcdd0590fbc82da515b37e5cf32726f231cf9 (diff)
downloadpoky-8daaae42063c38b414522289a94009cdee421a05.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: dda94cfa708cf3c6e5408d6dbcece360b4e8cd27) 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 4057f497c4..ba2d9c491b 100644
--- a/meta/classes/testimage.bbclass
+++ b/meta/classes/testimage.bbclass
@@ -142,29 +142,29 @@ def testimage_sanity(d):
142 bb.fatal('When TEST_TARGET is set to "simpleremote" ' 142 bb.fatal('When TEST_TARGET is set to "simpleremote" '
143 'TEST_TARGET_IP and TEST_SERVER_IP are needed too.') 143 'TEST_TARGET_IP and TEST_SERVER_IP are needed too.')
144 144
145def _get_testimage_configuration(d, test_type, pid, machine): 145def get_testimage_configuration(d, test_type, machine):
146 import platform 146 import platform
147 from oeqa.utils.metadata import get_layers
147 configuration = {'TEST_TYPE': test_type, 148 configuration = {'TEST_TYPE': test_type,
148 'PROCESS_ID': pid,
149 'MACHINE': machine, 149 'MACHINE': machine,
150 'DISTRO': d.getVar("DISTRO"),
150 'IMAGE_BASENAME': d.getVar("IMAGE_BASENAME"), 151 'IMAGE_BASENAME': d.getVar("IMAGE_BASENAME"),
151 'IMAGE_PKGTYPE': d.getVar("IMAGE_PKGTYPE"), 152 'IMAGE_PKGTYPE': d.getVar("IMAGE_PKGTYPE"),
152 'HOST_DISTRO': ('-'.join(platform.linux_distribution())).replace(' ', '-')} 153 'STARTTIME': d.getVar("DATETIME"),
153 layers = (d.getVar("BBLAYERS") or "").split() 154 'HOST_DISTRO': ('-'.join(platform.linux_distribution())).replace(' ', '-'),
154 for l in layers: 155 'LAYERS': get_layers(d.getVar("BBLAYERS"))}
155 configuration['%s_BRANCH_REV' % os.path.basename(l)] = '%s:%s' % (base_get_metadata_git_branch(l, None).strip(),
156 base_get_metadata_git_revision(l, None))
157 return configuration 156 return configuration
157get_testimage_configuration[vardepsexclude] = "DATETIME"
158 158
159def _get_testimage_json_result_dir(d): 159def get_testimage_json_result_dir(d):
160 json_result_dir = os.path.join(d.getVar("WORKDIR"), 'oeqa') 160 json_result_dir = os.path.join(d.getVar("LOG_DIR"), 'oeqa')
161 custom_json_result_dir = d.getVar("OEQA_JSON_RESULT_DIR") 161 custom_json_result_dir = d.getVar("OEQA_JSON_RESULT_DIR")
162 if custom_json_result_dir: 162 if custom_json_result_dir:
163 json_result_dir = custom_json_result_dir 163 json_result_dir = custom_json_result_dir
164 return json_result_dir 164 return json_result_dir
165 165
166def _get_testimage_result_id(configuration): 166def get_testimage_result_id(configuration):
167 return '%s_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['MACHINE']) 167 return '%s_%s_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['MACHINE'], configuration['STARTTIME'])
168 168
169def testimage_main(d): 169def testimage_main(d):
170 import os 170 import os
@@ -333,10 +333,10 @@ def testimage_main(d):
333 # Show results (if we have them) 333 # Show results (if we have them)
334 if not results: 334 if not results:
335 bb.fatal('%s - FAILED - tests were interrupted during execution' % pn, forcelog=True) 335 bb.fatal('%s - FAILED - tests were interrupted during execution' % pn, forcelog=True)
336 configuration = _get_testimage_configuration(d, 'runtime', os.getpid(), machine) 336 configuration = get_testimage_configuration(d, 'runtime', machine)
337 results.logDetails(_get_testimage_json_result_dir(d), 337 results.logDetails(get_testimage_json_result_dir(d),
338 configuration, 338 configuration,
339 _get_testimage_result_id(configuration)) 339 get_testimage_result_id(configuration))
340 results.logSummary(pn) 340 results.logSummary(pn)
341 if not results.wasSuccessful(): 341 if not results.wasSuccessful():
342 bb.fatal('%s - FAILED - check the task log and the ssh log' % pn, forcelog=True) 342 bb.fatal('%s - FAILED - check the task log and the ssh log' % pn, forcelog=True)