Black Lives Matter. Support the Equal Justice Initiative.

Source file src/cmd/link/internal/ld/nooptcgolink_test.go

Documentation: cmd/link/internal/ld

     1  // Copyright 2017 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     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