Commit eb2d946d authored by Russ Cox's avatar Russ Cox

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/12573Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
parent c0d6d332
......@@ -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)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment