]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.15] cmd/test2json: do not emit a final Action if the result is...
authorBryan C. Mills <bcmills@google.com>
Fri, 14 Aug 2020 21:44:22 +0000 (17:44 -0400)
committerDmitri Shuralyov <dmitshur@golang.org>
Wed, 2 Sep 2020 15:02:34 +0000 (15:02 +0000)
commit09b28977f599d846aca968102c8d6e8b0283a18b
treee815569b26296a39dfa38c9ef5bfd0730bda38a9
parent76a89d6ca0436f027c9c3df59a7a542a99ee790f
[release-branch.go1.15] cmd/test2json: do not emit a final Action if the result is not known

If we are parsing a test output, and the test does not end in the
usual PASS or FAIL line (say, because it panicked), then we need the
exit status of the test binary in order to determine whether the test
passed or failed. If we don't have that status available, we shouldn't
guess arbitrarily — instead, we should omit the final "pass" or "fail"
action entirely.

(In practice, we nearly always DO have the final status, such as when
running 'go test' or 'go tool test2json some.exe'.)

Updates #40132
Fixes #40805

Change-Id: Iae482577361a6033395fe4a05d746b980e18c3de
Reviewed-on: https://go-review.googlesource.com/c/go/+/248624
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
(cherry picked from commit 1b86bdbdc3991c13c6ed156100a5f4918fdd9c6b)
Reviewed-on: https://go-review.googlesource.com/c/go/+/248725
src/cmd/go/internal/test/test.go
src/cmd/go/testdata/script/test_json_exit.txt [new file with mode: 0644]
src/cmd/internal/test2json/test2json.go
src/cmd/internal/test2json/testdata/benchshort.json
src/cmd/internal/test2json/testdata/empty.json
src/cmd/test2json/main.go