diff options
| author | Yoann Congal <yoann.congal@smile.fr> | 2025-01-12 01:23:10 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-01-14 11:57:52 +0000 |
| commit | 15ebdb6fcc321aa4980d70e291fd34c1e57ea936 (patch) | |
| tree | 3d0067241ec34176ed838fa4bf5808f5e6cf5896 /meta/lib/oeqa | |
| parent | 94d88ed23abd95530c2b891c314dad93fa23fcda (diff) | |
| download | poky-15ebdb6fcc321aa4980d70e291fd34c1e57ea936.tar.gz | |
selftest/reproducible: Print error context on failure
Printed logs during the reproducible test look like this in case of
failure:
2025-01-12 00:39:00,807 - oe-selftest - INFO - Building reproducibleA (sstate allowed)...
2025-01-12 00:40:08,323 - oe-selftest - ERROR - Bitbake failed! but keep going... Log:
2025-01-12 00:40:08,323 - oe-selftest - INFO - Found ERROR (line 126):
2025-01-12 00:40:08,323 - oe-selftest - INFO - NOTE: recipe opkg-utils-native-0.7.0-r0: task do_populate_sysroot_setscene: Succeeded
2025-01-12 00:40:08,323 - oe-selftest - INFO - NOTE: Running setscene task 74 of 333 (virtual:native:.../poky/meta/recipes-devtools/opkg-utils/opkg-utils_0.7.0.bb:do_recipe_qa_setscene)
2025-01-12 00:40:08,323 - oe-selftest - INFO - NOTE: recipe bash-5.2.37-r0: task do_populate_sysroot_setscene: Succeeded
2025-01-12 00:40:08,323 - oe-selftest - INFO - NOTE: recipe cve-update-nvd2-native-1.0-r0: task do_unpack: Succeeded
2025-01-12 00:40:08,323 - oe-selftest - INFO - NOTE: Running task 4 of 974 (.../poky/meta/recipes-core/hello-single/hello-fail_1.0.bb:do_cve_check)
2025-01-12 00:40:08,323 - oe-selftest - INFO - NOTE: recipe bash-5.2.37-r0: task do_packagedata_setscene: Succeeded
2025-01-12 00:40:08,323 - oe-selftest - INFO - NOTE: recipe hello-fail-1.0-r0: task do_packagedata_setscene: Started
2025-01-12 00:40:08,323 - oe-selftest - INFO - NOTE: Running setscene task 77 of 333 (.../poky/meta/recipes-extended/bash/bash_5.2.37.bb:do_recipe_qa_setscene)
2025-01-12 00:40:08,323 - oe-selftest - INFO - NOTE: Running setscene task 78 of 333 (.../poky/meta/recipes-core/ncurses/ncurses_6.5.bb:do_populate_sysroot_setscene)
2025-01-12 00:40:08,324 - oe-selftest - INFO - NOTE: recipe hello-fail-1.0-r0: task do_populate_sysroot_setscene: Started
2025-01-12 00:40:08,324 - oe-selftest - INFO - ERROR: hello-fail-1.0-r0 do_populate_sysroot_setscene: this is an error
2025-01-12 00:40:08,324 - oe-selftest - INFO - ERROR: hello-fail-1.0-r0 do_populate_sysroot_setscene: Error executing a python function in exec_func_python() autogenerated:
2025-01-12 00:40:08,324 - oe-selftest - INFO -
2025-01-12 00:40:08,324 - oe-selftest - INFO - The stack trace of python calls that resulted in this exception/failure was:
2025-01-12 00:40:08,324 - oe-selftest - INFO - File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
2025-01-12 00:40:08,324 - oe-selftest - INFO - 0001:
2025-01-12 00:40:08,324 - oe-selftest - INFO - *** 0002:do_populate_sysroot_setscene(d)
2025-01-12 00:40:08,324 - oe-selftest - INFO - 0003:
2025-01-12 00:40:08,324 - oe-selftest - INFO - File: '.../poky/meta/recipes-core/hello-single/hello-fail_1.0.bb', lineno: 17, function: do_populate_sysroot_setscene
2025-01-12 00:40:08,324 - oe-selftest - INFO - 0013:}
2025-01-12 00:40:08,324 - oe-selftest - INFO - Found ERROR (line 127):
2025-01-12 00:40:08,324 - oe-selftest - INFO - NOTE: Running setscene task 74 of 333 (virtual:native:.../poky/meta/recipes-devtools/opkg-utils/opkg-utils_0.7.0.bb:do_recipe_qa_setscene)
2025-01-12 00:40:08,324 - oe-selftest - INFO - NOTE: recipe bash-5.2.37-r0: task do_populate_sysroot_setscene: Succeeded
2025-01-12 00:40:08,324 - oe-selftest - INFO - NOTE: recipe cve-update-nvd2-native-1.0-r0: task do_unpack: Succeeded
2025-01-12 00:40:08,324 - oe-selftest - INFO - NOTE: Running task 4 of 974 (.../poky/meta/recipes-core/hello-single/hello-fail_1.0.bb:do_cve_check)
2025-01-12 00:40:08,324 - oe-selftest - INFO - NOTE: recipe bash-5.2.37-r0: task do_packagedata_setscene: Succeeded
2025-01-12 00:40:08,324 - oe-selftest - INFO - NOTE: recipe hello-fail-1.0-r0: task do_packagedata_setscene: Started
2025-01-12 00:40:08,324 - oe-selftest - INFO - NOTE: Running setscene task 77 of 333 (.../poky/meta/recipes-extended/bash/bash_5.2.37.bb:do_recipe_qa_setscene)
2025-01-12 00:40:08,324 - oe-selftest - INFO - NOTE: Running setscene task 78 of 333 (.../poky/meta/recipes-core/ncurses/ncurses_6.5.bb:do_populate_sysroot_setscene)
2025-01-12 00:40:08,324 - oe-selftest - INFO - NOTE: recipe hello-fail-1.0-r0: task do_populate_sysroot_setscene: Started
2025-01-12 00:40:08,324 - oe-selftest - INFO - ERROR: hello-fail-1.0-r0 do_populate_sysroot_setscene: this is an error
2025-01-12 00:40:08,324 - oe-selftest - INFO - ERROR: hello-fail-1.0-r0 do_populate_sysroot_setscene: Error executing a python function in exec_func_python() autogenerated:
2025-01-12 00:40:08,325 - oe-selftest - INFO -
2025-01-12 00:40:08,325 - oe-selftest - INFO - The stack trace of python calls that resulted in this exception/failure was:
2025-01-12 00:40:08,325 - oe-selftest - INFO - File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
2025-01-12 00:40:08,325 - oe-selftest - INFO - 0001:
2025-01-12 00:40:08,325 - oe-selftest - INFO - *** 0002:do_populate_sysroot_setscene(d)
2025-01-12 00:40:08,325 - oe-selftest - INFO - 0003:
2025-01-12 00:40:08,325 - oe-selftest - INFO - File: '.../poky/meta/recipes-core/hello-single/hello-fail_1.0.bb', lineno: 17, function: do_populate_sysroot_setscene
2025-01-12 00:40:08,325 - oe-selftest - INFO - 0013:}
2025-01-12 00:40:08,325 - oe-selftest - INFO - 0014:
2025-01-12 00:40:08,325 - oe-selftest - INFO - End of log:
2025-01-12 00:40:08,325 - oe-selftest - INFO - NOTE: Running task 955 of 974 (.../poky/meta/recipes-core/hello-single/hello-fail_1.0.bb:do_populate_sysroot)
2025-01-12 00:40:08,325 - oe-selftest - INFO - NOTE: recipe hello-fail-1.0-r0: task do_populate_sysroot: Started
2025-01-12 00:40:08,325 - oe-selftest - INFO - NOTE: recipe hello-fail-1.0-r0: task do_populate_sysroot: Succeeded
2025-01-12 00:40:08,325 - oe-selftest - INFO - NOTE: Running noexec task 973 of 974 (.../poky/meta/recipes-core/hello-single/hello-fail_1.0.bb:do_build)
2025-01-12 00:40:08,325 - oe-selftest - INFO - NOTE: Running noexec task 974 of 974 (.../poky/meta/recipes-core/hello-single/hello-norepro_1.0.bb:do_build)
2025-01-12 00:40:08,325 - oe-selftest - INFO - NOTE: Tasks Summary: Attempted 974 tasks of which 958 didn't need to be rerun and all succeeded.
2025-01-12 00:40:08,325 - oe-selftest - INFO - NOTE: Generating JSON CVE summary
2025-01-12 00:40:08,325 - oe-selftest - INFO - Complete CVE JSON report summary created at: .../poky/build-master-st/reproducibleA/tmp/log/cve/cve-summary.json
2025-01-12 00:40:08,325 - oe-selftest - INFO -
2025-01-12 00:40:08,325 - oe-selftest - INFO - Summary: There were 2 ERROR messages, returning a non-zero exit code.
2025-01-12 00:40:08,326 - oe-selftest - ERROR - reproducibleA build failed. Trying to compute built packages differences but the test will fail.
Fixes [YOCTO #15655] (second half).
(From OE-Core rev: b3bc820e58b65a976e0abce85fcdffd067697ecf)
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/reproducible.py | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/meta/lib/oeqa/selftest/cases/reproducible.py b/meta/lib/oeqa/selftest/cases/reproducible.py index 9597d76697..3fb0e5ee5b 100644 --- a/meta/lib/oeqa/selftest/cases/reproducible.py +++ b/meta/lib/oeqa/selftest/cases/reproducible.py | |||
| @@ -239,18 +239,31 @@ class ReproducibleTests(OESelftestTestCase): | |||
| 239 | # may reuse the previous log file so restart the bitbake server. | 239 | # may reuse the previous log file so restart the bitbake server. |
| 240 | bitbake("--kill-server") | 240 | bitbake("--kill-server") |
| 241 | 241 | ||
| 242 | def print_condensed_error_log(logs, context_lines=10, tail_lines=20): | ||
| 243 | """Prints errors with context and the end of the log.""" | ||
| 244 | |||
| 245 | logs = logs.split("\n") | ||
| 246 | for i, line in enumerate(logs): | ||
| 247 | if line.startswith("ERROR"): | ||
| 248 | self.logger.info("Found ERROR (line %d):" % (i + 1)) | ||
| 249 | for l in logs[i-context_lines:i+context_lines]: | ||
| 250 | self.logger.info(" " + l) | ||
| 251 | |||
| 252 | self.logger.info("End of log:") | ||
| 253 | for l in logs[-tail_lines:]: | ||
| 254 | self.logger.info(" " + l) | ||
| 255 | |||
| 242 | bitbake_failure_count = 0 | 256 | bitbake_failure_count = 0 |
| 243 | if not use_sstate: | 257 | if not use_sstate: |
| 244 | if self.sstate_targets: | 258 | if self.sstate_targets: |
| 245 | self.logger.info("Building prebuild for %s (sstate allowed)..." % (name)) | 259 | self.logger.info("Building prebuild for %s (sstate allowed)..." % (name)) |
| 246 | self.write_config(config) | 260 | self.write_config(config) |
| 247 | try: | 261 | try: |
| 248 | bitbake("--continue "+' '.join(self.sstate_targets), limit_exc_output=20) | 262 | bitbake("--continue "+' '.join(self.sstate_targets)) |
| 249 | except AssertionError as e: | 263 | except AssertionError as e: |
| 250 | bitbake_failure_count += 1 | 264 | bitbake_failure_count += 1 |
| 251 | self.logger.error("Bitbake failed! but keep going... Log:") | 265 | self.logger.error("Bitbake failed! but keep going... Log:") |
| 252 | for line in str(e).split("\n"): | 266 | print_condensed_error_log(str(e)) |
| 253 | self.logger.info(" "+line) | ||
| 254 | 267 | ||
| 255 | # This config fragment will disable using shared and the sstate | 268 | # This config fragment will disable using shared and the sstate |
| 256 | # mirror, forcing a complete build from scratch | 269 | # mirror, forcing a complete build from scratch |
| @@ -264,13 +277,11 @@ class ReproducibleTests(OESelftestTestCase): | |||
| 264 | d = get_bb_vars(capture_vars) | 277 | d = get_bb_vars(capture_vars) |
| 265 | # targets used to be called images | 278 | # targets used to be called images |
| 266 | try: | 279 | try: |
| 267 | bitbake("--continue "+' '.join(getattr(self, 'images', self.targets)), limit_exc_output=20) | 280 | bitbake("--continue "+' '.join(getattr(self, 'images', self.targets))) |
| 268 | except AssertionError as e: | 281 | except AssertionError as e: |
| 269 | bitbake_failure_count += 1 | 282 | bitbake_failure_count += 1 |
| 270 | |||
| 271 | self.logger.error("Bitbake failed! but keep going... Log:") | 283 | self.logger.error("Bitbake failed! but keep going... Log:") |
| 272 | for line in str(e).split("\n"): | 284 | print_condensed_error_log(str(e)) |
| 273 | self.logger.info(" "+line) | ||
| 274 | 285 | ||
| 275 | # The calling function expects the existence of the deploy | 286 | # The calling function expects the existence of the deploy |
| 276 | # directories containing the packages. | 287 | # directories containing the packages. |
