]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: relax TestLinuxSendfile, trace all system calls, match n64:sendfile
authorBrad Fitzpatrick <bradfitz@golang.org>
Fri, 8 Nov 2019 19:18:17 +0000 (19:18 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 8 Nov 2019 20:05:25 +0000 (20:05 +0000)
Fixes #35423

Change-Id: Idb254d6a2c4b147d20e290411e4380df5cdcb306
Reviewed-on: https://go-review.googlesource.com/c/go/+/206178
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/net/http/fs_test.go

index 047bb04ad8d947dd6c6e505f5eeaed3522e21ea8..435e34be3af08082716a5dc7a5191adc9837d245 100644 (file)
@@ -1122,21 +1122,13 @@ func TestLinuxSendfile(t *testing.T) {
        }
        defer ln.Close()
 
-       syscalls := "sendfile,sendfile64"
-       switch runtime.GOARCH {
-       case "mips64", "mips64le", "s390x":
-               // strace on the above platforms doesn't support sendfile64
-               // and will error out if we specify that with `-e trace='.
-               syscalls = "sendfile"
-       }
-
        // Attempt to run strace, and skip on failure - this test requires SYS_PTRACE.
-       if err := exec.Command("strace", "-f", "-q", "-e", "trace="+syscalls, os.Args[0], "-test.run=^$").Run(); err != nil {
+       if err := exec.Command("strace", "-f", "-q", os.Args[0], "-test.run=^$").Run(); err != nil {
                t.Skipf("skipping; failed to run strace: %v", err)
        }
 
        var buf bytes.Buffer
-       child := exec.Command("strace", "-f", "-q", "-e", "trace="+syscalls, os.Args[0], "-test.run=TestLinuxSendfileChild")
+       child := exec.Command("strace", "-f", "-q", os.Args[0], "-test.run=TestLinuxSendfileChild")
        child.ExtraFiles = append(child.ExtraFiles, lnf)
        child.Env = append([]string{"GO_WANT_HELPER_PROCESS=1"}, os.Environ()...)
        child.Stdout = &buf
@@ -1159,7 +1151,7 @@ func TestLinuxSendfile(t *testing.T) {
        Post(fmt.Sprintf("http://%s/quit", ln.Addr()), "", nil)
        child.Wait()
 
-       rx := regexp.MustCompile(`sendfile(64)?\(`)
+       rx := regexp.MustCompile(`\b(n64:)?sendfile(64)?\(`)
        out := buf.String()
        if !rx.MatchString(out) {
                t.Errorf("no sendfile system call found in:\n%s", out)