diff options
| author | Russ Cox <rsc@golang.org> | 2014-05-20 12:10:19 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2014-05-20 12:10:19 -0400 |
| commit | 0c2a727477908dc0adbfcb05baac34b4ba4fa309 (patch) | |
| tree | 8bc790864f3e4768d487e65bb05ef449dfc46e2f /src/pkg | |
| parent | f374dd30a05ed11a994d312ae4e128e731ee55a0 (diff) | |
| download | go-0c2a727477908dc0adbfcb05baac34b4ba4fa309.tar.xz | |
build: make nacl pass
Add nacl.bash, the NaCl version of all.bash.
It's a separate script because it builds a variant of package syscall
with a large zip file embedded in it, containing all the input files
needed for tests.
Disable various tests new since the last round, mostly the ones using os/exec.
Fixes #7945.
LGTM=dave
R=golang-codereviews, remyoudompheng, dave, bradfitz
CC=golang-codereviews
https://golang.org/cl/100590044
Diffstat (limited to 'src/pkg')
| -rw-r--r-- | src/pkg/crypto/x509/x509_test.go | 5 | ||||
| -rw-r--r-- | src/pkg/net/http/cgi/matryoshka_test.go | 13 | ||||
| -rw-r--r-- | src/pkg/net/packetconn_test.go | 2 | ||||
| -rw-r--r-- | src/pkg/net/protoconn_test.go | 4 | ||||
| -rw-r--r-- | src/pkg/net/server_test.go | 2 | ||||
| -rw-r--r-- | src/pkg/net/timeout_test.go | 5 | ||||
| -rw-r--r-- | src/pkg/net/unix_test.go | 2 | ||||
| -rw-r--r-- | src/pkg/os/exec/exec_test.go | 25 | ||||
| -rw-r--r-- | src/pkg/os/os_test.go | 43 | ||||
| -rw-r--r-- | src/pkg/os/path_test.go | 5 | ||||
| -rw-r--r-- | src/pkg/path/filepath/match_test.go | 7 | ||||
| -rw-r--r-- | src/pkg/path/filepath/path_test.go | 5 | ||||
| -rw-r--r-- | src/pkg/runtime/asm_amd64p32.s | 6 | ||||
| -rw-r--r-- | src/pkg/runtime/crash_test.go | 5 | ||||
| -rw-r--r-- | src/pkg/runtime/pprof/pprof_test.go | 2 | ||||
| -rw-r--r-- | src/pkg/runtime/runtime_test.go | 8 |
16 files changed, 98 insertions, 41 deletions
diff --git a/src/pkg/crypto/x509/x509_test.go b/src/pkg/crypto/x509/x509_test.go index ce9062c4b4..2fd54c78f7 100644 --- a/src/pkg/crypto/x509/x509_test.go +++ b/src/pkg/crypto/x509/x509_test.go @@ -22,6 +22,7 @@ import ( "net" "os/exec" "reflect" + "runtime" "testing" "time" ) @@ -727,6 +728,10 @@ func TestParsePEMCRL(t *testing.T) { } func TestImports(t *testing.T) { + if runtime.GOOS == "nacl" { + t.Skip("skipping on nacl") + } + if err := exec.Command("go", "run", "x509_test_import.go").Run(); err != nil { t.Errorf("failed to run x509_test_import.go: %s", err) } diff --git a/src/pkg/net/http/cgi/matryoshka_test.go b/src/pkg/net/http/cgi/matryoshka_test.go index 94f64671c1..18c4803e71 100644 --- a/src/pkg/net/http/cgi/matryoshka_test.go +++ b/src/pkg/net/http/cgi/matryoshka_test.go @@ -16,6 +16,7 @@ import ( "net/http" "net/http/httptest" "os" + "runtime" "testing" "time" ) @@ -23,6 +24,10 @@ import ( // This test is a CGI host (testing host.go) that runs its own binary // as a child process testing the other half of CGI (child.go). func TestHostingOurselves(t *testing.T) { + if runtime.GOOS == "nacl" { + t.Skip("skipping on nacl") + } + h := &Handler{ Path: os.Args[0], Root: "/test.go", @@ -87,6 +92,10 @@ func (w *limitWriter) Write(p []byte) (n int, err error) { // If there's an error copying the child's output to the parent, test // that we kill the child. func TestKillChildAfterCopyError(t *testing.T) { + if runtime.GOOS == "nacl" { + t.Skip("skipping on nacl") + } + defer func() { testHookStartProcess = nil }() proc := make(chan *os.Process, 1) testHookStartProcess = func(p *os.Process) { @@ -130,6 +139,10 @@ func TestKillChildAfterCopyError(t *testing.T) { // Test that a child handler writing only headers works. // golang.org/issue/7196 func TestChildOnlyHeaders(t *testing.T) { + if runtime.GOOS == "nacl" { + t.Skip("skipping on nacl") + } + h := &Handler{ Path: os.Args[0], Root: "/test.go", diff --git a/src/pkg/net/packetconn_test.go b/src/pkg/net/packetconn_test.go index 51f94acd8c..b6e4e76f93 100644 --- a/src/pkg/net/packetconn_test.go +++ b/src/pkg/net/packetconn_test.go @@ -40,7 +40,7 @@ func packetConnTestData(t *testing.T, net string, i int) ([]byte, func()) { return b, nil case "unixgram": switch runtime.GOOS { - case "plan9", "windows": + case "nacl", "plan9", "windows": return nil, func() { t.Logf("skipping %q test on %q", net, runtime.GOOS) } diff --git a/src/pkg/net/protoconn_test.go b/src/pkg/net/protoconn_test.go index 47ae0efde3..12856b6c31 100644 --- a/src/pkg/net/protoconn_test.go +++ b/src/pkg/net/protoconn_test.go @@ -236,7 +236,7 @@ func TestIPConnSpecificMethods(t *testing.T) { func TestUnixListenerSpecificMethods(t *testing.T) { switch runtime.GOOS { - case "plan9", "windows": + case "nacl", "plan9", "windows": t.Skipf("skipping test on %q", runtime.GOOS) } @@ -278,7 +278,7 @@ func TestUnixListenerSpecificMethods(t *testing.T) { func TestUnixConnSpecificMethods(t *testing.T) { switch runtime.GOOS { - case "plan9", "windows": + case "nacl", "plan9", "windows": t.Skipf("skipping test on %q", runtime.GOOS) } diff --git a/src/pkg/net/server_test.go b/src/pkg/net/server_test.go index 86ebfb3e95..6a2bb92432 100644 --- a/src/pkg/net/server_test.go +++ b/src/pkg/net/server_test.go @@ -16,7 +16,7 @@ import ( func skipServerTest(net, unixsotype, addr string, ipv6, ipv4map, linuxOnly bool) bool { switch runtime.GOOS { case "linux": - case "plan9", "windows": + case "nacl", "plan9", "windows": // "unix" sockets are not supported on Windows and Plan 9. if net == unixsotype { return true diff --git a/src/pkg/net/timeout_test.go b/src/pkg/net/timeout_test.go index 2c56947b6e..9ef0c4d15c 100644 --- a/src/pkg/net/timeout_test.go +++ b/src/pkg/net/timeout_test.go @@ -120,6 +120,9 @@ func TestReadTimeout(t *testing.T) { t.Fatalf("Read: expected err %v, got %v", errClosing, err) } default: + if err == io.EOF && runtime.GOOS == "nacl" { // close enough; golang.org/issue/8044 + break + } if err != errClosing { t.Fatalf("Read: expected err %v, got %v", errClosing, err) } @@ -708,7 +711,7 @@ func TestProlongTimeout(t *testing.T) { func TestDeadlineRace(t *testing.T) { switch runtime.GOOS { - case "plan9": + case "nacl", "plan9": t.Skipf("skipping test on %q", runtime.GOOS) } diff --git a/src/pkg/net/unix_test.go b/src/pkg/net/unix_test.go index 24b6bf9da7..05643ddf9a 100644 --- a/src/pkg/net/unix_test.go +++ b/src/pkg/net/unix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !plan9,!windows +// +build !nacl,!plan9,!windows package net diff --git a/src/pkg/os/exec/exec_test.go b/src/pkg/os/exec/exec_test.go index 7a95579f15..6f77ac38ae 100644 --- a/src/pkg/os/exec/exec_test.go +++ b/src/pkg/os/exec/exec_test.go @@ -27,7 +27,10 @@ import ( "time" ) -func helperCommand(s ...string) *exec.Cmd { +func helperCommand(t *testing.T, s ...string) *exec.Cmd { + if runtime.GOOS == "nacl" { + t.Skip("skipping on nacl") + } cs := []string{"-test.run=TestHelperProcess", "--"} cs = append(cs, s...) cmd := exec.Command(os.Args[0], cs...) @@ -36,7 +39,7 @@ func helperCommand(s ...string) *exec.Cmd { } func TestEcho(t *testing.T) { - bs, err := helperCommand("echo", "foo bar", "baz").Output() + bs, err := helperCommand(t, "echo", "foo bar", "baz").Output() if err != nil { t.Errorf("echo: %v", err) } @@ -75,7 +78,7 @@ func TestCommandRelativeName(t *testing.T) { func TestCatStdin(t *testing.T) { // Cat, testing stdin and stdout. input := "Input string\nLine 2" - p := helperCommand("cat") + p := helperCommand(t, "cat") p.Stdin = strings.NewReader(input) bs, err := p.Output() if err != nil { @@ -89,7 +92,7 @@ func TestCatStdin(t *testing.T) { func TestCatGoodAndBadFile(t *testing.T) { // Testing combined output and error values. - bs, err := helperCommand("cat", "/bogus/file.foo", "exec_test.go").CombinedOutput() + bs, err := helperCommand(t, "cat", "/bogus/file.foo", "exec_test.go").CombinedOutput() if _, ok := err.(*exec.ExitError); !ok { t.Errorf("expected *exec.ExitError from cat combined; got %T: %v", err, err) } @@ -117,7 +120,7 @@ func TestNoExistBinary(t *testing.T) { func TestExitStatus(t *testing.T) { // Test that exit values are returned correctly - cmd := helperCommand("exit", "42") + cmd := helperCommand(t, "exit", "42") err := cmd.Run() want := "exit status 42" switch runtime.GOOS { @@ -140,7 +143,7 @@ func TestPipes(t *testing.T) { } } // Cat, testing stdin and stdout. - c := helperCommand("pipetest") + c := helperCommand(t, "pipetest") stdin, err := c.StdinPipe() check("StdinPipe", err) stdout, err := c.StdoutPipe() @@ -193,7 +196,7 @@ func TestStdinClose(t *testing.T) { t.Fatalf("%s: %v", what, err) } } - cmd := helperCommand("stdinClose") + cmd := helperCommand(t, "stdinClose") stdin, err := cmd.StdinPipe() check("StdinPipe", err) // Check that we can access methods of the underlying os.File.` @@ -313,7 +316,7 @@ func TestExtraFilesFDShuffle(t *testing.T) { // Moving this test case around within the overall tests may // affect the FDs obtained and hence the checks to catch these cases. npipes := 2 - c := helperCommand("extraFilesAndPipes", strconv.Itoa(npipes+1)) + c := helperCommand(t, "extraFilesAndPipes", strconv.Itoa(npipes+1)) rd, wr, _ := os.Pipe() defer rd.Close() if rd.Fd() != 3 { @@ -440,7 +443,7 @@ func TestExtraFiles(t *testing.T) { t.Fatalf("Seek: %v", err) } - c := helperCommand("read3") + c := helperCommand(t, "read3") var stdout, stderr bytes.Buffer c.Stdout = &stdout c.Stderr = &stderr @@ -483,10 +486,10 @@ func TestExtraFilesRace(t *testing.T) { for i := 0; i < 10; i++ { la := listen() - ca := helperCommand("describefiles") + ca := helperCommand(t, "describefiles") ca.ExtraFiles = []*os.File{listenerFile(la)} lb := listen() - cb := helperCommand("describefiles") + cb := helperCommand(t, "describefiles") cb.ExtraFiles = []*os.File{listenerFile(lb)} ares := make(chan string) bres := make(chan string) diff --git a/src/pkg/os/os_test.go b/src/pkg/os/os_test.go index 6c2caa94aa..16d5984e96 100644 --- a/src/pkg/os/os_test.go +++ b/src/pkg/os/os_test.go @@ -496,10 +496,10 @@ func TestHardLink(t *testing.T) { } } -func TestSymLink(t *testing.T) { - // Symlinks are not supported under windows or Plan 9. - if runtime.GOOS == "windows" || runtime.GOOS == "plan9" { - return +func TestSymlink(t *testing.T) { + switch runtime.GOOS { + case "windows", "plan9", "nacl": + t.Skipf("skipping on %s", runtime.GOOS) } from, to := "symlinktestfrom", "symlinktestto" Remove(from) // Just in case. @@ -559,9 +559,9 @@ func TestSymLink(t *testing.T) { } func TestLongSymlink(t *testing.T) { - // Symlinks are not supported under windows or Plan 9. - if runtime.GOOS == "windows" || runtime.GOOS == "plan9" { - return + switch runtime.GOOS { + case "windows", "plan9", "nacl": + t.Skipf("skipping on %s", runtime.GOOS) } s := "0123456789abcdef" // Long, but not too long: a common limit is 255. @@ -630,6 +630,10 @@ func exec(t *testing.T, dir, cmd string, args []string, expect string) { } func TestStartProcess(t *testing.T) { + if runtime.GOOS == "nacl" { + t.Skip("skipping on nacl") + } + var dir, cmd string var args []string if runtime.GOOS == "windows" { @@ -703,8 +707,10 @@ func TestFTruncate(t *testing.T) { checkSize(t, f, 1024) f.Truncate(0) checkSize(t, f, 0) - f.Write([]byte("surprise!")) - checkSize(t, f, 13+9) // wrote at offset past where hello, world was. + _, err := f.Write([]byte("surprise!")) + if err == nil { + checkSize(t, f, 13+9) // wrote at offset past where hello, world was. + } } func TestTruncate(t *testing.T) { @@ -721,8 +727,10 @@ func TestTruncate(t *testing.T) { checkSize(t, f, 1024) Truncate(f.Name(), 0) checkSize(t, f, 0) - f.Write([]byte("surprise!")) - checkSize(t, f, 13+9) // wrote at offset past where hello, world was. + _, err := f.Write([]byte("surprise!")) + if err == nil { + checkSize(t, f, 13+9) // wrote at offset past where hello, world was. + } } // Use TempDir() to make sure we're on a local file system, @@ -757,13 +765,13 @@ func TestChtimes(t *testing.T) { } postStat := st - /* Plan 9: + /* Plan 9, NaCl: Mtime is the time of the last change of content. Similarly, atime is set whenever the contents are accessed; also, it is set whenever mtime is set. */ pat := Atime(postStat) pmt := postStat.ModTime() - if !pat.Before(at) && runtime.GOOS != "plan9" { + if !pat.Before(at) && runtime.GOOS != "plan9" && runtime.GOOS != "nacl" { t.Errorf("AccessTime didn't go backwards; was=%d, after=%d", at, pat) } @@ -965,8 +973,9 @@ func run(t *testing.T, cmd []string) string { func TestHostname(t *testing.T) { // There is no other way to fetch hostname on windows, but via winapi. // On Plan 9 it is can be taken from #c/sysname as Hostname() does. - if runtime.GOOS == "windows" || runtime.GOOS == "plan9" { - return + switch runtime.GOOS { + case "windows", "plan9", "nacl": + t.Skipf("skipping on %s", runtime.GOOS) } // Check internal Hostname() against the output of /bin/hostname. @@ -1225,6 +1234,10 @@ func TestReadAtEOF(t *testing.T) { } func testKillProcess(t *testing.T, processKiller func(p *Process)) { + if runtime.GOOS == "nacl" { + t.Skip("skipping on nacl") + } + dir, err := ioutil.TempDir("", "go-build") if err != nil { t.Fatalf("Failed to create temp directory: %v", err) diff --git a/src/pkg/os/path_test.go b/src/pkg/os/path_test.go index 27abf59826..3af21cde9a 100644 --- a/src/pkg/os/path_test.go +++ b/src/pkg/os/path_test.go @@ -167,8 +167,9 @@ func TestRemoveAll(t *testing.T) { } func TestMkdirAllWithSymlink(t *testing.T) { - if runtime.GOOS == "windows" || runtime.GOOS == "plan9" { - t.Skip("Skipping test: symlinks don't exist under Windows/Plan 9") + switch runtime.GOOS { + case "nacl", "plan9", "windows": + t.Skipf("skipping on %s", runtime.GOOS) } tmpDir, err := ioutil.TempDir("", "TestMkdirAllWithSymlink-") diff --git a/src/pkg/path/filepath/match_test.go b/src/pkg/path/filepath/match_test.go index daec81532d..382692eaa4 100644 --- a/src/pkg/path/filepath/match_test.go +++ b/src/pkg/path/filepath/match_test.go @@ -167,11 +167,10 @@ var globSymlinkTests = []struct { func TestGlobSymlink(t *testing.T) { switch runtime.GOOS { - case "windows", "plan9": - // The tests below are Unix specific so we skip plan9, which does not - // support symlinks, and windows. - t.Skipf("skipping test on %v", runtime.GOOS) + case "nacl", "plan9", "windows": + t.Skipf("skipping on %s", runtime.GOOS) } + tmpDir, err := ioutil.TempDir("", "globsymlink") if err != nil { t.Fatal("creating temp dir:", err) diff --git a/src/pkg/path/filepath/path_test.go b/src/pkg/path/filepath/path_test.go index 1adc8cb072..819bd217cc 100644 --- a/src/pkg/path/filepath/path_test.go +++ b/src/pkg/path/filepath/path_test.go @@ -691,8 +691,9 @@ func simpleJoin(dir, path string) string { } func TestEvalSymlinks(t *testing.T) { - if runtime.GOOS == "plan9" { - t.Skip("Skipping test: symlinks don't exist under Plan 9") + switch runtime.GOOS { + case "nacl", "plan9": + t.Skipf("skipping on %s", runtime.GOOS) } tmpDir, err := ioutil.TempDir("", "evalsymlink") diff --git a/src/pkg/runtime/asm_amd64p32.s b/src/pkg/runtime/asm_amd64p32.s index 775ffccf14..d47f122836 100644 --- a/src/pkg/runtime/asm_amd64p32.s +++ b/src/pkg/runtime/asm_amd64p32.s @@ -302,7 +302,7 @@ TEXT reflect·call(SB), NOSPLIT, $0-20 JMP AX #define CALLFN(NAME,MAXSIZE) \ -TEXT runtime·NAME(SB), WRAPPER, $MAXSIZE-12; \ +TEXT runtime·NAME(SB), WRAPPER, $MAXSIZE-16; \ /* copy arguments to stack */ \ MOVL argptr+4(FP), SI; \ MOVL argsize+8(FP), CX; \ @@ -315,7 +315,11 @@ TEXT runtime·NAME(SB), WRAPPER, $MAXSIZE-12; \ /* copy return values back */ \ MOVL argptr+4(FP), DI; \ MOVL argsize+8(FP), CX; \ + MOVL retoffset+12(FP), BX; \ MOVL SP, SI; \ + ADDL BX, DI; \ + ADDL BX, SI; \ + SUBL BX, CX; \ REP;MOVSB; \ RET diff --git a/src/pkg/runtime/crash_test.go b/src/pkg/runtime/crash_test.go index dbcd9486de..b2e846a187 100644 --- a/src/pkg/runtime/crash_test.go +++ b/src/pkg/runtime/crash_test.go @@ -9,6 +9,7 @@ import ( "os" "os/exec" "path/filepath" + "runtime" "strings" "testing" "text/template" @@ -31,6 +32,10 @@ func testEnv(cmd *exec.Cmd) *exec.Cmd { } func executeTest(t *testing.T, templ string, data interface{}) string { + if runtime.GOOS == "nacl" { + t.Skip("skipping on nacl") + } + checkStaleRuntime(t) st := template.Must(template.New("crashSource").Parse(templ)) diff --git a/src/pkg/runtime/pprof/pprof_test.go b/src/pkg/runtime/pprof/pprof_test.go index 91f53000ca..aba538e755 100644 --- a/src/pkg/runtime/pprof/pprof_test.go +++ b/src/pkg/runtime/pprof/pprof_test.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 !nacl + package pprof_test import ( diff --git a/src/pkg/runtime/runtime_test.go b/src/pkg/runtime/runtime_test.go index 62e59c78db..5a9f52fe0f 100644 --- a/src/pkg/runtime/runtime_test.go +++ b/src/pkg/runtime/runtime_test.go @@ -95,6 +95,10 @@ func BenchmarkDeferMany(b *testing.B) { // The value reported will include the padding between runtime.gogo and the // next function in memory. That's fine. func TestRuntimeGogoBytes(t *testing.T) { + if GOOS == "nacl" { + t.Skip("skipping on nacl") + } + dir, err := ioutil.TempDir("", "go-build") if err != nil { t.Fatalf("failed to create temp directory: %v", err) @@ -183,6 +187,10 @@ func TestSetPanicOnFault(t *testing.T) { } func testSetPanicOnFault(t *testing.T, addr uintptr) { + if GOOS == "nacl" { + t.Skip("nacl doesn't seem to fault on high addresses") + } + defer func() { if err := recover(); err == nil { t.Fatalf("did not find error in recover") |
