wait_for_debug_log is not called using a with statement so the yield returns
the rest of the function as a generator that is never run.
Details
- Reviewers
Fabien - Group Reviewers
Restricted Project - Commits
- rABC3dce76cef88a: Fix wait_for_debug_log acting as a noop
Wrap the "Avalanche invalidated block {tip_to_park}" check with:
with node.assert_debug_log([f"Avalanche invalidated block {tip_to_park}"]):
This fails!
ninja && ./test/functional/test_runner.py abc_p2p_avalanche_voting
Apply this patch and see that it now succeeds as expected.
Diff Detail
- Repository
- rABC Bitcoin ABC
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Failed tests logs:
====== Bitcoin ABC functional tests: feature_init.py ====== ------- Stdout: ------- 2023-02-24T23:06:55.070000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_ _20230224_230515/feature_init_51 2023-02-24T23:06:55.493000Z TestFramework (INFO): Starting node and will exit after line b'Validating signatures for all blocks' 2023-02-24T23:06:55.494000Z TestFramework (ERROR): Unexpected exception caught during testing Traceback (most recent call last): File "/work/test/functional/test_framework/test_framework.py", line 136, in main self.run_test() File "/work/test/functional/feature_init.py", line 79, in run_test with node.wait_for_debug_log([terminate_line]): File "/work/test/functional/test_framework/test_node.py", line 581, in wait_for_debug_log if re.search(re.escape(expected_msg), log, File "/usr/lib/python3.9/re.py", line 201, in search return _compile(pattern, flags).search(string) TypeError: cannot use a bytes pattern on a string-like object 2023-02-24T23:06:55.545000Z TestFramework (INFO): Stopping nodes 2023-02-24T23:06:55.545000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_ _20230224_230515/feature_init_51 2023-02-24T23:06:55.545000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_ _20230224_230515/feature_init_51/test_framework.log 2023-02-24T23:06:55.545000Z TestFramework (ERROR): 2023-02-24T23:06:55.545000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_ _20230224_230515/feature_init_51' to consolidate all logs 2023-02-24T23:06:55.545000Z TestFramework (ERROR): 2023-02-24T23:06:55.545000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log. 2023-02-24T23:06:55.545000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues 2023-02-24T23:06:55.545000Z TestFramework (ERROR):
Each failure log is accessible here:
Bitcoin ABC functional tests: feature_init.py
Failed tests logs:
====== Bitcoin ABC functional tests: feature_init.py ====== ------- Stdout: ------- 2023-02-24T23:08:32.217000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_ _20230224_230444/feature_init_51 2023-02-24T23:08:33.016000Z TestFramework (INFO): Starting node and will exit after line b'Validating signatures for all blocks' 2023-02-24T23:08:33.016000Z TestFramework (ERROR): Unexpected exception caught during testing Traceback (most recent call last): File "/work/test/functional/test_framework/test_framework.py", line 136, in main self.run_test() File "/work/test/functional/feature_init.py", line 79, in run_test with node.wait_for_debug_log([terminate_line]): File "/work/test/functional/test_framework/test_node.py", line 581, in wait_for_debug_log if re.search(re.escape(expected_msg), log, File "/usr/lib/python3.9/re.py", line 201, in search return _compile(pattern, flags).search(string) TypeError: cannot use a bytes pattern on a string-like object 2023-02-24T23:08:33.067000Z TestFramework (INFO): Stopping nodes 2023-02-24T23:08:33.067000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_ _20230224_230444/feature_init_51 2023-02-24T23:08:33.067000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_ _20230224_230444/feature_init_51/test_framework.log 2023-02-24T23:08:33.068000Z TestFramework (ERROR): 2023-02-24T23:08:33.068000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_ _20230224_230444/feature_init_51' to consolidate all logs 2023-02-24T23:08:33.068000Z TestFramework (ERROR): 2023-02-24T23:08:33.068000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log. 2023-02-24T23:08:33.068000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues 2023-02-24T23:08:33.068000Z TestFramework (ERROR):
Each failure log is accessible here:
Bitcoin ABC functional tests: feature_init.py
Failed tests logs:
====== Bitcoin ABC functional tests: feature_init.py ====== ------- Stdout: ------- 2023-02-24T23:06:48.835000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_ _20230224_230357/feature_init_51 2023-02-24T23:06:49.520000Z TestFramework (INFO): Starting node and will exit after line b'Validating signatures for all blocks' 2023-02-24T23:06:49.522000Z TestFramework (ERROR): Unexpected exception caught during testing Traceback (most recent call last): File "/work/test/functional/test_framework/test_framework.py", line 136, in main self.run_test() File "/work/test/functional/feature_init.py", line 79, in run_test with node.wait_for_debug_log([terminate_line]): File "/work/test/functional/test_framework/test_node.py", line 581, in wait_for_debug_log if re.search(re.escape(expected_msg), log, File "/usr/lib/python3.9/re.py", line 201, in search return _compile(pattern, flags).search(string) TypeError: cannot use a bytes pattern on a string-like object 2023-02-24T23:06:49.576000Z TestFramework (INFO): Stopping nodes 2023-02-24T23:06:49.577000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_ _20230224_230357/feature_init_51 2023-02-24T23:06:49.577000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_ _20230224_230357/feature_init_51/test_framework.log 2023-02-24T23:06:49.577000Z TestFramework (ERROR): 2023-02-24T23:06:49.578000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_ _20230224_230357/feature_init_51' to consolidate all logs 2023-02-24T23:06:49.578000Z TestFramework (ERROR): 2023-02-24T23:06:49.578000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log. 2023-02-24T23:06:49.578000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues 2023-02-24T23:06:49.579000Z TestFramework (ERROR): ====== Bitcoin ABC functional tests with the next upgrade activated: feature_init.py ====== ------- Stdout: ------- 2023-02-24T23:11:28.472000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_ _20230224_230846/feature_init_51 2023-02-24T23:11:28.983000Z TestFramework (INFO): Starting node and will exit after line b'Validating signatures for all blocks' 2023-02-24T23:11:28.984000Z TestFramework (ERROR): Unexpected exception caught during testing Traceback (most recent call last): File "/work/test/functional/test_framework/test_framework.py", line 136, in main self.run_test() File "/work/test/functional/feature_init.py", line 79, in run_test with node.wait_for_debug_log([terminate_line]): File "/work/test/functional/test_framework/test_node.py", line 581, in wait_for_debug_log if re.search(re.escape(expected_msg), log, File "/usr/lib/python3.9/re.py", line 201, in search return _compile(pattern, flags).search(string) TypeError: cannot use a bytes pattern on a string-like object 2023-02-24T23:11:29.035000Z TestFramework (INFO): Stopping nodes 2023-02-24T23:11:29.035000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_ _20230224_230846/feature_init_51 2023-02-24T23:11:29.035000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_ _20230224_230846/feature_init_51/test_framework.log 2023-02-24T23:11:29.035000Z TestFramework (ERROR): 2023-02-24T23:11:29.035000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_ _20230224_230846/feature_init_51' to consolidate all logs 2023-02-24T23:11:29.036000Z TestFramework (ERROR): 2023-02-24T23:11:29.036000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log. 2023-02-24T23:11:29.036000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues 2023-02-24T23:11:29.036000Z TestFramework (ERROR):
Each failure log is accessible here:
Bitcoin ABC functional tests: feature_init.py
Bitcoin ABC functional tests with the next upgrade activated: feature_init.py
See D12624 for why the log is read as a binary file.
tldr; file truncation can break the unicode encoding.
An alternative to treating everything as bytes would be to set the errors argument of open to something else than strict
https://docs.python.org/3/library/functions.html#open
I might be missing something, but I don't think this diff does anything. The callback is not expected to be part of the context, so it works without the with statement.