From cbd0445ec3b0b184db66966d8a47e6b37d13692e Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 25 Nov 2020 09:17:50 +0100 Subject: 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. --- pkg/ipc/ipc_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'pkg/ipc/ipc_test.go') 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) -- cgit mrf-deployment