-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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 remaining non-parallel tooSlow tests to script framework
Part of converting all tests to script framework to improve test parallelism. Updates #36320 Updates #17751 Change-Id: Ib1c55a48fafb5ce040ac70707bbc2a3ee5e2ddd4 Reviewed-on: https://go-review.googlesource.com/c/go/+/214382 Reviewed-by: Bryan C. Mills <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
- Loading branch information
Showing
4 changed files
with
78 additions
and
107 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
[short] skip | ||
[!cgo] skip | ||
|
||
[!exec:/usr/bin/env] skip | ||
[!exec:bash] skip | ||
[!exec:cat] skip | ||
|
||
mkdir $WORK/tmp/cache | ||
env GOCACHE=$WORK/tmp/cache | ||
|
||
# Before building our test main.go, ensure that an up-to-date copy of | ||
# runtime/cgo is present in the cache. If it isn't, the 'go build' step below | ||
# will fail with "can't open import". See golang.org/issue/29004. | ||
# | ||
# (The fix in golang.org/issue/29004 didn't completely fix the underlying issue: | ||
# cmd/go/internal/load adds a bunch of implicit dependencies | ||
# based on various heuristics, and, due to a bug described in | ||
# https://golang.org/issue/31544#issuecomment-490607180, | ||
# those implicit dependencies are not added early enough during | ||
# loading to properly affect the import graph.) | ||
go build runtime/cgo | ||
|
||
go build -x -o main main.go | ||
cp stderr commands.txt | ||
exec cat header.txt commands.txt | ||
cp stdout test.sh | ||
|
||
exec ./main | ||
cmp stderr hello.txt | ||
rm ./main | ||
|
||
exec /usr/bin/env bash -x test.sh | ||
exec ./main | ||
cmp stderr hello.txt | ||
|
||
grep '^WORK=(.*)\n' commands.txt | ||
|
||
-- main.go -- | ||
package main | ||
|
||
import "C" | ||
|
||
func main() { | ||
print("hello\n") | ||
} | ||
-- header.txt -- | ||
set -e | ||
-- hello.txt -- | ||
hello |
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 @@ | ||
[short] skip | ||
[!cgo] skip | ||
|
||
go run -x main.go | ||
stderr '"-I[^"]+c flags"' # find quoted c flags | ||
! stderr '"-I[^"]+c flags".*"-I[^"]+c flags"' # don't find too many quoted c flags | ||
stderr '"-L[^"]+ld flags"' # find quoted ld flags | ||
! stderr '"-L[^"]+c flags".*"-L[^"]+c flags"' # don't find too many quoted ld flags | ||
|
||
-- main.go -- | ||
package main | ||
// #cgo CFLAGS: -I"c flags" | ||
// #cgo LDFLAGS: -L"ld flags" | ||
import "C" | ||
func main() {} |
14 changes: 14 additions & 0 deletions
14
src/cmd/go/testdata/script/test_write_profiles_on_timeout.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,14 @@ | ||
# Tests issue 19394 | ||
|
||
[short] skip | ||
|
||
cd profiling | ||
! go test -cpuprofile cpu.pprof -memprofile mem.pprof -timeout 1ms | ||
grep . cpu.pprof | ||
grep . mem.pprof | ||
|
||
-- profiling/timeout_test.go -- | ||
package timeouttest_test | ||
import "testing" | ||
import "time" | ||
func TestSleep(t *testing.T) { time.Sleep(time.Second) } |