mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/go, testing: add TB.ArtifactDir and -artifacts flag
Add TB.ArtifactDir, which returns a directory for a test to store output files in. Add a -artifacts testflag which enables persistent storage of artifacts in the output directory (-outputdir, or the current directory by default). Fixes #71287 Change-Id: I5f6515a6cd6c103f88588f4c033d5ea11ffd0c3c Reviewed-on: https://go-review.googlesource.com/c/go/+/696399 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
parent
1623927730
commit
bb1ca7ae81
11 changed files with 333 additions and 71 deletions
18
doc/next/6-stdlib/99-minor/testing/71287.md
Normal file
18
doc/next/6-stdlib/99-minor/testing/71287.md
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
The new methods [T.ArtifactDir], [B.ArtifactDir], and [F.ArtifactDir]
|
||||
return a directory in which to write test output files (artifacts).
|
||||
|
||||
When the `-artifacts` flag is provided to `go test`,
|
||||
this directory will be located under the output directory
|
||||
(specified with `-outputdir`, or the current directory by default).
|
||||
Otherwise, artifacts are stored in a temporary directory
|
||||
which is removed after the test completes.
|
||||
|
||||
The first call to `ArtifactDir` when `-artifacts` is provided
|
||||
writes the location of the directory to the test log.
|
||||
|
||||
For example, in a test named `TestArtifacts`,
|
||||
`t.ArtifactDir()` emits:
|
||||
|
||||
```
|
||||
=== ARTIFACTS Test /path/to/artifact/dir
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue