Skip to content

Commit eb2d946

Browse files
committed
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 <gri@golang.org>
1 parent c0d6d33 commit eb2d946

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

src/go/internal/gcimporter/gcimporter_test.go

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package gcimporter
66

77
import (
88
"fmt"
9-
"go/build"
109
"io/ioutil"
1110
"os"
1211
"os/exec"
@@ -33,23 +32,13 @@ func skipSpecialPlatforms(t *testing.T) {
3332
}
3433
}
3534

36-
var gcPath string // Go compiler path
37-
38-
func init() {
39-
if char, err := build.ArchChar(runtime.GOARCH); err == nil {
40-
gcPath = filepath.Join(build.ToolDir, char+"g")
41-
return
42-
}
43-
gcPath = "unknown-GOARCH-compiler"
44-
}
45-
4635
func compile(t *testing.T, dirname, filename string) string {
47-
cmd := exec.Command(gcPath, filename)
36+
cmd := exec.Command("go", "tool", "compile", filename)
4837
cmd.Dir = dirname
4938
out, err := cmd.CombinedOutput()
5039
if err != nil {
5140
t.Logf("%s", out)
52-
t.Fatalf("%s %s failed: %s", gcPath, filename, err)
41+
t.Fatalf("go tool compile %s failed: %s", filename, err)
5342
}
5443
// filename should end with ".go"
5544
return filepath.Join(dirname, filename[:len(filename)-2]+"o")
@@ -108,12 +97,6 @@ func TestImport(t *testing.T) {
10897
return
10998
}
11099

111-
// On cross-compile builds, the path will not exist.
112-
// Need to use GOHOSTOS, which is not available.
113-
if _, err := os.Stat(gcPath); err != nil {
114-
t.Skipf("skipping test: %v", err)
115-
}
116-
117100
if outFn := compile(t, "testdata", "exports.go"); outFn != "" {
118101
defer os.Remove(outFn)
119102
}

0 commit comments

Comments
 (0)