qa: Use sys.executable when invoking other Python scripts #31541

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:241219-qa-signers changing 2 files +6 −17
  1. hebasto commented at 4:06 pm on December 19, 2024: member

    This PR fixes the rpc_signer.py and wallet_signer.py functional tests on systems where python3 is not available in the PATH, causing the shebang #!/usr/bin/env python3 to fail.

    Here are logs on NetBSD 10.0:

    • without this PR (only #31537 branch):
     0$ python3.12 ./build/test/functional/test_runner.py rpc_signer.py wallet_signer.py
     1Temporary test directory at /tmp/test_runner__🏃_20241219_160538
     2Remaining jobs: [rpc_signer.py, wallet_signer.py --descriptors]
     31/2 - rpc_signer.py failed, Duration: 1 s
     4
     5stdout:
     62024-12-19T16:05:40.012000Z TestFramework (INFO): PRNG seed is: 1833166631173850775
     72024-12-19T16:05:40.012000Z TestFramework (INFO): Initializing test directory /tmp/test_runner__🏃_20241219_160538/rpc_signer_1
     82024-12-19T16:05:40.754000Z TestFramework (ERROR): Assertion failed
     9Traceback (most recent call last):
    10  File "/home/hebasto/dev/bitcoin/test/functional/test_framework/util.py", line 160, in try_rpc
    11    fun(*args, **kwds)
    12  File "/home/hebasto/dev/bitcoin/test/functional/test_framework/coverage.py", line 50, in __call__
    13    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
    14                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    15  File "/home/hebasto/dev/bitcoin/test/functional/test_framework/authproxy.py", line 146, in __call__
    16    raise JSONRPCException(response['error'], status)
    17test_framework.authproxy.JSONRPCException: RunCommandParseJSON error: process(/home/hebasto/dev/bitcoin/test/functional/mocks/signer.py enumerate) returned 127: env: python3: No such file or directory
    18 (-1)
    19
    20During handling of the above exception, another exception occurred:
    21
    22Traceback (most recent call last):
    23  File "/home/hebasto/dev/bitcoin/test/functional/test_framework/test_framework.py", line 135, in main
    24    self.run_test()
    25  File "/home/hebasto/dev/bitcoin/build/test/functional/rpc_signer.py", line 72, in run_test
    26    assert_raises_rpc_error(-1, 'fingerprint not found',
    27  File "/home/hebasto/dev/bitcoin/test/functional/test_framework/util.py", line 151, in assert_raises_rpc_error
    28    assert try_rpc(code, message, fun, *args, **kwds), "No exception raised"
    29           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    30  File "/home/hebasto/dev/bitcoin/test/functional/test_framework/util.py", line 166, in try_rpc
    31    raise AssertionError(
    32AssertionError: Expected substring not found in error message:
    33substring: 'fingerprint not found'
    34error message: 'RunCommandParseJSON error: process(/home/hebasto/dev/bitcoin/test/functional/mocks/signer.py enumerate) returned 127: env: python3: No such file or directory
    35'.
    362024-12-19T16:05:40.756000Z TestFramework (INFO): Stopping nodes
    372024-12-19T16:05:40.873000Z TestFramework (WARNING): Not cleaning up dir /tmp/test_runner__🏃_20241219_160538/rpc_signer_1
    382024-12-19T16:05:40.873000Z TestFramework (ERROR): Test failed. Test logging available at /tmp/test_runner__🏃_20241219_160538/rpc_signer_1/test_framework.log
    392024-12-19T16:05:40.873000Z TestFramework (ERROR): 
    402024-12-19T16:05:40.873000Z TestFramework (ERROR): Hint: Call /home/hebasto/dev/bitcoin/test/functional/combine_logs.py '/tmp/test_runner_₿_🏃_20241219_160538/rpc_signer_1' to consolidate all logs
    412024-12-19T16:05:40.873000Z TestFramework (ERROR): 
    422024-12-19T16:05:40.873000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
    432024-12-19T16:05:40.873000Z TestFramework (ERROR): https://github.com/bitcoin/bitcoin/issues
    442024-12-19T16:05:40.873000Z TestFramework (ERROR): 
    45
    46
    47stderr:
    48
    49
    50Remaining jobs: [wallet_signer.py --descriptors]
    512/2 - wallet_signer.py --descriptors failed, Duration: 1 s
    52
    53stdout:
    542024-12-19T16:05:40.014000Z TestFramework (INFO): PRNG seed is: 7530764367977090686
    552024-12-19T16:05:40.014000Z TestFramework (INFO): Initializing test directory /tmp/test_runner__🏃_20241219_160538/wallet_signer_0
    562024-12-19T16:05:40.526000Z TestFramework (ERROR): JSONRPC error
    57Traceback (most recent call last):
    58  File "/home/hebasto/dev/bitcoin/test/functional/test_framework/test_framework.py", line 135, in main
    59    self.run_test()
    60  File "/home/hebasto/dev/bitcoin/build/test/functional/wallet_signer.py", line 66, in run_test
    61    self.test_valid_signer()
    62  File "/home/hebasto/dev/bitcoin/build/test/functional/wallet_signer.py", line 83, in test_valid_signer
    63    self.nodes[1].createwallet(wallet_name='hww', disable_private_keys=True, descriptors=True, external_signer=True)
    64  File "/home/hebasto/dev/bitcoin/test/functional/test_framework/test_node.py", line 935, in createwallet
    65    return self.__getattr__('createwallet')(wallet_name, disable_private_keys, blank, passphrase, avoid_reuse, descriptors, load_on_startup, external_signer)
    66           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    67  File "/home/hebasto/dev/bitcoin/test/functional/test_framework/coverage.py", line 50, in __call__
    68    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
    69                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    70  File "/home/hebasto/dev/bitcoin/test/functional/test_framework/authproxy.py", line 146, in __call__
    71    raise JSONRPCException(response['error'], status)
    72test_framework.authproxy.JSONRPCException: RunCommandParseJSON error: process(/home/hebasto/dev/bitcoin/test/functional/mocks/signer.py enumerate) returned 127: env: python3: No such file or directory
    73 (-1)
    742024-12-19T16:05:40.528000Z TestFramework (INFO): Stopping nodes
    752024-12-19T16:05:40.645000Z TestFramework (WARNING): Not cleaning up dir /tmp/test_runner__🏃_20241219_160538/wallet_signer_0
    762024-12-19T16:05:40.646000Z TestFramework (ERROR): Test failed. Test logging available at /tmp/test_runner__🏃_20241219_160538/wallet_signer_0/test_framework.log
    772024-12-19T16:05:40.646000Z TestFramework (ERROR): 
    782024-12-19T16:05:40.646000Z TestFramework (ERROR): Hint: Call /home/hebasto/dev/bitcoin/test/functional/combine_logs.py '/tmp/test_runner_₿_🏃_20241219_160538/wallet_signer_0' to consolidate all logs
    792024-12-19T16:05:40.646000Z TestFramework (ERROR): 
    802024-12-19T16:05:40.646000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
    812024-12-19T16:05:40.646000Z TestFramework (ERROR): https://github.com/bitcoin/bitcoin/issues
    822024-12-19T16:05:40.646000Z TestFramework (ERROR): 
    83
    84
    85stderr:
    86
    87
    88
    89TEST                           | STATUS    | DURATION
    90
    91rpc_signer.py                  |  Failed  | 1 s
    92wallet_signer.py --descriptors |  Failed  | 1 s
    93
    94ALL                            |  Failed  | 2 s (accumulated) 
    95Runtime: 1 s
    
    • with this PR:
     0$ python3.12 ./build/test/functional/test_runner.py rpc_signer.py wallet_signer.py   
     1Temporary test directory at /tmp/test_runner_₿_🏃_20241219_160011
     2Remaining jobs: [rpc_signer.py, wallet_signer.py --descriptors]
     31/2 - rpc_signer.py passed, Duration: 2 s
     4Remaining jobs: [wallet_signer.py --descriptors]
     52/2 - wallet_signer.py --descriptors passed, Duration: 3 s
     6
     7TEST                           | STATUS    | DURATION
     8
     9rpc_signer.py                  | ✓ Passed  | 2 s
    10wallet_signer.py --descriptors | ✓ Passed  | 3 s
    11
    12ALL                            | ✓ Passed  | 5 s (accumulated) 
    13Runtime: 3 s
    
  2. hebasto added the label Tests on Dec 19, 2024
  3. DrahtBot commented at 4:06 pm on December 19, 2024: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/31541.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK maflcko

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  4. hebasto force-pushed on Dec 19, 2024
  5. DrahtBot added the label CI failed on Dec 19, 2024
  6. DrahtBot commented at 4:15 pm on December 19, 2024: contributor

    🚧 At least one of the CI tasks failed. Debug: https://github.com/bitcoin/bitcoin/runs/34664908840

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

  7. maflcko commented at 5:08 pm on December 19, 2024: member
    lgtm. even without netbsd, this is required to pass down the python version that was selected to run the tests. This is also used in all other places in the tests, like https://github.com/bitcoin/bitcoin/blob/bb57017b2945d5e0bbd95c7f1a9369a8ab7c6fcd/test/functional/test_runner.py#L632
  8. qa: Use `sys.executable` when invoking other Python scripts
    This change fixes tests on systems where `python3` is not available
    in the `PATH`, causing the shebang `#!/usr/bin/env python3` to fail.
    d38ade7bc4
  9. hebasto force-pushed on Dec 19, 2024
  10. hebasto marked this as ready for review on Dec 19, 2024
  11. hebasto commented at 5:12 pm on December 19, 2024: member

    lgtm. even without netbsd

    Thanks! Rebased on the master branch.

  12. DrahtBot removed the label CI failed on Dec 19, 2024
  13. hebasto commented at 7:55 pm on December 19, 2024: member
  14. fanquake commented at 11:05 am on December 20, 2024: member

    Tracked in hebasto/bitcoin-core-nightly#6.

    Unless there’s a good reason not too, it’d be good to track issues in our issue tracker, rather than some other repository. Otherwise they are not included in stats tracking, the metadata archives, Core Check dashboards, overall less discoverable etc

  15. maflcko commented at 11:15 am on December 20, 2024: member
    I think in this case it is fine, because each issue has a pull request with an extended description, so it will end up in the metadata backup. But anything should be fine by me.
  16. maflcko commented at 11:16 am on December 20, 2024: member

    lgtm ACK d38ade7bc409207bf425e05ee10b633b0aef4c36

    In theory, the shebang could be removed from the mocks files, to better enforce this, but this could make one of the linters sad, so could be done in a follow-up.

  17. hebasto commented at 11:51 am on December 20, 2024: member
    Friendly ping Python connoisseur @stickies-v :)

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-21 12:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me