Skip to content

Commit c9bdf9a

Browse files
author
MarcoFalke
committed
Merge #9065: Merge doc/unit-tests.md into src/test/README.md
eedc461 Merge `doc/unit-tests.md` into `src/test/README.md` (Wladimir J. van der Laan)
2 parents 6a1343f + eedc461 commit c9bdf9a

File tree

4 files changed

+37
-34
lines changed

4 files changed

+37
-34
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ lots of money.
4949

5050
### Automated Testing
5151

52-
Developers are strongly encouraged to write [unit tests](/doc/unit-tests.md) for new code, and to
52+
Developers are strongly encouraged to write [unit tests](src/test/README.md) for new code, and to
5353
submit new unit tests for old code. Unit tests can be compiled and run
54-
(assuming they weren't disabled in configure) with: `make check`
54+
(assuming they weren't disabled in configure) with: `make check`. Further details on running
55+
and extending unit tests can be found in [/src/test/README.md](/src/test/README.md).
5556

5657
There are also [regression and integration tests](/qa) of the RPC interface, written
5758
in Python, that are run automatically on the build server.

doc/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ The Bitcoin repo's [root README](/README.md) contains relevant information on th
5353
- [Source Code Documentation (External Link)](https://dev.visucore.com/bitcoin/doxygen/)
5454
- [Translation Process](translation_process.md)
5555
- [Translation Strings Policy](translation_strings_policy.md)
56-
- [Unit Tests](unit-tests.md)
5756
- [Travis CI](travis-ci.md)
5857
- [Unauthenticated REST Interface](REST-interface.md)
5958
- [Shared Libraries](shared-libraries.md)

doc/unit-tests.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/test/README.md

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,36 @@
1-
# Notes
1+
### Compiling/running unit tests
2+
3+
Unit tests will be automatically compiled if dependencies were met in `./configure`
4+
and tests weren't explicitly disabled.
5+
6+
After configuring, they can be run with `make check`.
7+
8+
To run the bitcoind tests manually, launch `src/test/test_bitcoin`.
9+
10+
To add more bitcoind tests, add `BOOST_AUTO_TEST_CASE` functions to the existing
11+
.cpp files in the `test/` directory or add new .cpp files that
12+
implement new BOOST_AUTO_TEST_SUITE sections.
13+
14+
To run the bitcoin-qt tests manually, launch `src/qt/test/test_bitcoin-qt`
15+
16+
To add more bitcoin-qt tests, add them to the `src/qt/test/` directory and
17+
the `src/qt/test/test_main.cpp` file.
18+
19+
### Running individual tests
20+
21+
test_bitcoin has some built-in command-line arguments; for
22+
example, to run just the getarg_tests verbosely:
23+
24+
test_bitcoin --log_level=all --run_test=getarg_tests
25+
26+
... or to run just the doubledash test:
27+
28+
test_bitcoin --run_test=getarg_tests/doubledash
29+
30+
Run `test_bitcoin --help` for the full list.
31+
32+
### Note on adding test cases
33+
234
The sources in this directory are unit test cases. Boost includes a
335
unit testing framework, and since bitcoin already uses boost, it makes
436
sense to simply use this framework rather than require developers to
@@ -19,22 +51,11 @@ For further reading, I found the following website to be helpful in
1951
explaining how the boost unit test framework works:
2052
[http://www.alittlemadness.com/2009/03/31/c-unit-testing-with-boosttest/](http://www.alittlemadness.com/2009/03/31/c-unit-testing-with-boosttest/).
2153

22-
test_bitcoin has some built-in command-line arguments; for
23-
example, to run just the getarg_tests verbosely:
24-
25-
test_bitcoin --log_level=all --run_test=getarg_tests
26-
27-
... or to run just the doubledash test:
28-
29-
test_bitcoin --run_test=getarg_tests/doubledash
30-
31-
Run `test_bitcoin --help` for the full list.
32-
3354
### bitcoin-util-test.py
3455

3556
The test directory also contains the bitcoin-util-test.py tool, which tests bitcoin utils (currently just bitcoin-tx). This test gets run automatically during the `make check` build process. It is also possible to run the test manually from the src directory:
3657

3758
```
3859
test/bitcoin-util-test.py --srcdir=[current directory]
3960
40-
```
61+
```

0 commit comments

Comments
 (0)