Perhaps this goes without saying, however the unit tests require make install in addition to make for changes to be reflected after modification.
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-
yancyribbens commented at 5:16 PM on February 9, 2020: contributor
- DrahtBot added the label Docs on Feb 9, 2020
- DrahtBot added the label Tests on Feb 9, 2020
-
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.
-
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:
diff --git a/src/test/getarg_tests.cpp b/src/test/getarg_tests.cpp index 10fb05ca8..5e0f48855 100644 --- a/src/test/getarg_tests.cpp +++ b/src/test/getarg_tests.cpp @@ -146,15 +146,7 @@ BOOST_AUTO_TEST_CASE(intarg) BOOST_AUTO_TEST_CASE(doubledash) { - const auto foo = std::make_pair("-foo", ArgsManager::ALLOW_ANY); - const auto bar = std::make_pair("-bar", ArgsManager::ALLOW_ANY); - SetupArgs({foo, bar}); - ResetArgs("--foo"); - BOOST_CHECK_EQUAL(gArgs.GetBoolArg("-foo", false), true); - - ResetArgs("--foo=verbose --bar=1"); - BOOST_CHECK_EQUAL(gArgs.GetArg("-foo", ""), "verbose"); - BOOST_CHECK_EQUAL(gArgs.GetArg("-bar", 0), 1); + BOOST_TEST_MESSAGE("foo"); }and then run
make, followed bytest_bitcoin --log_level=message --run_test=getarg_tests/doubledashI see no message. however, after runningmake install, the unit test prints the messagefoo. -
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$PATHfor the binary, which then most likely is the installed one. To execute unit tests from your local build, either usemake checkorsrc/test/test_bitcoin(as described insrc/test/README.md). - yancyribbens force-pushed on Feb 10, 2020
-
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 testssince running the system installed binary isn't useful here. - 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 -
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. - fanquake added the label Waiting for author on Feb 20, 2020
- yancyribbens force-pushed on Feb 20, 2020
- fanquake removed the label Waiting for author on Feb 25, 2020
-
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_bitcoinorsrc/test/test_bitcoin, I've used both many times. -
yancyribbens commented at 2:57 PM on February 29, 2020: contributor
since
src/test/test_bitcoinis used elsewhere it is helpful to be consistent imo. Also, I think this illustrates the binarytest_bitcoinshould not be the one installed withmake install. -
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_bitcoinis distributed as part of the downloads. People are encouraged to runtest_bitcoinon any system they intend to usebitcoindon to increase confidence that there aren't any strange platform-specfic issues interfering. -
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
makeafter modifying a test file. Running make only updated the file atsrc/test/test_bitcoinand not the system installed bin. Otherwise the instructions should includemake installin addition tomakeimo. -
DrahtBot commented at 12:27 AM on April 1, 2020: member
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Conflicts
No conflicts as of last run.
- DrahtBot added the label Needs rebase on Apr 1, 2020
-
doc: add src/test/ prefix to test_bitcoin in test README c3e369d668
- yancyribbens force-pushed on Apr 1, 2020
- DrahtBot removed the label Needs rebase on Apr 1, 2020
-
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.
- MarcoFalke closed this on Apr 28, 2020
- DrahtBot locked this on Feb 15, 2022