From: Russ Cox Date: Thu, 23 Jul 2015 16:05:34 +0000 (-0400) Subject: go/internal/gcimporter: reenable TestImport X-Git-Tag: go1.5beta3~75 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=eb2d946d354b96303916e57d9de6492b0df5b88e;p=gostls13.git go/internal/gcimporter: reenable TestImport It was not running because of invalid use of ArchChar. I didn't catch this when I scrubbed ArchChar from the tree because this code wasn't in the tree yet. The test seems to pass, which is nice. Change-Id: I59761a7a04a73681e147e25c1e7f010068276aa8 Reviewed-on: https://go-review.googlesource.com/12573 Reviewed-by: Robert Griesemer --- diff --git a/src/go/internal/gcimporter/gcimporter_test.go b/src/go/internal/gcimporter/gcimporter_test.go index a4b038c91e..e5edadfc26 100644 --- a/src/go/internal/gcimporter/gcimporter_test.go +++ b/src/go/internal/gcimporter/gcimporter_test.go @@ -6,7 +6,6 @@ package gcimporter import ( "fmt" - "go/build" "io/ioutil" "os" "os/exec" @@ -33,23 +32,13 @@ func skipSpecialPlatforms(t *testing.T) { } } -var gcPath string // Go compiler path - -func init() { - if char, err := build.ArchChar(runtime.GOARCH); err == nil { - gcPath = filepath.Join(build.ToolDir, char+"g") - return - } - gcPath = "unknown-GOARCH-compiler" -} - func compile(t *testing.T, dirname, filename string) string { - cmd := exec.Command(gcPath, filename) + cmd := exec.Command("go", "tool", "compile", filename) cmd.Dir = dirname out, err := cmd.CombinedOutput() if err != nil { t.Logf("%s", out) - t.Fatalf("%s %s failed: %s", gcPath, filename, err) + t.Fatalf("go tool compile %s failed: %s", filename, err) } // filename should end with ".go" return filepath.Join(dirname, filename[:len(filename)-2]+"o") @@ -108,12 +97,6 @@ func TestImport(t *testing.T) { return } - // On cross-compile builds, the path will not exist. - // Need to use GOHOSTOS, which is not available. - if _, err := os.Stat(gcPath); err != nil { - t.Skipf("skipping test: %v", err) - } - if outFn := compile(t, "testdata", "exports.go"); outFn != "" { defer os.Remove(outFn) }