misc/cgo: re-enable some tests
The testso directory still needs to be enabled.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5731048
diff --git a/src/cmd/dist/build.c b/src/cmd/dist/build.c
index acd7347..6bcc0f5 100644
--- a/src/cmd/dist/build.c
+++ b/src/cmd/dist/build.c
@@ -52,6 +52,19 @@
"windows",
};
+// The known cgo-enabled combinations.
+// This list is also known to ../../pkg/go/build/build.go.
+static char *okcgo[] = {
+ "darwin/386",
+ "darwin/amd64",
+ "linux/386",
+ "linux/amd64",
+ "freebsd/386",
+ "freebsd/amd64",
+ "windows/386",
+ "windows/amd64",
+};
+
static void rmworkdir(void);
// find reports the first index of p in l[0:n], or else -1.
@@ -1308,6 +1321,11 @@
xprintf(format, "GOTOOLDIR", tooldir);
xprintf(format, "GOCHAR", gochar);
+ if(find(bprintf(&b, "%s/%s", goos, goarch), okcgo, nelem(okcgo)))
+ xprintf(format, "CGO_ENABLED", "1");
+ else
+ xprintf(format, "CGO_ENABLED", "0");
+
if(pflag) {
sep = ":";
if(streq(gohostos, "windows"))
diff --git a/src/pkg/go/build/build.go b/src/pkg/go/build/build.go
index d986f80..7f7bd18 100644
--- a/src/pkg/go/build/build.go
+++ b/src/pkg/go/build/build.go
@@ -210,6 +210,7 @@
// if set, or else the compiled code's GOARCH, GOOS, and GOROOT.
var Default Context = defaultContext()
+// This list is also known to ../../../cmd/dist/build.c.
var cgoEnabled = map[string]bool{
"darwin/386": true,
"darwin/amd64": true,
diff --git a/src/run.bash b/src/run.bash
index 7b185486..b5ffaa9 100755
--- a/src/run.bash
+++ b/src/run.bash
@@ -35,32 +35,26 @@
xcd() {
echo
- echo --- cd $1
+ echo '#' $1
builtin cd "$GOROOT"/src/$1
}
BROKEN=true
-$BROKEN ||
[ "$CGO_ENABLED" != 1 ] ||
[ "$GOHOSTOS" == windows ] ||
(xcd ../misc/cgo/stdio
-"$GOMAKE" clean
./test.bash
) || exit $?
-$BROKEN ||
[ "$CGO_ENABLED" != 1 ] ||
(xcd ../misc/cgo/life
-"$GOMAKE" clean
./test.bash
) || exit $?
-$BROKEN ||
[ "$CGO_ENABLED" != 1 ] ||
(xcd ../misc/cgo/test
-"$GOMAKE" clean
-gotest
+go test
) || exit $?
$BROKEN ||