diff options
Diffstat (limited to 'tests/wasm/setup_test.go')
-rw-r--r-- | tests/wasm/setup_test.go | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/tests/wasm/setup_test.go b/tests/wasm/setup_test.go index 0071076c2..e5a18daf7 100644 --- a/tests/wasm/setup_test.go +++ b/tests/wasm/setup_test.go @@ -4,7 +4,6 @@ import ( "context" "errors" "fmt" - "log" "net/http" "net/http/httptest" "os/exec" @@ -18,29 +17,29 @@ import ( "github.com/chromedp/chromedp" ) -func run(cmdline string) error { +func run(t *testing.T, cmdline string) error { args := strings.Fields(cmdline) - return runargs(args...) + return runargs(t, args...) } -func runargs(args ...string) error { +func runargs(t *testing.T, args ...string) error { cmd := exec.Command(args[0], args[1:]...) b, err := cmd.CombinedOutput() - log.Printf("Command: %s; err=%v; full output:\n%s", strings.Join(args, " "), err, b) + t.Logf("Command: %s; err=%v; full output:\n%s", strings.Join(args, " "), err, b) if err != nil { return err } return nil } -func chromectx(timeout time.Duration) (context.Context, context.CancelFunc) { +func chromectx() (context.Context, context.CancelFunc) { var ctx context.Context // looks for locally installed Chrome ctx, _ = chromedp.NewContext(context.Background()) - ctx, cancel := context.WithTimeout(ctx, timeout) + ctx, cancel := context.WithTimeout(ctx, 10*time.Second) return ctx, cancel } |