test: [refactor] Pass TestOpts #30407

pull maflcko wants to merge 1 commits into bitcoin:master from maflcko:2407-test-opts changing 13 files +40 −41
  1. maflcko commented at 1:56 pm on July 8, 2024: member

    Currently optional test context setup settings are passed by adding a new optional argument to the constructors. For example extra_args. This is problematic, because:

    • Adding more optional settings in the future requires touching all affected constructors, increasing their verbosity.
    • Setting only a later option requires setting the earlier ones.
    • Clang-tidy named args passed to std::make_unique are not checked.

    Fix all issues by adding a new struct TestOpts, which holds all options. Notes:

    • The chain type is not an option in the struct for now, because the default values vary.
    • The struct holds all possible test options globally. Not all fields may be used by all constructors. Albeit harmless, it is up to the test author to not set a field that is unused.
  2. DrahtBot commented at 1:56 pm on July 8, 2024: contributor

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

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK dergoegge, TheCharlatan, kevkevinpal

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #30399 (test: Add arguments for creating a slimmer TestingSetup by TheCharlatan)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  3. DrahtBot added the label Tests on Jul 8, 2024
  4. test: [refactor] Pass TestOpts fa690c8e53
  5. maflcko force-pushed on Jul 8, 2024
  6. DrahtBot commented at 2:11 pm on July 8, 2024: contributor

    🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the documentation.

    Possibly this is 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.

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

    Debug: https://github.com/bitcoin/bitcoin/runs/27166563275

  7. DrahtBot added the label CI failed on Jul 8, 2024
  8. DrahtBot removed the label CI failed on Jul 8, 2024
  9. dergoegge approved
  10. dergoegge commented at 2:09 pm on July 9, 2024: member
    utACK fa690c8e532672f7ab53be6f7a0bb3070858745e
  11. TheCharlatan approved
  12. TheCharlatan commented at 6:50 pm on July 10, 2024: contributor
    Nice, ACK fa690c8e532672f7ab53be6f7a0bb3070858745e
  13. kevkevinpal commented at 1:28 am on July 12, 2024: contributor

    utACK fa690c8

    I did a grep onto ./src/test/ not sure if we want to use the TestOpts struct on any of these

     0grep -nri "std::vector<const char\*>" ./src/test/ -I
     1./src/test/argsman_tests.cpp:827:        std::vector<const char*> argv = {"ignored"};
     2./src/test/argsman_tests.cpp:961:        std::vector<const char*> argv = {"ignored"};
     3./src/test/fuzz/system.cpp:87:                std::vector<const char*> argv;
     4./src/test/fuzz/fuzz.cpp:47:static std::vector<const char*> g_args;
     5./src/test/fuzz/fuzz.cpp:59:const std::function<std::vector<const char*>()> G_TEST_COMMAND_LINE_ARGUMENTS = []() {
     6./src/test/getarg_tests.cpp:34:    std::vector<const char*> vecChar;
     7./src/test/main.cpp:35:const std::function<std::vector<const char*>()> G_TEST_COMMAND_LINE_ARGUMENTS = []() {
     8./src/test/main.cpp:36:    std::vector<const char*> args;
     9./src/test/util/setup_common.cpp:120:    std::vector<const char*> arguments = Cat(
    10./src/test/util/setup_common.h:35:extern const std::function<std::vector<const char*>()> G_TEST_COMMAND_LINE_ARGUMENTS;
    11./src/test/util/setup_common.h:52:    std::vector<const char*> extra_args{};
    
  14. maflcko commented at 7:45 am on July 12, 2024: member

    I did a grep onto ./src/test/ not sure if we want to use the TestOpts struct on any of these

    Not sure what you mean, but I am happy to push any changes that make sense, if you provide a diff. Also, I am happy to review follow-ups, if you create one.

  15. fanquake merged this on Jul 15, 2024
  16. fanquake closed this on Jul 15, 2024

  17. maflcko deleted the branch on Jul 16, 2024

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-11-23 09:12 UTC

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