diff options
| author | Bryan C. Mills <bcmills@google.com> | 2022-12-13 16:04:09 -0500 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-01-19 20:45:37 +0000 |
| commit | e49cb0208b17936f370753c820cb8dfef8d2bd5e (patch) | |
| tree | 1165682592889945b2f21999fbf01f9291be9f78 /src/os/path_windows_test.go | |
| parent | f2884bf42317011371440d90805e63248d94c45d (diff) | |
| download | go-e49cb0208b17936f370753c820cb8dfef8d2bd5e.tar.xz | |
os: clean up tests
- Use testenv.Command instead of exec.Command to try to get more
useful timeout behavior.
- Parallelize tests that appear not to require global state.
(And add explanatory comments for a few that are not
parallelizable for subtle reasons.)
- Consolidate some “Helper” tests with their parent tests.
- Use t.TempDir instead of os.MkdirTemp when appropriate.
- Factor out subtests for repeated test helpers.
For #36107.
Updates #22315.
Change-Id: Ic24b6957094dcd40908a59f48e44c8993729222b
Reviewed-on: https://go-review.googlesource.com/c/go/+/458015
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Diffstat (limited to 'src/os/path_windows_test.go')
| -rw-r--r-- | src/os/path_windows_test.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/os/path_windows_test.go b/src/os/path_windows_test.go index e960bcb19c..2506b4f0d8 100644 --- a/src/os/path_windows_test.go +++ b/src/os/path_windows_test.go @@ -15,6 +15,8 @@ func TestFixLongPath(t *testing.T) { if os.CanUseLongPaths { return } + t.Parallel() + // 248 is long enough to trigger the longer-than-248 checks in // fixLongPath, but short enough not to make a path component // longer than 255, which is illegal on Windows. (which @@ -50,6 +52,8 @@ func TestFixLongPath(t *testing.T) { } func TestMkdirAllLongPath(t *testing.T) { + t.Parallel() + tmpDir := t.TempDir() path := tmpDir for i := 0; i < 100; i++ { @@ -64,6 +68,7 @@ func TestMkdirAllLongPath(t *testing.T) { } func TestMkdirAllExtendedLength(t *testing.T) { + t.Parallel() tmpDir := t.TempDir() const prefix = `\\?\` @@ -86,6 +91,8 @@ func TestMkdirAllExtendedLength(t *testing.T) { } func TestOpenRootSlash(t *testing.T) { + t.Parallel() + tests := []string{ `/`, `\`, |
