Skip to content

Commit 0d09b7e

Browse files
committed
cmd/go: convert TestGoBuildNotMain to script framework
Part of converting all tests to script framework to improve test parallelism. Updates #36320 Updates #17751 Change-Id: Icd62dc8db55bec52ad326bc370ee7e435aae2559 Reviewed-on: https://go-review.googlesource.com/c/go/+/212812 Run-TryBot: Michael Matloob <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
1 parent 421cefd commit 0d09b7e

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

src/cmd/go/go_test.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,16 +1799,6 @@ func TestGoTestMutexprofileDashOControlsBinaryLocation(t *testing.T) {
17991799
tg.wantExecutable("myerrors.test"+exeSuffix, "go test -mutexprofile -o myerrors.test did not create myerrors.test")
18001800
}
18011801

1802-
func TestGoBuildNonMain(t *testing.T) {
1803-
tg := testgo(t)
1804-
defer tg.cleanup()
1805-
// TODO: tg.parallel()
1806-
tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata"))
1807-
tg.runFail("build", "-buildmode=exe", "-o", "not_main"+exeSuffix, "not_main")
1808-
tg.grepStderr("-buildmode=exe requires exactly one main package", "go build with -o and -buildmode=exe should on a non-main package should throw an error")
1809-
tg.mustNotExist("not_main" + exeSuffix)
1810-
}
1811-
18121802
func TestGoTestDashCDashOControlsBinaryLocation(t *testing.T) {
18131803
skipIfGccgo(t, "gccgo has no standard packages")
18141804
tooSlow(t)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# go build with -o and -buildmode=exe should on a non-main package should throw an error
2+
3+
! go build -buildmode=exe -o out$GOEXE not_main
4+
stderr '-buildmode=exe requires exactly one main package'
5+
! exists out$GOEXE
6+
! go build -buildmode=exe -o out$GOEXE main_one main_two
7+
stderr '-buildmode=exe requires exactly one main package'
8+
! exists out$GOEXE
9+
10+
-- not_main/not_main.go --
11+
package not_main
12+
13+
func F() {}
14+
-- main_one/main_one.go --
15+
package main
16+
17+
func main() {}
18+
-- main_two/main_two.go --
19+
package main
20+
21+
func main() {}

src/cmd/go/testdata/src/not_main/not_main.go

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)