aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2021-01-07 17:50:14 -0500
committerAustin Clements <austin@google.com>2021-01-08 16:34:00 +0000
commit0c5afc4fb7e3349ec4efdce6554f83554e3d087c (patch)
tree9ea7c12d00da0b5e73ba164656e2087187b6d664 /src/testing
parent32afcc94363e15ee2ef0cffec962191a15e73094 (diff)
downloadgo-0c5afc4fb7e3349ec4efdce6554f83554e3d087c.tar.gz
go-0c5afc4fb7e3349ec4efdce6554f83554e3d087c.zip
testing/fstest,os: clarify racy behavior of TestFS
The testing.TestFS function assumes that the file system it's testing doesn't change under it. Clarify this in the documentation and fix the use of os.TestDirFS that's currently susceptible to this race. Fixes #42637. Change-Id: Ia7792380726177f8953d150ee87381b66cb01cb3 Reviewed-on: https://go-review.googlesource.com/c/go/+/282452 Trust: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/fstest/testfs.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/testing/fstest/testfs.go b/src/testing/fstest/testfs.go
index 4da6f04eed..a7f8007333 100644
--- a/src/testing/fstest/testfs.go
+++ b/src/testing/fstest/testfs.go
@@ -24,6 +24,7 @@ import (
// It also checks that the file system contains at least the expected files.
// As a special case, if no expected files are listed, fsys must be empty.
// Otherwise, fsys must only contain at least the listed files: it can also contain others.
+// The contents of fsys must not change concurrently with TestFS.
//
// If TestFS finds any misbehaviors, it returns an error reporting all of them.
// The error text spans multiple lines, one per detected misbehavior.