Skip to content

Commit 7a5e0fe

Browse files
committed
net/http: relax TestLinuxSendfile, trace all system calls, match n64:sendfile
Fixes #35423 Change-Id: Idb254d6a2c4b147d20e290411e4380df5cdcb306 Reviewed-on: https://go-review.googlesource.com/c/go/+/206178 Run-TryBot: Brad Fitzpatrick <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 904e113 commit 7a5e0fe

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/net/http/fs_test.go

+3-11
Original file line numberDiff line numberDiff line change
@@ -1122,21 +1122,13 @@ func TestLinuxSendfile(t *testing.T) {
11221122
}
11231123
defer ln.Close()
11241124

1125-
syscalls := "sendfile,sendfile64"
1126-
switch runtime.GOARCH {
1127-
case "mips64", "mips64le", "s390x":
1128-
// strace on the above platforms doesn't support sendfile64
1129-
// and will error out if we specify that with `-e trace='.
1130-
syscalls = "sendfile"
1131-
}
1132-
11331125
// Attempt to run strace, and skip on failure - this test requires SYS_PTRACE.
1134-
if err := exec.Command("strace", "-f", "-q", "-e", "trace="+syscalls, os.Args[0], "-test.run=^$").Run(); err != nil {
1126+
if err := exec.Command("strace", "-f", "-q", os.Args[0], "-test.run=^$").Run(); err != nil {
11351127
t.Skipf("skipping; failed to run strace: %v", err)
11361128
}
11371129

11381130
var buf bytes.Buffer
1139-
child := exec.Command("strace", "-f", "-q", "-e", "trace="+syscalls, os.Args[0], "-test.run=TestLinuxSendfileChild")
1131+
child := exec.Command("strace", "-f", "-q", os.Args[0], "-test.run=TestLinuxSendfileChild")
11401132
child.ExtraFiles = append(child.ExtraFiles, lnf)
11411133
child.Env = append([]string{"GO_WANT_HELPER_PROCESS=1"}, os.Environ()...)
11421134
child.Stdout = &buf
@@ -1159,7 +1151,7 @@ func TestLinuxSendfile(t *testing.T) {
11591151
Post(fmt.Sprintf("http://%s/quit", ln.Addr()), "", nil)
11601152
child.Wait()
11611153

1162-
rx := regexp.MustCompile(`sendfile(64)?\(`)
1154+
rx := regexp.MustCompile(`\b(n64:)?sendfile(64)?\(`)
11631155
out := buf.String()
11641156
if !rx.MatchString(out) {
11651157
t.Errorf("no sendfile system call found in:\n%s", out)

0 commit comments

Comments
 (0)