Skip to content

Commit cf155b0

Browse files
author
Bryan C. Mills
committed
runtime: make tests that invoke 'go build' module-agnostic
In module mode, building the current directory requires a go.mod file (in order to determine the import path of the package). Change the tests to pass explicit file arguments instead, since those can be built in module mode without defining a module. Updates #30228 Change-Id: I680c658d1f79645f73ad4d1e88189ea50a4852e9 Reviewed-on: https://go-review.googlesource.com/c/162837 Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Emmanuel Odeke <[email protected]>
1 parent a10b4cf commit cf155b0

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/runtime/crash_unix_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func TestCrashDumpsAllThreads(t *testing.T) {
6363
t.Fatalf("failed to create Go file: %v", err)
6464
}
6565

66-
cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", "a.exe")
66+
cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", "a.exe", "main.go")
6767
cmd.Dir = dir
6868
out, err := testenv.CleanCmdEnv(cmd).CombinedOutput()
6969
if err != nil {

src/runtime/runtime-gdb_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func testGdbPython(t *testing.T, cgo bool) {
156156
}
157157
nLines := lastLine(src)
158158

159-
cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", "a.exe")
159+
cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", "a.exe", "main.go")
160160
cmd.Dir = dir
161161
out, err := testenv.CleanCmdEnv(cmd).CombinedOutput()
162162
if err != nil {
@@ -337,7 +337,7 @@ func TestGdbBacktrace(t *testing.T) {
337337
if err != nil {
338338
t.Fatalf("failed to create file: %v", err)
339339
}
340-
cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", "a.exe")
340+
cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", "a.exe", "main.go")
341341
cmd.Dir = dir
342342
out, err := testenv.CleanCmdEnv(cmd).CombinedOutput()
343343
if err != nil {
@@ -408,7 +408,7 @@ func TestGdbAutotmpTypes(t *testing.T) {
408408
if err != nil {
409409
t.Fatalf("failed to create file: %v", err)
410410
}
411-
cmd := exec.Command(testenv.GoToolPath(t), "build", "-gcflags=all=-N -l", "-o", "a.exe")
411+
cmd := exec.Command(testenv.GoToolPath(t), "build", "-gcflags=all=-N -l", "-o", "a.exe", "main.go")
412412
cmd.Dir = dir
413413
out, err := testenv.CleanCmdEnv(cmd).CombinedOutput()
414414
if err != nil {
@@ -474,7 +474,7 @@ func TestGdbConst(t *testing.T) {
474474
if err != nil {
475475
t.Fatalf("failed to create file: %v", err)
476476
}
477-
cmd := exec.Command(testenv.GoToolPath(t), "build", "-gcflags=all=-N -l", "-o", "a.exe")
477+
cmd := exec.Command(testenv.GoToolPath(t), "build", "-gcflags=all=-N -l", "-o", "a.exe", "main.go")
478478
cmd.Dir = dir
479479
out, err := testenv.CleanCmdEnv(cmd).CombinedOutput()
480480
if err != nil {
@@ -539,7 +539,7 @@ func TestGdbPanic(t *testing.T) {
539539
if err != nil {
540540
t.Fatalf("failed to create file: %v", err)
541541
}
542-
cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", "a.exe")
542+
cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", "a.exe", "main.go")
543543
cmd.Dir = dir
544544
out, err := testenv.CleanCmdEnv(cmd).CombinedOutput()
545545
if err != nil {

0 commit comments

Comments
 (0)