diff --git a/README.md b/README.md index cb9e26c1e03..23674719a61 100644 --- a/README.md +++ b/README.md @@ -310,14 +310,66 @@ $ ninja -C out/Release ### Running tests -Run: +#### Build + +Build (includes tests): ```bash $ ./gyp_uv.py -f make $ make -C out +``` + +#### Run all tests + +```bash $ ./out/Debug/run-tests ``` +#### Run one test + +The list of all tests is in `test/test-list.h`. + +This invocation will cause the `run-tests` driver to fork and execute `TEST_NAME` in a child process: + +```bash +$ ./out/Debug/run-tests TEST_NAME +``` + +This invocation will cause the `run-tests` driver to execute the test within the `run-tests` process: + +```bash +$ ./out/Debug/run-tests TEST_NAME TEST_NAME +``` + +#### Debugging tools + +When running the test from within the `run-tests` process (`run-tests TEST_NAME TEST_NAME`), tools like gdb and valgrind work normally. +When running the test from a child of the `run-tests` process (`run-tests TEST_NAME`), use these tools in a fork-aware manner. + +##### Fork-aware gdb + +Use the [follow-fork-mode](https://sourceware.org/gdb/onlinedocs/gdb/Forks.html) setting: + +``` +$ gdb --args out/Debug/run-tests TEST_NAME + +(gdb) set follow-fork-mode child +... +``` + +##### Fork-aware valgrind + +Use the `--trace-children=yes` parameter: + +```bash +$ valgrind --trace-children=yes -v --tool=memcheck --leak-check=full --track-origins=yes --leak-resolution=high --show-reachable=yes --log-file=memcheck.log out/Debug/run-tests TEST_NAME +``` + +### Running benchmarks + +See the section on running tests. +The benchmark driver is `out/Debug/run-benchmarks` and the benchmarks are listed in `test/benchmark-list.h`. + ## Supported Platforms Check the [SUPPORTED_PLATFORMS file](SUPPORTED_PLATFORMS.md).