Changeset View
Changeset View
Standalone View
Standalone View
doc/functional-tests.md
Show First 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | |||||
```py | ```py | ||||
import pdb; pdb.set_trace() | import pdb; pdb.set_trace() | ||||
``` | ``` | ||||
anywhere in the test. You will then be able to inspect variables, as well as | anywhere in the test. You will then be able to inspect variables, as well as | ||||
call methods that interact with the bitcoind nodes-under-test. | call methods that interact with the bitcoind nodes-under-test. | ||||
If further introspection of the bitcoind instances themselves becomes | |||||
necessary, this can be accomplished by first setting a pdb breakpoint | |||||
at an appropriate location, running the test to that point, then using | |||||
`gdb` to attach to the process and debug. | |||||
For instance, to attach to `self.node[1]` during a run: | |||||
```bash | |||||
2017-06-27 14:13:56.686000 TestFramework (INFO): Initializing test directory /tmp/user/1000/testo9vsdjo3 | |||||
``` | |||||
use the directory path to get the pid from the pid file: | |||||
```bash | |||||
cat /tmp/user/1000/testo9vsdjo3/node1/regtest/bitcoind.pid | |||||
gdb /home/example/bitcoind <pid> | |||||
``` | |||||
Note: gdb attach step may require `sudo`. To get rid of this, you can run: | |||||
```bash | |||||
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope | |||||
``` | |||||
### Util tests | ### Util tests | ||||
Util tests can be run locally by running `test/util/bitcoin-util-test.py`. | Util tests can be run locally by running `test/util/bitcoin-util-test.py`. | ||||
Use the `-v` option for verbose output. | Use the `-v` option for verbose output. | ||||
# Writing functional tests | # Writing functional tests | ||||
#### Example test | #### Example test | ||||
▲ Show 20 Lines • Show All 150 Lines • Show Last 20 Lines |