tests: Tidy context tests #1186

pull real-or-random wants to merge 7 commits into bitcoin-core:master from real-or-random:202301-tidy-context-tests changing 4 files +147 −115
  1. real-or-random commented at 5:26 pm on January 4, 2023: contributor

    This is an improved version of some of the tidying/refactoring in #1170.

    I think it’s enough to deserve a separate PR. Once this is merged, I’ll get back to the actual goal of #1170 (namely, forbidding cloning and randomizing static contexts.)

    This PR is a general clean up of the context tests. A notable change is that this avoids a code smell where run_context_tests() would use the global ctx variable like a local one (i.e., create a context in it and destroy it afterwards). After this PR, the global ctx is properly initialized for all the other tests, and they can decide whether they want to use it or not. Same for a global sttc, which is a memcpy of the static context (we need a writable copy in order to be able to set callbacks).

    Note that this touches code which is also affected by #1167 but I refrained from trying to solve this issue. The goal of this PR is simply not to worsen the situation w.r.t. #1167. We should really introduce a macro to solve #1167 but that’s another PR.

  2. tests: Use global copy of secp256k1_context_static instead of clone b19806122e
  3. tests: Don't recreate global context in scratch space test 18e0db30cb
  4. real-or-random force-pushed on Jan 4, 2023
  5. real-or-random cross-referenced this on Jan 4, 2023 from issue contexts: Forbid destroying, cloning and randomizing the static context by real-or-random
  6. apoelstra commented at 7:40 pm on January 4, 2023: contributor

    valgrind does not pass on fc16b698. The next commit, 3c54c4adda8d79cdb574604757ffddc481096c9e, passes.

    I don’t know if we have it as a goal that every commit passes valgrind, but there you go.

    Otherwise ACK 82d6a5a5a090cc920ff92842656e78889a25d0fd

  7. real-or-random force-pushed on Jan 5, 2023
  8. tests: Tidy run_context_tests() by extracting functions ce4f936c4f
  9. tests: Don't use global context for context tests f32a36f620
  10. refactor: Tidy up main() fc90bb5695
  11. tests: Clean up and improve run_context_tests() further a4a09379b1
  12. refactor: Separate run_context_tests into static vs proper contexts 39e8f0e3d7
  13. real-or-random force-pushed on Jan 5, 2023
  14. real-or-random commented at 9:34 am on January 5, 2023: contributor

    I don’t know if we have it as a goal that every commit passes valgrind, but there you go.

    Not strictly but I was certainly my intention here. Fixed.

    I tested every commit with valgrind now. (https://github.com/mhagger/git-test or https://github.com/spotify/git-test are really nice for this!)

  15. real-or-random cross-referenced this on Jan 5, 2023 from issue refactor: Rename global variables in tests by real-or-random
  16. apoelstra approved
  17. apoelstra commented at 2:25 pm on January 5, 2023: contributor
    ACK 39e8f0e3d7ba7924e9cc5f9e0c56747e942f1eab
  18. sipa commented at 8:36 pm on January 5, 2023: contributor
    utACK 39e8f0e3d7ba7924e9cc5f9e0c56747e942f1eab
  19. real-or-random merged this on Jan 6, 2023
  20. real-or-random closed this on Jan 6, 2023

  21. real-or-random referenced this in commit cc3b8a4f40 on Jan 11, 2023
  22. dhruv referenced this in commit 4d33046ce3 on Feb 1, 2023
  23. dhruv referenced this in commit 55e7f2cf2b on Feb 2, 2023
  24. stratospher referenced this in commit 647f63669e on Feb 6, 2023
  25. dhruv referenced this in commit a4351c0df6 on Feb 20, 2023
  26. stratospher referenced this in commit 23f825fc8b on Feb 21, 2023
  27. hebasto referenced this in commit 7c0cc5d976 on Mar 7, 2023
  28. dhruv referenced this in commit a5df79db12 on Mar 7, 2023
  29. dhruv referenced this in commit 77b510d84c on Mar 7, 2023
  30. sipa referenced this in commit 763079a3f1 on Mar 8, 2023
  31. div72 referenced this in commit 945b094575 on Mar 14, 2023
  32. vmta referenced this in commit e1120c94a1 on Jun 4, 2023
  33. vmta referenced this in commit 8f03457eed on Jul 1, 2023
  34. jonasnick cross-referenced this on Jul 19, 2023 from issue Upstream PRs 1174, 1154, 1178, 1177, 1171, 1158, 1183, 1185, 1186, 1188, 1187 by jonasnick

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-30 03:15 UTC

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