doc: add src/test/ prefix to test_bitcoin in test README #18102

pull yancyribbens wants to merge 1 commits into bitcoin:master from yancyribbens:update-unit-test-readme changing 1 files +2 −2
  1. yancyribbens commented at 5:16 pm on February 9, 2020: contributor
    Perhaps this goes without saying, however the unit tests require make install in addition to make for changes to be reflected after modification.
  2. DrahtBot added the label Docs on Feb 9, 2020
  3. DrahtBot added the label Tests on Feb 9, 2020
  4. sipa commented at 5:24 pm on February 9, 2020: member
    This is wrong, you don’t need to install the build before you can test it.
  5. yancyribbens commented at 6:11 pm on February 9, 2020: contributor

    @sipa thanks for the feedback. Perhaps there is something with boost that i’m not familiar with then. If I update the test:

     0diff --git a/src/test/getarg_tests.cpp b/src/test/getarg_tests.cpp
     1index 10fb05ca8..5e0f48855 100644
     2--- a/src/test/getarg_tests.cpp
     3+++ b/src/test/getarg_tests.cpp
     4@@ -146,15 +146,7 @@ BOOST_AUTO_TEST_CASE(intarg)
     5 
     6 BOOST_AUTO_TEST_CASE(doubledash)
     7 {
     8-    const auto foo = std::make_pair("-foo", ArgsManager::ALLOW_ANY);
     9-    const auto bar = std::make_pair("-bar", ArgsManager::ALLOW_ANY);
    10-    SetupArgs({foo, bar});
    11-    ResetArgs("--foo");
    12-    BOOST_CHECK_EQUAL(gArgs.GetBoolArg("-foo", false), true);
    13-
    14-    ResetArgs("--foo=verbose --bar=1");
    15-    BOOST_CHECK_EQUAL(gArgs.GetArg("-foo", ""), "verbose");
    16-    BOOST_CHECK_EQUAL(gArgs.GetArg("-bar", 0), 1);
    17+    BOOST_TEST_MESSAGE("foo");
    18 }
    

    and then run make, followed by test_bitcoin --log_level=message --run_test=getarg_tests/doubledash I see no message. however, after running make install, the unit test prints the message foo.

  6. theStack commented at 10:04 pm on February 9, 2020: member
    @yancyribbens: It seems that your problem is caused by omitting any path name on executing test_bitcoin, which will search in $PATH for the binary, which then most likely is the installed one. To execute unit tests from your local build, either use make check or src/test/test_bitcoin (as described in src/test/README.md).
  7. yancyribbens force-pushed on Feb 10, 2020
  8. yancyribbens commented at 8:51 am on February 10, 2020: contributor
    @theStack thanks that works. Maybe it would be helpful to add the local path prefix under the section Running individual tests since running the system installed binary isn’t useful here.
  9. fanquake renamed this:
    doc: update unit test documentation to be more descriptive about how to mo…
    doc: add src/test/ prefix to test_bitcoin in test README
    on Feb 20, 2020
  10. fanquake commented at 12:36 pm on February 20, 2020: member
    Adding the prefix here seems fine, as we use it throughout the rest of the file. You just need to fix the commit message. i.e doc: add src/test/ prefix to test_bitcoin in test README.
  11. fanquake added the label Waiting for author on Feb 20, 2020
  12. yancyribbens force-pushed on Feb 20, 2020
  13. fanquake removed the label Waiting for author on Feb 25, 2020
  14. laanwj commented at 9:09 pm on February 28, 2020: member
    Yes, I think this is fine, I mean it depends on what the current directory is, whether you want to do ./test_bitcoin or src/test/test_bitcoin, I’ve used both many times.
  15. yancyribbens commented at 2:57 pm on February 29, 2020: contributor
    since src/test/test_bitcoin is used elsewhere it is helpful to be consistent imo. Also, I think this illustrates the binary test_bitcoin should not be the one installed with make install.
  16. laanwj commented at 4:22 pm on March 2, 2020: member

    I think this illustrates the binary test_bitcoin should not be the one installed with make install.

    This is intentionally done because the test_bitcoin is distributed as part of the downloads. People are encouraged to run test_bitcoin on any system they intend to use bitcoind on to increase confidence that there aren’t any strange platform-specfic issues interfering.

  17. yancyribbens commented at 6:21 pm on March 2, 2020: contributor

    This is intentionally done because the test_bitcoin is distributed as part of the downloads. People are encouraged to run test_bitcoin on any system they intend to use bitcoind on to increase confidence that there aren’t any strange platform-specfic issues interfering.

    That’s understandable. However, the instuctions ask you to run make after modifying a test file. Running make only updated the file at src/test/test_bitcoin and not the system installed bin. Otherwise the instructions should include make install in addition to make imo.

  18. DrahtBot commented at 0:27 am on April 1, 2020: member

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

    Conflicts

    No conflicts as of last run.

  19. DrahtBot added the label Needs rebase on Apr 1, 2020
  20. doc: add src/test/ prefix to test_bitcoin in test README c3e369d668
  21. yancyribbens force-pushed on Apr 1, 2020
  22. DrahtBot removed the label Needs rebase on Apr 1, 2020
  23. MarcoFalke commented at 12:55 pm on April 28, 2020: member
    This simple change seems too controversial and didn’t attract too much attention in the past month. Closing for now.
  24. MarcoFalke closed this on Apr 28, 2020

  25. DrahtBot locked this on Feb 15, 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: 2024-12-23 00:13 UTC

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