aboutsummaryrefslogtreecommitdiff
path: root/src/test/README.md
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-03-31 16:31:55 -0400
committerMarcoFalke <falke.marco@gmail.com>2020-03-31 17:11:47 -0400
commit7777703958937ec0ae609b1ee882f1bf2d113d10 (patch)
treec52e0379a8d9b9602948edbfbca4719bc7c91358 /src/test/README.md
parent72ef366564394bad798484ba935c96b68579043f (diff)
doc: Explain new test logging
Diffstat (limited to 'src/test/README.md')
-rw-r--r--src/test/README.md29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/test/README.md b/src/test/README.md
index 731720f654..57cda26d7c 100644
--- a/src/test/README.md
+++ b/src/test/README.md
@@ -17,26 +17,31 @@ and tests weren't explicitly disabled.
After configuring, they can be run with `make check`.
-To run the bitcoind tests manually, launch `src/test/test_bitcoin`. To recompile
+To run the unit tests manually, launch `src/test/test_bitcoin`. To recompile
after a test file was modified, run `make` and then run the test again. If you
modify a non-test file, use `make -C src/test` to recompile only what's needed
-to run the bitcoind tests.
+to run the unit tests.
-To add more bitcoind tests, add `BOOST_AUTO_TEST_CASE` functions to the existing
+To add more unit tests, add `BOOST_AUTO_TEST_CASE` functions to the existing
.cpp files in the `test/` directory or add new .cpp files that
implement new `BOOST_AUTO_TEST_SUITE` sections.
-To run the bitcoin-qt tests manually, launch `src/qt/test/test_bitcoin-qt`
+To run the GUI unit tests manually, launch `src/qt/test/test_bitcoin-qt`
-To add more bitcoin-qt tests, add them to the `src/qt/test/` directory and
+To add more GUI unit tests, add them to the `src/qt/test/` directory and
the `src/qt/test/test_main.cpp` file.
### Running individual tests
-test_bitcoin has some built-in command-line arguments; for
-example, to run just the getarg_tests verbosely:
+`test_bitcoin` has some built-in command-line arguments; for
+example, to run just the `getarg_tests` verbosely:
- test_bitcoin --log_level=all --run_test=getarg_tests
+ test_bitcoin --log_level=all --run_test=getarg_tests -- DEBUG_LOG_OUT
+
+`log_level` controls the verbosity of the test framework, which logs when a
+test case is entered, for example. The `DEBUG_LOG_OUT` after the two dashes
+redirects the debug log, which would normally go to a file in the test datadir
+(`BasicTestingSetup::m_path_root`), to the standard terminal output.
... or to run just the doubledash test:
@@ -56,11 +61,15 @@ see `uint256_tests.cpp`.
### Logging and debugging in unit tests
+`make check` will write to a log file `foo_tests.cpp.log` and display this file
+on failure. For running individual tests verbosely, refer to the section
+[above](#running-individual-tests).
+
To write to logs from unit tests you need to use specific message methods
provided by Boost. The simplest is `BOOST_TEST_MESSAGE`.
-For debugging you can launch the test_bitcoin executable with `gdb`or `lldb` and
-start debugging, just like you would with bitcoind:
+For debugging you can launch the `test_bitcoin` executable with `gdb`or `lldb` and
+start debugging, just like you would with any other program:
```bash
gdb src/test/test_bitcoin