1
2
3
4
5 package ld
6
7 import (
8 "internal/testenv"
9 "os/exec"
10 "path/filepath"
11 "runtime"
12 "testing"
13 )
14
15 func TestNooptCgoBuild(t *testing.T) {
16 if testing.Short() {
17 t.Skip("skipping test in short mode.")
18 }
19 t.Parallel()
20
21 testenv.MustHaveGoBuild(t)
22 testenv.MustHaveCGO(t)
23 dir := t.TempDir()
24 cmd := exec.Command(testenv.GoToolPath(t), "build", "-gcflags=-N -l", "-o", filepath.Join(dir, "a.out"))
25 cmd.Dir = filepath.Join(runtime.GOROOT(), "src", "runtime", "testdata", "testprogcgo")
26 out, err := cmd.CombinedOutput()
27 if err != nil {
28 t.Logf("go build output: %s", out)
29 t.Fatal(err)
30 }
31 }
32
View as plain text