mirror of https://github.com/golang/go.git
syscall: use testing.T.Context
Change-Id: I62763878d51598bf1ae0a4e75441e1d3a4b86aa3 Reviewed-on: https://go-review.googlesource.com/c/go/+/656955 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
af92bb594d
commit
fb8691edae
|
|
@ -5,7 +5,6 @@
|
||||||
package syscall_test
|
package syscall_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"internal/testenv"
|
"internal/testenv"
|
||||||
"io"
|
"io"
|
||||||
|
|
@ -734,9 +733,6 @@ func TestPrlimitFileLimit(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
exe, err := os.Executable()
|
exe, err := os.Executable()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|
@ -759,7 +755,7 @@ func TestPrlimitFileLimit(t *testing.T) {
|
||||||
var output strings.Builder
|
var output strings.Builder
|
||||||
|
|
||||||
const arg = "-test.run=^TestPrlimitFileLimit$"
|
const arg = "-test.run=^TestPrlimitFileLimit$"
|
||||||
cmd := testenv.CommandContext(t, ctx, exe, arg, "-test.v")
|
cmd := testenv.CommandContext(t, t.Context(), exe, arg, "-test.v")
|
||||||
cmd = testenv.CleanCmdEnv(cmd)
|
cmd = testenv.CleanCmdEnv(cmd)
|
||||||
cmd.Env = append(cmd.Env, "GO_WANT_HELPER_PROCESS=prlimit1")
|
cmd.Env = append(cmd.Env, "GO_WANT_HELPER_PROCESS=prlimit1")
|
||||||
cmd.ExtraFiles = []*os.File{r1, w2}
|
cmd.ExtraFiles = []*os.File{r1, w2}
|
||||||
|
|
@ -846,16 +842,13 @@ func testPrlimitFileLimitHelper1(t *testing.T) {
|
||||||
// Start the grandchild, which should see the rlimit
|
// Start the grandchild, which should see the rlimit
|
||||||
// set by the prlimit called by the parent.
|
// set by the prlimit called by the parent.
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
exe, err := os.Executable()
|
exe, err := os.Executable()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
const arg = "-test.run=^TestPrlimitFileLimit$"
|
const arg = "-test.run=^TestPrlimitFileLimit$"
|
||||||
cmd := testenv.CommandContext(t, ctx, exe, arg, "-test.v")
|
cmd := testenv.CommandContext(t, t.Context(), exe, arg, "-test.v")
|
||||||
cmd = testenv.CleanCmdEnv(cmd)
|
cmd = testenv.CleanCmdEnv(cmd)
|
||||||
cmd.Env = append(cmd.Env, "GO_WANT_HELPER_PROCESS=prlimit2")
|
cmd.Env = append(cmd.Env, "GO_WANT_HELPER_PROCESS=prlimit2")
|
||||||
t.Logf("running %s %s", exe, arg)
|
t.Logf("running %s %s", exe, arg)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue