diff options
author | Kenny Grant <kennygrant@gmail.com> | 2017-03-17 23:03:34 +0000 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2017-10-20 12:33:04 -0400 |
commit | 64f53b2573c3eb6fce9a63d395d911bf560e85f0 (patch) | |
tree | aa9a7cc1e761425576b404e3446b285956d73fc6 | |
parent | 235fe5d0724da3e8465d7c712de93ac26e786397 (diff) | |
download | go-64f53b2573c3eb6fce9a63d395d911bf560e85f0.tar.gz go-64f53b2573c3eb6fce9a63d395d911bf560e85f0.zip |
[release-branch.go1.8] net/http: Fix TestLinuxSendfile without strace permissions
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>
-rw-r--r-- | src/net/http/fs_test.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/net/http/fs_test.go b/src/net/http/fs_test.go index 17a0e4a9af..0b326f3bde 100644 --- a/src/net/http/fs_test.go +++ b/src/net/http/fs_test.go @@ -1091,7 +1091,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 |