Skip to content

Commit

Permalink
Merge pull request #199 from dnephin/add-profile-script-to-docs
Browse files Browse the repository at this point in the history
Add example of running with cpuprofile enabled to README
  • Loading branch information
dnephin committed Jun 5, 2021
2 parents fb92894 + 87cb6b0 commit bdcb1a9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Expand Up @@ -232,6 +232,25 @@ stdout and stderr output:
stderr, not the `test2json` stdout). Any stderr produced by tests is not
considered an error (it will be in the `test2json` stdout).

**Example: run tests with profiling enabled**

Using a `profile.sh` script like this:

```sh
#!/usr/bin/env bash
set -eu

for pkg in $(go list "$@"); do
dir="$(go list -f '{{ .Dir }}' $pkg)"
go test -json -cpuprofile="$dir/cpu.profile" "$pkg"
done
```

You can run:
```
gotestsum --raw-command ./profile.sh ./...
```

**Example: using `TEST_DIRECTORY`**
```
TEST_DIRECTORY=./io/http gotestsum
Expand Down

0 comments on commit bdcb1a9

Please sign in to comment.