diff options
author | Alexis Lothoré <alexis.lothore@bootlin.com> | 2024-02-26 10:19:18 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-02-27 11:35:40 +0000 |
commit | 01b1a6a5a4e7cede4d23a981b5144ae9c8306274 (patch) | |
tree | 77ebd702f1a6eabc0d2852755850709374da1a2a /meta/lib/oeqa | |
parent | acc08582293709c73011083aa7d5c631a9ae8c8c (diff) | |
download | openembedded-core-01b1a6a5a4e7cede4d23a981b5144ae9c8306274.tar.gz |
lib/oeqa: share get_json_result_dir helper
Multiple places in oeqa need to get the log output path, and redefine a
small helper to accomplish this
Define this helper in lib/oeqa/utils/__init__.py and import it wherever
needed to allow using it.
Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r-- | meta/lib/oeqa/sdk/testsdk.py | 11 | ||||
-rw-r--r-- | meta/lib/oeqa/sdkext/testsdk.py | 3 | ||||
-rw-r--r-- | meta/lib/oeqa/utils/__init__.py | 7 |
3 files changed, 11 insertions, 10 deletions
diff --git a/meta/lib/oeqa/sdk/testsdk.py b/meta/lib/oeqa/sdk/testsdk.py index b4719110ed..518b09febb 100644 --- a/meta/lib/oeqa/sdk/testsdk.py +++ b/meta/lib/oeqa/sdk/testsdk.py @@ -23,14 +23,6 @@ class TestSDKBase(object): return configuration @staticmethod - 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 - - @staticmethod def get_sdk_result_id(configuration): return '%s_%s_%s_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['SDKMACHINE'], configuration['MACHINE'], configuration['STARTTIME']) @@ -72,6 +64,7 @@ class TestSDK(TestSDKBase): from bb.utils import export_proxies from oeqa.utils import make_logger_bitbake_compatible + from oeqa.utils import get_json_result_dir pn = d.getVar("PN") logger = make_logger_bitbake_compatible(logging.getLogger("BitBake")) @@ -134,7 +127,7 @@ class TestSDK(TestSDKBase): component = "%s %s" % (pn, self.context_executor_class.name) context_msg = "%s:%s" % (os.path.basename(tcname), os.path.basename(sdk_env)) configuration = self.get_sdk_configuration(d, self.test_type) - result.logDetails(self.get_sdk_json_result_dir(d), + result.logDetails(get_json_result_dir(d), configuration, self.get_sdk_result_id(configuration)) result.logSummary(component, context_msg) diff --git a/meta/lib/oeqa/sdkext/testsdk.py b/meta/lib/oeqa/sdkext/testsdk.py index 159f0d135b..9d5a99d900 100644 --- a/meta/lib/oeqa/sdkext/testsdk.py +++ b/meta/lib/oeqa/sdkext/testsdk.py @@ -16,6 +16,7 @@ class TestSDKExt(TestSDKBase): from bb.utils import export_proxies from oeqa.utils import avoid_paths_in_environ, make_logger_bitbake_compatible, subprocesstweak from oeqa.sdkext.context import OESDKExtTestContext, OESDKExtTestContextExecutor + from oeqa.utils import get_json_result_dir pn = d.getVar("PN") logger = make_logger_bitbake_compatible(logging.getLogger("BitBake")) @@ -91,7 +92,7 @@ class TestSDKExt(TestSDKBase): component = "%s %s" % (pn, OESDKExtTestContextExecutor.name) context_msg = "%s:%s" % (os.path.basename(tcname), os.path.basename(sdk_env)) configuration = self.get_sdk_configuration(d, 'sdkext') - result.logDetails(self.get_sdk_json_result_dir(d), + result.logDetails(get_json_result_dir(d), configuration, self.get_sdk_result_id(configuration)) result.logSummary(component, context_msg) diff --git a/meta/lib/oeqa/utils/__init__.py b/meta/lib/oeqa/utils/__init__.py index fbc7f7d525..53bdcbf266 100644 --- a/meta/lib/oeqa/utils/__init__.py +++ b/meta/lib/oeqa/utils/__init__.py @@ -90,3 +90,10 @@ def load_test_components(logger, executor): "_executor_class defined." % (comp_name, comp_context)) return components + +def get_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
\ No newline at end of file |