aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/ipc/ipc_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-11-25 09:17:50 +0100
committerDmitry Vyukov <dvyukov@google.com>2020-12-28 14:22:41 +0100
commitcbd0445ec3b0b184db66966d8a47e6b37d13692e (patch)
tree14ed47723c325ef1b388e4e732a70c0fed4fa101 /pkg/ipc/ipc_test.go
parent2242f77fdc5a6c50bd8fa1021d2abc8b83e09e8d (diff)
all: make timeouts configurable
Add sys/targets.Timeouts struct that parametrizes timeouts throughout the system. The struct allows to control syscall/program/no output timeouts for OS/arch/VM/etc. See comment on the struct for more details.
Diffstat (limited to 'pkg/ipc/ipc_test.go')
-rw-r--r--pkg/ipc/ipc_test.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/pkg/ipc/ipc_test.go b/pkg/ipc/ipc_test.go
index e5e919a89..44fdb67bd 100644
--- a/pkg/ipc/ipc_test.go
+++ b/pkg/ipc/ipc_test.go
@@ -30,7 +30,7 @@ func buildExecutor(t *testing.T, target *prog.Target) string {
return bin
}
-func initTest(t *testing.T) (*prog.Target, rand.Source, int, bool, bool) {
+func initTest(t *testing.T) (*prog.Target, rand.Source, int, bool, bool, targets.Timeouts) {
t.Parallel()
iters := 100
if testing.Short() {
@@ -50,7 +50,7 @@ func initTest(t *testing.T) (*prog.Target, rand.Source, int, bool, bool) {
if err != nil {
t.Fatal(err)
}
- return target, rs, iters, cfg.UseShmem, cfg.UseForkServer
+ return target, rs, iters, cfg.UseShmem, cfg.UseForkServer, cfg.Timeouts
}
// TestExecutor runs all internal executor unit tests.
@@ -82,7 +82,7 @@ func TestExecutor(t *testing.T) {
}
func TestExecute(t *testing.T) {
- target, _, _, useShmem, useForkServer := initTest(t)
+ target, _, _, useShmem, useForkServer, timeouts := initTest(t)
bin := buildExecutor(t, target)
defer os.Remove(bin)
@@ -94,6 +94,7 @@ func TestExecute(t *testing.T) {
Executor: bin,
UseShmem: useShmem,
UseForkServer: useForkServer,
+ Timeouts: timeouts,
}
env, err := MakeEnv(cfg, 0)
if err != nil {
@@ -127,13 +128,14 @@ func TestExecute(t *testing.T) {
}
func TestParallel(t *testing.T) {
- target, _, _, useShmem, useForkServer := initTest(t)
+ target, _, _, useShmem, useForkServer, timeouts := initTest(t)
bin := buildExecutor(t, target)
defer os.Remove(bin)
cfg := &Config{
Executor: bin,
UseShmem: useShmem,
UseForkServer: useForkServer,
+ Timeouts: timeouts,
}
const P = 10
errs := make(chan error, P)