aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2012-03-06 23:27:30 -0500
committerRuss Cox <rsc@golang.org>2012-03-06 23:27:30 -0500
commitc3f4319a241d646668f81de5e7109ce8938f79f2 (patch)
treeb7967af878d40cb9e421efbc247fcc6427f778c0 /src
parent0bc18811b54b782a56b171eb0f8974f47f8638c0 (diff)
downloadgo-c3f4319a241d646668f81de5e7109ce8938f79f2.tar.xz
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
Diffstat (limited to 'src')
-rw-r--r--src/cmd/dist/build.c18
-rw-r--r--src/pkg/go/build/build.go1
-rwxr-xr-xsrc/run.bash10
3 files changed, 21 insertions, 8 deletions
diff --git a/src/cmd/dist/build.c b/src/cmd/dist/build.c
index acd7347aa8..6bcc0f5327 100644
--- a/src/cmd/dist/build.c
+++ b/src/cmd/dist/build.c
@@ -52,6 +52,19 @@ static char *okgoos[] = {
"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 @@ cmdenv(int argc, char **argv)
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 d986f8039f..7f7bd18547 100644
--- a/src/pkg/go/build/build.go
+++ b/src/pkg/go/build/build.go
@@ -210,6 +210,7 @@ func (ctxt *Context) SrcDirs() []string {
// 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 7b1854865e..b5ffaa9974 100755
--- a/src/run.bash
+++ b/src/run.bash
@@ -35,32 +35,26 @@ go test sync -short -timeout=120s -cpu=10
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 ||