-
Notifications
You must be signed in to change notification settings - Fork 17.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/go: convert some testcases to the script framework
This change converts TestFatalInBenchmarkCauseNonZeroExitStatus, TestBenchmarkLabels and TestWildCardsDoNotLookInUselessDirectories to the script framework so they can run in parallel. These tests used the testdata directory so they didn't call tg.parallel, because they couldn't be sure the testdata directory wasn't being modified while they were being run. The tests are converted to the script framework instead of being modified because the script framework tests are easier to read and are self-contained. Also remove the directory src/cmd/go/testdata/src/badc. The testcase that used it, "TestDisallowedCSourceFiles" was deleted in golang.org/cl/19613. Updates #17751 Change-Id: I0b9b417ae1a9b148067a3e5f8531229f3414f104 Reviewed-on: https://go-review.googlesource.com/c/go/+/212620 Run-TryBot: Michael Matloob <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
- Loading branch information
Showing
10 changed files
with
49 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/cmd/go/testdata/script/list_wildcard_skip_nonmatching.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Test that wildcards don't look in useless directories. | ||
|
||
# First make sure that badpkg fails the list of '...'. | ||
! go list ... | ||
stderr badpkg | ||
|
||
# Check that the list of 'm...' succeeds. That implies badpkg was skipped. | ||
go list m... | ||
|
||
-- m/x.go -- | ||
package m | ||
-- badpkg/x.go -- | ||
pkg badpkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Test that calling t.Fatal in a benchmark causes a non-zero exit status. | ||
|
||
! go test -run '^$' -bench . benchfatal | ||
! stdout ^ok | ||
! stderr ^ok | ||
stdout FAIL.*benchfatal | ||
|
||
-- benchfatal/x_test.go -- | ||
package benchfatal | ||
|
||
import "testing" | ||
|
||
func BenchmarkThatCallsFatal(b *testing.B) { | ||
b.Fatal("called by benchmark") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Tests that go test -bench prints out goos, goarch, and pkg. | ||
|
||
# Check for goos, goarch, and pkg. | ||
go test -run ^$ -bench . bench | ||
stdout '^goos: '$GOOS | ||
stdout '^goarch: '$GOARCH | ||
stdout '^pkg: bench' | ||
|
||
# Check go test does not print pkg multiple times | ||
! stdout 'pkg:.*pkg: ' | ||
! stderr 'pkg:.*pkg:' | ||
|
||
-- bench/x_test.go -- | ||
package bench | ||
|
||
import "testing" | ||
|
||
func Benchmark(b *testing.B) { | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.