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

"go test -bench B ." writes files into testdata #42

Closed
dr2chase opened this issue Oct 6, 2021 · 1 comment
Closed

"go test -bench B ." writes files into testdata #42

dr2chase opened this issue Oct 6, 2021 · 1 comment

Comments

@dr2chase
Copy link
Contributor

dr2chase commented Oct 6, 2021

This is anti-recommended, and causes spurious failures when tests and run using Go modules because all the source code is checked out read-only ( https://golang.org/ref/mod#module-cache also golang/go#28386).

Failure, observed with read-only testdata:

% go test -bench B .
--- FAIL: BenchmarkBindata
    benchmark_test.go:47: open testdata/assets/sf-fzlmnmzwlrm7hq2x.tmp: permission denied
FAIL
exit status 1
FAIL	github.com/kevinburke/go-bindata	0.793s
FAIL

Or, in a directory containing a go.mod:

go test github.com/kevinburke/go-bindata -bench B -run nope
--- FAIL: BenchmarkBindata
    benchmark_test.go:47: open testdata/assets/sf-jwvtvw26u2y72aov.tmp: permission denied
FAIL
exit status 1
FAIL	github.com/kevinburke/go-bindata	0.635s
FAIL

-run nope was specified above because of problems with other tests; this specific failure concerns running benchmarks, which is how I found this.

dr2chase added a commit to dr2chase/go-bindata that referenced this issue Oct 6, 2021
@kevinburke
Copy link
Owner

Thanks, I'll take a look at the patch later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants