[tests] [travis-ci] Combine logs on failure #11789

pull jnewbery wants to merge 3 commits into bitcoin:master from jnewbery:pr11779.2 changing 3 files +26 −29
  1. jnewbery commented at 6:47 PM on November 29, 2017: member

    Replaces #11779 . Notes from that PR:

    Currently, when a functional test fails, the debug logs are printed sequentially to the travis log. This makes debugging race conditions based on the travis log hard. Instead, all logs events should be combined and sorted by their timestamp, then appended to the travis log. @MarcoFalke

  2. [tests] Improve logging shutdown and add hint for combine_logs bba1c54edd
  3. Sjors commented at 6:56 PM on November 29, 2017: member

    ConceptACK. The --combinedlogslen option seems quite useful outside of Travis as well.

  4. [tests] [travis-ci] Move Travis functional test log post processing to test_runner dba94ead0c
  5. [tests] Add combinedlogslen argument to test_runner.py
    Instead of calling combine_logs from test_runner when the environment variable
    PYTHON_DEBUG is set, add a combinedlogslen argument. This makes it easier
    to call when running locally, and allows a different length of combined logs
    to be printed.
    ff8a9b068a
  6. in test/functional/test_runner.py:335 in ca6bec03da outdated
     330 | +                # Print the final `combinedlogslen` lines of the combined logs
     331 | +                print('{}Combine the logs and print the last {} lines ...{}'.format(BOLD[1], combined_logs_len, BOLD[0]))
     332 | +                print('\n============')
     333 | +                print('{}Combined log for {}:{}'.format(BOLD[1], testdir, BOLD[0]))
     334 | +                print('============\n')
     335 | +                subprocess.run(["{} -c {} | tail -{}".format(tests_dir + './combine_logs.py', testdir, combined_logs_len)], shell=True, universal_newlines=True)
    


    MarcoFalke commented at 7:28 PM on November 29, 2017:

    Sorry I missed this when looking at that branch initially, but I doubt this will work on Windows.

    Since there are plans to work on native Windows builds (https://github.com/bitcoin/bitcoin/pull/11526#issuecomment-345606323) and hopefully tests, I'd prefer if we avoided the code churn.


    MarcoFalke commented at 8:11 PM on November 29, 2017:

    Also, subprocess.run was introduced in python 3.5. However, our supported version is 3.4


    jnewbery commented at 8:15 PM on November 29, 2017:

    yeah - I noticed that too :(

    Pushed a new version which I think should fix both problems:

    • use subprocess.Popen().communicate()
    • don't use the braindead shell=True argument and actually pass in arguments to the subprocess properly
  7. jnewbery force-pushed on Nov 29, 2017
  8. MarcoFalke commented at 8:49 PM on November 29, 2017: member

    utACK ff8a9b068ae15c569ce66abb58bf6f909b879a7d.

    Should also work on travis: C.f. the red ones in https://travis-ci.org/MarcoFalke/bitcoin/builds/309170074

  9. MarcoFalke added this to the milestone 0.16.0 on Nov 29, 2017
  10. jnewbery commented at 9:07 PM on November 29, 2017: member

    Thanks @MarcoFalke - good to know!

    I haven't tested this on windows and I don't have a windows test environment to hand. Is someone able to do that?

  11. MarcoFalke commented at 9:32 PM on November 29, 2017: member

    @jnewbery We are using some non-windows code in other places, so I'd be surprised to see it running on Windows with current master.

  12. fanquake added the label Tests on Nov 29, 2017
  13. laanwj commented at 12:40 PM on November 30, 2017: member

    I'm fairly sure that this way of launching another python script does not work on windows (because there is no #! interpreter handling). But yeah, as we don't run Travis on windows, I don't think it should prevent this from getting merged. Easy enough to just avoid the option if it doesn't work if you run manually.

    utACK ff8a9b0

  14. laanwj merged this on Nov 30, 2017
  15. laanwj closed this on Nov 30, 2017

  16. laanwj referenced this in commit 60d739eb49 on Nov 30, 2017
  17. jnewbery commented at 12:51 PM on November 30, 2017: member

    I'm fairly sure that this way of launching another python script does not work on windows (because there is no #! interpreter handling)

    Good point. I think that's right, which I think means that test_runner.py wouldn't work at all on windows - the tests themselves are invoked in the same way.

    If we want to modify this to work on windows I think we'd need to modify all those calls to push python to the head of the args list in all those calls to subprocess

  18. jnewbery deleted the branch on Nov 30, 2017
  19. laanwj commented at 5:01 PM on November 30, 2017: member

    If we want to modify this to work on windows I think we'd need to modify all those calls to push python to the head of the args list in all those calls to subprocess

    Right. Handling this in a fully portable way is non-trivial - you'd have to figure out what the current interpreter is, and start the script with that. Not sure what the canonical way is. Would warrant an utility function in itself.

  20. jnewbery commented at 5:11 PM on November 30, 2017: member

    Python launcher for windows: https://docs.python.org/3/using/windows.html#python-launcher-for-windows should help. If the test_runner is launched with the launcher and all the scripts have the same shebang, then I think they'd use the same interpreter.

  21. PastaPastaPasta referenced this in commit 0f82d42f98 on Jun 13, 2020
  22. PastaPastaPasta referenced this in commit 2a4d173ac2 on Jun 13, 2020
  23. PastaPastaPasta referenced this in commit 45c3f9c700 on Jun 14, 2020
  24. PastaPastaPasta referenced this in commit 34e2aea6cb on Jun 17, 2020
  25. PastaPastaPasta referenced this in commit d6be14cefa on Jun 17, 2020
  26. PastaPastaPasta referenced this in commit c659501f08 on Jun 17, 2020
  27. PastaPastaPasta referenced this in commit 219ff3901f on Jun 17, 2020
  28. DrahtBot locked this on Sep 8, 2021

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 09:15 UTC

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