You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A user tried to use go test with a filename here
(https://github.com/bradfitz/docker/pull/31) and was presumably misled by the go tool's
behavior.
I notice that its behavior differs when using -v:
With -v it appears to work, but shouldn't?
bradfitz@bradfitz:~/src/github.com/dotcloud/docker$ go test -v vfuse/all_test.go
=== RUN TestStatRegular
--- PASS: TestStatRegular (4.30 seconds)
=== RUN TestStatNoExist
--- PASS: TestStatNoExist (0.00 seconds)
=== RUN TestStatDir
--- PASS: TestStatDir (0.00 seconds)
=== RUN TestStatSymlink
--- PASS: TestStatSymlink (0.00 seconds)
=== RUN TestReadlink
--- PASS: TestReadlink (0.00 seconds)
=== RUN TestReaddirnamesEmpty
--- PASS: TestReaddirnamesEmpty (0.00 seconds)
=== RUN TestReaddirnames
--- PASS: TestReaddirnames (0.00 seconds)
=== RUN TestReaddirWalk
--- PASS: TestReaddirWalk (0.00 seconds)
=== RUN TestChmod
--- PASS: TestChmod (0.00 seconds)
=== RUN TestOpenRead
--- SKIP: TestOpenRead (0.07 seconds)
all_test.go:31: skipping known-broken test
all_test.go:236: (end of all tests; shutting down world)
PASS
ok command-line-arguments 4.387s
And without -v, it does something, but what?
bradfitz@bradfitz:~/src/github.com/dotcloud/docker$ go test vfuse/all_test.go
ok command-line-arguments 2.315s
The text was updated successfully, but these errors were encountered:
It runs the tests and they passed. Nothing to see here.
If all tests pass and you say -v or give no arguments, the go command hides the output.
If you ran the binary directly, or gave it a package name, you'd see the PASS. It's
slightly odd behavior but it is what it does.
% cd fmt
% go test -c
% ./fmt.test
PASS
% go test
PASS
ok fmt 0.045s
% go test fmt
ok fmt 0.058s
%
There may be something to report here, and you can complain about the secret rules about
test output, but I don't see a problem.
go help test says:
"usage: go test [-c] [-i] [build and test flags] [packages] [flags for test binary]"
It implies it takes packages, and not filenames.
But then what does this line mean:
ok command-line-arguments 2.315s
Why does it say "command-line-arguments" ?
Note that in my case above, I was running the go tool from the parent directory of where
the tests were, so if vfuse/all_test.go was actually treated as a command-line argument,
then it would've tried to run tests in the parent directory where no tests exist.
I guess I just don't know what's going on, and if any of this is by design.
The text was updated successfully, but these errors were encountered: