diff options
Diffstat (limited to 'poky/meta/classes')
-rw-r--r-- | poky/meta/classes/image-buildinfo.bbclass | 2 | ||||
-rw-r--r-- | poky/meta/classes/testimage.bbclass | 31 | ||||
-rw-r--r-- | poky/meta/classes/testsdk.bbclass | 40 |
3 files changed, 63 insertions, 10 deletions
diff --git a/poky/meta/classes/image-buildinfo.bbclass b/poky/meta/classes/image-buildinfo.bbclass index 213fb9cf9..87a6a1a48 100644 --- a/poky/meta/classes/image-buildinfo.bbclass +++ b/poky/meta/classes/image-buildinfo.bbclass @@ -64,6 +64,8 @@ def buildinfo_target(d): # Write build information to target filesystem python buildinfo () { + if not d.getVar('IMAGE_BUILDINFO_FILE'): + return with open(d.expand('${IMAGE_ROOTFS}${IMAGE_BUILDINFO_FILE}'), 'w') as build: build.writelines(( '''----------------------- diff --git a/poky/meta/classes/testimage.bbclass b/poky/meta/classes/testimage.bbclass index 9feb26770..a9e8b499d 100644 --- a/poky/meta/classes/testimage.bbclass +++ b/poky/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 @@ -132,6 +132,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, machine): + import platform + from oeqa.utils.metadata import get_layers + configuration = {'TEST_TYPE': test_type, + 'MACHINE': machine, + 'DISTRO': d.getVar("DISTRO"), + 'IMAGE_BASENAME': d.getVar("IMAGE_BASENAME"), + 'IMAGE_PKGTYPE': d.getVar("IMAGE_PKGTYPE"), + 'STARTTIME': d.getVar("DATETIME"), + 'HOST_DISTRO': ('-'.join(platform.linux_distribution())).replace(' ', '-'), + 'LAYERS': get_layers(d.getVar("BBLAYERS"))} + return configuration +get_testimage_configuration[vardepsexclude] = "DATETIME" + +def get_testimage_json_result_dir(d): + json_result_dir = os.path.join(d.getVar("LOG_DIR"), '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_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['MACHINE'], configuration['STARTTIME']) + def testimage_main(d): import os import json @@ -299,7 +323,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', 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) diff --git a/poky/meta/classes/testsdk.bbclass b/poky/meta/classes/testsdk.bbclass index 2e4334364..6981d40be 100644 --- a/poky/meta/classes/testsdk.bbclass +++ b/poky/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): + import platform + from oeqa.utils.metadata import get_layers + configuration = {'TEST_TYPE': test_type, + 'MACHINE': d.getVar("MACHINE"), + 'SDKMACHINE': d.getVar("SDKMACHINE"), + 'IMAGE_BASENAME': d.getVar("IMAGE_BASENAME"), + 'IMAGE_PKGTYPE': d.getVar("IMAGE_PKGTYPE"), + 'STARTTIME': d.getVar("DATETIME"), + 'HOST_DISTRO': ('-'.join(platform.linux_distribution())).replace(' ', '-'), + 'LAYERS': get_layers(d.getVar("BBLAYERS"))} + return configuration +get_sdk_configuration[vardepsexclude] = "DATETIME" + +def get_sdk_json_result_dir(d): + json_result_dir = os.path.join(d.getVar("LOG_DIR"), '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_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['SDKMACHINE'], configuration['MACHINE'], configuration['STARTTIME']) + def testsdk_main(d): import os import subprocess @@ -24,8 +48,6 @@ def testsdk_main(d): from oeqa.sdk.context import OESDKTestContext, OESDKTestContextExecutor from oeqa.utils import make_logger_bitbake_compatible - bb.event.enable_threadlock() - pn = d.getVar("PN") logger = make_logger_bitbake_compatible(logging.getLogger("BitBake")) @@ -71,8 +93,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') + result.logDetails(get_sdk_json_result_dir(d), + configuration, + get_sdk_result_id(configuration)) result.logSummary(component, context_msg) if not result.wasSuccessful(): @@ -99,8 +123,6 @@ def testsdkext_main(d): from oeqa.utils import avoid_paths_in_environ, make_logger_bitbake_compatible, subprocesstweak from oeqa.sdkext.context import OESDKExtTestContext, OESDKExtTestContextExecutor - bb.event.enable_threadlock() - pn = d.getVar("PN") logger = make_logger_bitbake_compatible(logging.getLogger("BitBake")) @@ -176,8 +198,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') + result.logDetails(get_sdk_json_result_dir(d), + configuration, + get_sdk_result_id(configuration)) result.logSummary(component, context_msg) if not result.wasSuccessful(): |