ci: Fix and enable tests on Windows #22922

pull MarcoFalke wants to merge 2 commits into bitcoin:master from MarcoFalke:2109-testWin changing 6 files +40 −18
  1. MarcoFalke commented at 4:59 PM on September 8, 2021: member

    Only a cherry-picked list. --extended can be enabled in a follow-up.

  2. test: Fix tests on Windows fadecbd9a4
  3. MarcoFalke commented at 5:14 PM on September 8, 2021: member

    In the tests that use the P2P interface, I am running into event loop (garbage collection) issues, but this hack works around them:

    diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
    index f382e0fdb3..0b7ef1c803 100755
    --- a/test/functional/test_framework/test_framework.py
    +++ b/test/functional/test_framework/test_framework.py
    @@ -152,7 +152,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
                 self.success = TestStatus.FAILED
             finally:
                 exit_code = self.shutdown()
    -            sys.exit(exit_code)
    +            os._exit(exit_code)
     
         def parse_args(self):
             previous_releases_path = os.getenv("PREVIOUS_RELEASES_DIR") or os.getcwd() + "/releases"
    
  4. hebasto commented at 5:32 PM on September 8, 2021: member

    Concept ACK.

    In the tests that use the P2P interface, I am running into event loop (garbage collection) issues...

    I also saw such issues while working on the same problem.

    ... but this hack works around them:

    That is great! Any link to an explanation or so (just curios)?

  5. hebasto commented at 5:34 PM on September 8, 2021: member

    https://api.cirrus-ci.com/v1/task/5800162858631168/logs/functional_tests.log:

    
    C:\Users\ContainerAdministrator\AppData\Local\Temp\cirrus-ci-build>call python test\functional\test_runner.py --ci --quiet --combinedlogslen=4000 --jobs=4 --timeout-factor=8 rpc_help,feature_config_args,rpc_signer,tool_wallet,feature_presegwit_node_upgrade --failfast 
    WARNING! Test 'rpc_help,feature_config_args,rpc_signer,tool_wallet,feature_presegwit_node_upgrade' not found in full test list.
    No valid test scripts specified. Check that your test is in one of the test lists in test_runner.py, or run test_runner.py with no arguments to run all tests
    
    C:\Users\ContainerAdministrator\AppData\Local\Temp\cirrus-ci-build>if 0 NEQ 0 exit /b 0 
    
  6. MarcoFalke force-pushed on Sep 8, 2021
  7. MarcoFalke commented at 6:09 PM on September 8, 2021: member

    That is great! Any link to an explanation or so (just curios)?

    I have no idea, but os._exit might skip the garbage collector.

  8. DrahtBot added the label Tests on Sep 8, 2021
  9. hebasto commented at 6:36 PM on September 8, 2021: member

    "Win64 native" is GREEN :tiger2:

  10. in .cirrus.yml:131 in fa86222cc4 outdated
     128 | @@ -131,6 +129,7 @@ task:
     129 |    install_python_script:
     130 |      - choco install --yes --no-progress python3 --version=3.9.6
     131 |      - python -VV
     132 | +    - pip install zmq
    


    hebasto commented at 6:39 PM on September 8, 2021:

    Maybe

        - pip install zmq
        - python -VV
    

    to easy spot the installed python version?

  11. cirrus: Enable tests on windows fa0c194db3
  12. MarcoFalke force-pushed on Sep 8, 2021
  13. hebasto commented at 7:29 PM on September 8, 2021: member

    Almost ACK fa0c194db34e776ddc68d8f585b7d66162c2617c

    Locally I've got an error:

    Arguments: ()
    --- Logging error ---
    Traceback (most recent call last):
      File "C:\Python39\lib\logging\__init__.py", line 1082, in emit
        stream.write(msg + self.terminator)
      File "C:\Python39\lib\encodings\cp1252.py", line 19, in encode
        return codecs.charmap_encode(input,self.errors,encoding_table)[0]
    UnicodeEncodeError: 'charmap' codec can't encode character '\u20bf' in position 110: character maps to <undefined>
    Call stack:
      File "C:\Users\hebasto\bitcoin\test\functional\feature_presegwit_node_upgrade.py", line 57, in <module>
        SegwitUpgradeTest().main()
      File "C:\Users\hebasto\bitcoin\test\functional\test_framework\test_framework.py", line 154, in main
        exit_code = self.shutdown()
      File "C:\Users\hebasto\bitcoin\test\functional\test_framework\test_framework.py", line 314, in shutdown
        self.log.info("Cleaning up {} on exit".format(self.options.tmpdir))
    Message: 'Cleaning up C:\\Users\\hebasto\\AppData\\Local\\Temp\\test_runner_\u20bf_\U0001f3c3_20210908_221814\\feature_presegwit_node_upgrade_0 on exit'
    Arguments: ()
    

    I think, the python setup on my Windows machine is broken somehow.


    UPDATE: Sorry for my mistake. Just forgot to set PYTHONUTF8=1.

  14. hebasto approved
  15. hebasto commented at 9:10 PM on September 8, 2021: member

    ACK fa0c194db34e776ddc68d8f585b7d66162c2617c, tested locally on Windows 10 Pro 20H2 (build 19042.1165):

    >python test\functional\test_runner.py --ci --quiet --combinedlogslen=4000 --jobs=4 --timeout-factor=8 rpc_help feature_config_args rpc_signer feature_presegwit_node_upgrade "tool_wallet.py --descriptors" --failfast
    Running Unit Tests for Test Framework Modules
    ..........
    ----------------------------------------------------------------------
    Ran 10 tests in 0.769s
    
    OK
    Remaining jobs: [rpc_help.py, feature_config_args.py, feature_presegwit_node_upgrade.py, tool_wallet.py --descriptors]
    Remaining jobs: [rpc_help.py, feature_config_args.py, tool_wallet.py --descriptors]
    Remaining jobs: [feature_config_args.py, tool_wallet.py --descriptors]
    Remaining jobs: [tool_wallet.py --descriptors]
    
    TEST                              | STATUS    | DURATION
    
    feature_config_args.py            | ✓ Passed  | 112 s
    feature_presegwit_node_upgrade.py | ✓ Passed  | 27 s
    rpc_help.py                       | ✓ Passed  | 33 s
    rpc_signer.py                     | ✓ Passed  | 23 s
    tool_wallet.py --descriptors      | ✓ Passed  | 104 s
    
    ALL                               | ✓ Passed  | 299 s (accumulated)
    Runtime: 127 s
    
    
  16. MarcoFalke merged this on Sep 9, 2021
  17. MarcoFalke closed this on Sep 9, 2021

  18. MarcoFalke deleted the branch on Sep 9, 2021
  19. fanquake referenced this in commit b65341555c on Sep 10, 2021
  20. sidhujag referenced this in commit b1659cd807 on Sep 11, 2021
  21. sidhujag referenced this in commit 1d13b0f3b2 on Sep 11, 2021
  22. hebasto commented at 6:13 PM on September 15, 2021: member

    @MarcoFalke

    In the tests that use the P2P interface, I am running into event loop (garbage collection) issues...

    Fixed in #22987.

  23. PastaPastaPasta referenced this in commit bb1b6635e0 on Mar 13, 2022
  24. DrahtBot locked this on Oct 30, 2022

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: 2026-04-17 06:14 UTC

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