Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: new T.TempDir doesn't work with subtests #38465

Closed
bradfitz opened this issue Apr 15, 2020 · 2 comments
Closed

testing: new T.TempDir doesn't work with subtests #38465

bradfitz opened this issue Apr 15, 2020 · 2 comments
Assignees
Milestone

Comments

@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Apr 15, 2020

Using TempDir with subtests with the unreleased testing.TB.TempDir (#35998) doesn't work, as ioutil.TempDir doesn't want a slash in its pattern:

=== RUN   TestLinkerGC/only_conn
    TestLinkerGC/only_conn: testing.go:819: TempDir: pattern contains path separator
=== RUN   TestLinkerGC/only_client
    TestLinkerGC/only_client: testing.go:819: TempDir: pattern contains path separator
=== RUN   TestLinkerGC/only_server
    TestLinkerGC/only_server: testing.go:819: TempDir: pattern contains path separator
--- FAIL: TestLinkerGC (0.00s)

Seems easy enough to fix... just mangle the test name a bit.

/cc @ianlancetaylor @bcmills

@bradfitz bradfitz added the NeedsFix label Apr 15, 2020
@bradfitz bradfitz added this to the Go1.15 milestone Apr 15, 2020
@bradfitz bradfitz self-assigned this Apr 15, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Apr 23, 2020

Change https://golang.org/cl/229399 mentions this issue: testing: make TempDir work for subtests

@gopherbot gopherbot closed this in 952f7de Apr 23, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Apr 24, 2020

Change https://golang.org/cl/229837 mentions this issue: testing: replace GOOS-specific path separator in TempDir

gopherbot pushed a commit that referenced this issue Apr 25, 2020
For GOOS=windows the path separator characters '\' and ':' also need be
replaced.

Updates #38465

Change-Id: If7c8cf93058c87d7df6cda140e82fd76578fe699
Reviewed-on: https://go-review.googlesource.com/c/go/+/229837
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
xujianhai666 added a commit to xujianhai666/go-1 that referenced this issue May 21, 2020
For GOOS=windows the path separator characters '\' and ':' also need be
replaced.

Updates golang#38465

Change-Id: If7c8cf93058c87d7df6cda140e82fd76578fe699
Reviewed-on: https://go-review.googlesource.com/c/go/+/229837
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.