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:43 +0000 |
| commit | fec128bd625dbbb5a239d6ff6999e1e4a41a5a9b (patch) | |
| tree | b0e556d80ad837575227a7c83d447dfa48da4136 /meta/classes-recipe | |
| parent | 031099c417a61d6e7db2cf7bf02f69650179b7e8 (diff) | |
| download | poky-fec128bd625dbbb5a239d6ff6999e1e4a41a5a9b.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.
(From OE-Core rev: 01b1a6a5a4e7cede4d23a981b5144ae9c8306274)
Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe')
| -rw-r--r-- | meta/classes-recipe/testimage.bbclass | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/meta/classes-recipe/testimage.bbclass b/meta/classes-recipe/testimage.bbclass index d076102f96..959c226072 100644 --- a/meta/classes-recipe/testimage.bbclass +++ b/meta/classes-recipe/testimage.bbclass | |||
| @@ -149,13 +149,6 @@ def get_testimage_configuration(d, test_type, machine): | |||
| 149 | return configuration | 149 | return configuration |
| 150 | get_testimage_configuration[vardepsexclude] = "DATETIME" | 150 | get_testimage_configuration[vardepsexclude] = "DATETIME" |
| 151 | 151 | ||
| 152 | def get_testimage_json_result_dir(d): | ||
| 153 | json_result_dir = os.path.join(d.getVar("LOG_DIR"), 'oeqa') | ||
| 154 | custom_json_result_dir = d.getVar("OEQA_JSON_RESULT_DIR") | ||
| 155 | if custom_json_result_dir: | ||
| 156 | json_result_dir = custom_json_result_dir | ||
| 157 | return json_result_dir | ||
| 158 | |||
| 159 | def get_testimage_result_id(configuration): | 152 | def get_testimage_result_id(configuration): |
| 160 | return '%s_%s_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['MACHINE'], configuration['STARTTIME']) | 153 | return '%s_%s_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['MACHINE'], configuration['STARTTIME']) |
| 161 | 154 | ||
| @@ -224,6 +217,7 @@ def testimage_main(d): | |||
| 224 | from oeqa.core.target.qemu import supported_fstypes | 217 | from oeqa.core.target.qemu import supported_fstypes |
| 225 | from oeqa.core.utils.test import getSuiteCases | 218 | from oeqa.core.utils.test import getSuiteCases |
| 226 | from oeqa.utils import make_logger_bitbake_compatible | 219 | from oeqa.utils import make_logger_bitbake_compatible |
| 220 | from oeqa.utils import get_json_result_dir | ||
| 227 | 221 | ||
| 228 | def sigterm_exception(signum, stackframe): | 222 | def sigterm_exception(signum, stackframe): |
| 229 | """ | 223 | """ |
| @@ -426,14 +420,14 @@ def testimage_main(d): | |||
| 426 | # Show results (if we have them) | 420 | # Show results (if we have them) |
| 427 | if results: | 421 | if results: |
| 428 | configuration = get_testimage_configuration(d, 'runtime', machine) | 422 | configuration = get_testimage_configuration(d, 'runtime', machine) |
| 429 | results.logDetails(get_testimage_json_result_dir(d), | 423 | results.logDetails(get_json_result_dir(d), |
| 430 | configuration, | 424 | configuration, |
| 431 | get_testimage_result_id(configuration), | 425 | get_testimage_result_id(configuration), |
| 432 | dump_streams=d.getVar('TESTREPORT_FULLLOGS')) | 426 | dump_streams=d.getVar('TESTREPORT_FULLLOGS')) |
| 433 | results.logSummary(pn) | 427 | results.logSummary(pn) |
| 434 | 428 | ||
| 435 | # Copy additional logs to tmp/log/oeqa so it's easier to find them | 429 | # Copy additional logs to tmp/log/oeqa so it's easier to find them |
| 436 | targetdir = os.path.join(get_testimage_json_result_dir(d), d.getVar("PN")) | 430 | targetdir = os.path.join(get_json_result_dir(d), d.getVar("PN")) |
| 437 | os.makedirs(targetdir, exist_ok=True) | 431 | os.makedirs(targetdir, exist_ok=True) |
| 438 | os.symlink(bootlog, os.path.join(targetdir, os.path.basename(bootlog))) | 432 | os.symlink(bootlog, os.path.join(targetdir, os.path.basename(bootlog))) |
| 439 | os.symlink(d.getVar("BB_LOGFILE"), os.path.join(targetdir, os.path.basename(d.getVar("BB_LOGFILE") + "." + d.getVar('DATETIME')))) | 433 | os.symlink(d.getVar("BB_LOGFILE"), os.path.join(targetdir, os.path.basename(d.getVar("BB_LOGFILE") + "." + d.getVar('DATETIME')))) |
