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/misc/cgo/gmp/Makefile b/misc/cgo/gmp/Makefile
deleted file mode 100644
index d9390c1..0000000
--- a/misc/cgo/gmp/Makefile
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright 2009 The Go Authors.  All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-include ../../../src/Make.inc
-
-TARG=gmp
-
-# Can have plain GOFILES too, but this example doesn't.
-
-CGOFILES=\
-	gmp.go
-
-CGO_LDFLAGS=-lgmp
-
-# To add flags necessary for locating the library or its include files,
-# set CGO_CFLAGS or CGO_LDFLAGS.  For example, to use an
-# alternate installation of the library:
-#	CGO_CFLAGS=-I/home/rsc/gmp32/include
-#	CGO_LDFLAGS+=-L/home/rsc/gmp32/lib
-# Note the += on the second line.
-
-CLEANFILES+=pi fib
-
-include ../../../src/Make.pkg
-
-# Simple test programs
-
-# Computes 1000 digits of pi; single-threaded.
-pi: install pi.go
-	$(GC) $(GCFLAGS) $(GCIMPORTS) pi.go
-	$(LD) -o $@ pi.$O
-
-# Computes 200 Fibonacci numbers; multi-threaded.
-fib: install fib.go
-	$(GC) $(GCFLAGS) $(GCIMPORTS) fib.go
-	$(LD) -o $@ fib.$O
-
diff --git a/misc/cgo/gmp/fib.go b/misc/cgo/gmp/fib.go
index 3eda39e..18434be 100644
--- a/misc/cgo/gmp/fib.go
+++ b/misc/cgo/gmp/fib.go
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build ignore
+
 // Compute Fibonacci numbers with two goroutines
 // that pass integers back and forth.  No actual
 // concurrency, just threads and synchronization
@@ -10,7 +12,7 @@
 package main
 
 import (
-	big "gmp"
+	big "."
 	"runtime"
 )
 
diff --git a/misc/cgo/gmp/pi.go b/misc/cgo/gmp/pi.go
index 3e40624..019861e 100644
--- a/misc/cgo/gmp/pi.go
+++ b/misc/cgo/gmp/pi.go
@@ -1,3 +1,5 @@
+// +build ignore
+
 /*
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
@@ -38,8 +40,8 @@
 package main
 
 import (
+	big "."
 	"fmt"
-	big "gmp"
 	"runtime"
 )
 
diff --git a/misc/cgo/life/Makefile b/misc/cgo/life/Makefile
deleted file mode 100644
index 1568a67..0000000
--- a/misc/cgo/life/Makefile
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright 2010 The Go Authors.  All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-include ../../../src/Make.inc
-
-TARG=life
-
-CGOFILES=\
-	life.go\
-
-CGO_OFILES=\
-	c-life.o\
-
-ifeq ($(GOOS),windows)
-ifeq ($(GOARCH),amd64)
-CGO_OFILES+=\
-	lib64_libmingwex_a-wassert.o\
-	lib64_libmingw32_a-mingw_helpers.o\
-
-lib64_libmingwex_a-wassert.o:
-	ar -x /mingw/x86_64-w64-mingw32/lib/libmingwex.a lib64_libmingwex_a-wassert.o
-
-lib64_libmingw32_a-mingw_helpers.o:
-	ar -x /mingw/x86_64-w64-mingw32/lib/libmingw32.a  lib64_libmingw32_a-mingw_helpers.o
-endif
-endif
-
-CLEANFILES+=life
-
-include ../../../src/Make.pkg
-
-life: install main.go
-	$(GC) $(GCFLAGS) $(GCIMPORTS) main.go
-	$(LD) -o $@ main.$O
diff --git a/misc/cgo/life/main.go b/misc/cgo/life/main.go
index 9cfed43..47ae0e1 100644
--- a/misc/cgo/life/main.go
+++ b/misc/cgo/life/main.go
@@ -2,14 +2,16 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build ignore
+
 // Run the game of life in C using Go for parallelization.
 
 package main
 
 import (
+	"."
 	"flag"
 	"fmt"
-	"life"
 )
 
 const MAXDIM = 100
diff --git a/misc/cgo/life/test.bash b/misc/cgo/life/test.bash
index 5c5fba1..bb48352 100755
--- a/misc/cgo/life/test.bash
+++ b/misc/cgo/life/test.bash
@@ -4,8 +4,11 @@
 # license that can be found in the LICENSE file.
 
 set -e
-gomake life
+go build -o life main.go
+
 echo '*' life >run.out
 ./life >>run.out
 diff run.out golden.out
-gomake clean
+
+rm -f life
+
diff --git a/misc/cgo/stdio/Makefile b/misc/cgo/stdio/Makefile
deleted file mode 100644
index 586132b..0000000
--- a/misc/cgo/stdio/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright 2009 The Go Authors.  All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-include ../../../src/Make.inc
-
-TARG=stdio
-CGOFILES=\
-	file.go\
-
-CLEANFILES+=hello fib chain run.out
-
-include ../../../src/Make.pkg
-
-%: install %.go
-	$(GC) $(GCFLAGS) $(GCIMPORTS) $*.go
-	$(LD) -o $@ $*.$O
diff --git a/misc/cgo/stdio/chain.go b/misc/cgo/stdio/chain.go
index c188b2d..1cf0b1f 100644
--- a/misc/cgo/stdio/chain.go
+++ b/misc/cgo/stdio/chain.go
@@ -2,13 +2,15 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build ignore
+
 // Pass numbers along a chain of threads.
 
 package main
 
 import (
+	"../stdio"
 	"runtime"
-	"stdio"
 	"strconv"
 )
 
diff --git a/misc/cgo/stdio/fib.go b/misc/cgo/stdio/fib.go
index 431d9ce..6d3ccfd 100644
--- a/misc/cgo/stdio/fib.go
+++ b/misc/cgo/stdio/fib.go
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build ignore
+
 // Compute Fibonacci numbers with two goroutines
 // that pass integers back and forth.  No actual
 // concurrency, just threads and synchronization
@@ -10,8 +12,8 @@
 package main
 
 import (
+	"../stdio"
 	"runtime"
-	"stdio"
 	"strconv"
 )
 
diff --git a/misc/cgo/stdio/file.go b/misc/cgo/stdio/file.go
index ab1e884..6e7d479 100644
--- a/misc/cgo/stdio/file.go
+++ b/misc/cgo/stdio/file.go
@@ -28,7 +28,7 @@
 
 // Test reference to library symbol.
 // Stdout and stderr are too special to be a reliable test.
-var myerr = C.sys_errlist
+//var  = C.environ
 
 func (f *File) WriteString(s string) {
 	p := C.CString(s)
diff --git a/misc/cgo/stdio/hello.go b/misc/cgo/stdio/hello.go
index 58fc6d5..4ab3c74 100644
--- a/misc/cgo/stdio/hello.go
+++ b/misc/cgo/stdio/hello.go
@@ -2,9 +2,11 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build ignore
+
 package main
 
-import "stdio"
+import "../stdio"
 
 func main() {
 	stdio.Stdout.WriteString(stdio.Greeting + "\n")
diff --git a/misc/cgo/stdio/test.bash b/misc/cgo/stdio/test.bash
index 82e3f7b..21829fa 100755
--- a/misc/cgo/stdio/test.bash
+++ b/misc/cgo/stdio/test.bash
@@ -4,7 +4,10 @@
 # license that can be found in the LICENSE file.
 
 set -e
-gomake hello fib chain
+go build hello.go
+go build fib.go
+go build chain.go
+
 echo '*' hello >run.out
 ./hello >>run.out
 echo '*' fib >>run.out
@@ -12,4 +15,6 @@
 echo '*' chain >>run.out
 ./chain >>run.out
 diff run.out golden.out
-gomake clean
+
+rm -f hello fib chain
+
diff --git a/misc/cgo/test/basic.go b/misc/cgo/test/basic.go
index cd6d881..70ec5e4 100644
--- a/misc/cgo/test/basic.go
+++ b/misc/cgo/test/basic.go
@@ -55,7 +55,7 @@
 */
 import "C"
 import (
-	"os"
+	"syscall"
 	"testing"
 	"unsafe"
 )
@@ -110,7 +110,7 @@
 		C.fclose(f)
 		t.Fatalf("C.fopen: should fail")
 	}
-	if err != os.ENOENT {
+	if err != syscall.ENOENT {
 		t.Fatalf("C.fopen: unexpected error: %v", err)
 	}
 }
diff --git a/misc/cgo/test/callback.go b/misc/cgo/test/callback.go
index ef85256..e6a1462 100644
--- a/misc/cgo/test/callback.go
+++ b/misc/cgo/test/callback.go
@@ -6,14 +6,12 @@
 
 /*
 void callback(void *f);
-void callGoFoo(void) {
-	extern void goFoo(void);
-	goFoo();
-}
+void callGoFoo(void);
 */
 import "C"
 
 import (
+	"./backdoor"
 	"runtime"
 	"testing"
 	"unsafe"
@@ -43,7 +41,7 @@
 	nestedCall(runtime.GC)
 }
 
-func lockedOSThread() bool // in runtime.c
+var lockedOSThread = backdoor.LockedOSThread
 
 func testCallbackPanic(t *testing.T) {
 	// Make sure panic during callback unwinds properly.
diff --git a/misc/cgo/test/callback_c.c b/misc/cgo/test/callback_c.c
index c296d70..47f0730 100644
--- a/misc/cgo/test/callback_c.c
+++ b/misc/cgo/test/callback_c.c
@@ -15,3 +15,23 @@
 	goCallback(f);
         data[sizeof(data)-1] = 0;
 }
+
+void
+callGoFoo(void)
+{
+	extern void goFoo(void);
+	goFoo();
+}
+
+void
+IntoC(void)
+{
+	BackIntoGo();
+}
+
+void
+twoSleep(int n)
+{
+	BackgroundSleep(n);
+	sleep(n);
+}
diff --git a/misc/cgo/test/issue1328.go b/misc/cgo/test/issue1328.go
index e01207d..e1796d6 100644
--- a/misc/cgo/test/issue1328.go
+++ b/misc/cgo/test/issue1328.go
@@ -7,7 +7,7 @@
 import "testing"
 
 // extern void BackIntoGo(void);
-// void IntoC() { BackIntoGo(); }
+// void IntoC(void);
 import "C"
 
 //export BackIntoGo
diff --git a/misc/cgo/test/issue1560.go b/misc/cgo/test/issue1560.go
index 833b14a..3faa966 100644
--- a/misc/cgo/test/issue1560.go
+++ b/misc/cgo/test/issue1560.go
@@ -10,10 +10,7 @@
 unsigned int sleep(unsigned int seconds);
 
 extern void BackgroundSleep(int);
-void twoSleep(int n) {
-	BackgroundSleep(n);
-	sleep(n);
-}
+void twoSleep(int);
 */
 import "C"