test: Reset global args between test suites #17366

pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:1911-testResetGlobals changing 1 files +3 −4
  1. MarcoFalke commented at 4:07 PM on November 4, 2019: member

    Ideally there wouldn't be any globals in Bitcoin Core. However, as we still have globals, they need to be reset between runs of test cases. One way to do this is to run each suite in a different process. make check does that. However, ./src/test/test_bitcoin when run manually or on appveyor is a single process, where all globals are preserved between test cases.

    This leads to hard to debug issues such as #15845#pullrequestreview-310852164.

    Fix that by resetting the global arg for each test suite. Note that this wont reset the arg between test cases, as the constructor/destructor is not called for them.

    Addendum: This is not a general fix, only for -segwitheight. I don't know if clearing all args can be done with today's argsmanager. Nor do I know if it makes sense. Maybe we want datadir set to a temp path to not risk accidentally corrupting the default data dir?

  2. test: Reset global args between test suites fa07b8beb5
  3. fanquake added the label Tests on Nov 4, 2019
  4. MarcoFalke commented at 4:09 PM on November 4, 2019: member

    Thanks to @mzumsande for debugging this

  5. laanwj commented at 4:32 PM on November 4, 2019: member

    ACK fa07b8beb598642655b1207afd275b801ff8cec2

  6. practicalswift commented at 4:39 PM on November 4, 2019: contributor

    Fix that by resetting the global arg for each test suite. Note that this wont reset the arg between test cases, as the constructor/destructor is not called for them.

    Could clarify in OP or title that this is not a general fix? In other words it applies only to -segwitheight specifically, right? :)

  7. MarcoFalke commented at 4:43 PM on November 4, 2019: member
  8. practicalswift commented at 4:53 PM on November 4, 2019: contributor

    ACK fa07b8beb598642655b1207afd275b801ff8cec2

  9. practicalswift commented at 5:06 PM on November 4, 2019: contributor

    To catch similar cases going forward: perhaps we could run src/test/test_bitcoin as a single process in one Travis job?

    That way we could also catch cases where src/test/test_bitcoin prints error messages which was the case previously.

    Let me know if such a Travis job would be accepted: if so I can implement.

  10. MarcoFalke commented at 5:39 PM on November 4, 2019: member

    That way we could also catch cases where src/test/test_bitcoin prints error messages which was the case previously.

    What "error messages" and "previously" are you referring to?

  11. practicalswift commented at 5:51 PM on November 4, 2019: contributor

    What "error messages" and "previously" are you referring to?

    Sorry, context here: #15352, #15944, #16277 :)

  12. mzumsande commented at 6:34 PM on November 4, 2019: member

    ACK fa07b8beb598642655b1207afd275b801ff8cec2, I also tested that this fixes the issue in #15845.

  13. MarcoFalke commented at 7:20 PM on November 4, 2019: member

    Let me know if such a Travis job would be accepted: if so I can implement.

    No opinion from me

  14. MarcoFalke referenced this in commit 33b155f287 on Nov 4, 2019
  15. MarcoFalke merged this on Nov 4, 2019
  16. MarcoFalke closed this on Nov 4, 2019

  17. MarcoFalke deleted the branch on Nov 4, 2019
  18. MarcoFalke locked this on Dec 16, 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 06:14 UTC

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