]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: Fix TestLinuxSendfile without strace permissions
authorKenny Grant <kennygrant@gmail.com>
Fri, 17 Mar 2017 23:03:34 +0000 (23:03 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 24 Mar 2017 23:40:35 +0000 (23:40 +0000)
If go doesn't have permission to run strace, this test hangs while
waiting for strace to run. Instead try invoking strace with
Run() first - on fail skip and report error, otherwise run
the test normally using strace.

Also fix link to open mips64 issue in same test.

Fixes #9711

Change-Id: Ibbc5fbb143ea6d0f8b6cfdca4b385ef4c8960b3d
Reviewed-on: https://go-review.googlesource.com/38633
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/net/http/fs_test.go

index e12350efd735d8283449e558dcd717130a40ef87..b682e779a415ce0ef8f594ba7eb669c2325a72ca 100644 (file)
@@ -1096,7 +1096,12 @@ func TestLinuxSendfile(t *testing.T) {
                // and will error out if we specify that with `-e trace='.
                syscalls = "sendfile"
        case "mips64":
-               t.Skip("TODO: update this test to be robust against various versions of strace on mips64. See golang.org/issue/33430")
+               t.Skip("TODO: update this test to be robust against various versions of strace on mips64. See golang.org/issue/18008")
+       }
+
+       // 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 {
+               t.Skipf("skipping; failed to run strace: %v", err)
        }
 
        var buf bytes.Buffer