Skip to content

Commit

Permalink
doc: notes on running tests, benchmarks, tools
Browse files Browse the repository at this point in the history
PR-URL: #1971
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
  • Loading branch information
davisjam authored and santigimeno committed Sep 3, 2018
1 parent 89a9ea6 commit c0c672e
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion README.md
Expand Up @@ -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).
Expand Down

0 comments on commit c0c672e

Please sign in to comment.