use DisableGPU in the tests

On my i5-8350U, the option takes 'go test' from ~11s to ~10s, from a
manual look over a few runs.
This commit is contained in:
Daniel Martí 2019-03-20 17:41:47 +00:00
parent da4ac414ed
commit 6fb5264bbd

View File

@ -17,6 +17,7 @@ var (
NoFirstRun, NoFirstRun,
NoDefaultBrowserCheck, NoDefaultBrowserCheck,
Headless, Headless,
DisableGPU,
} }
) )
@ -59,10 +60,6 @@ func TestMain(m *testing.M) {
if noSandbox := os.Getenv("CHROMEDP_NO_SANDBOX"); noSandbox != "false" { if noSandbox := os.Getenv("CHROMEDP_NO_SANDBOX"); noSandbox != "false" {
allocOpts = append(allocOpts, NoSandbox) allocOpts = append(allocOpts, NoSandbox)
} }
// must be explicitly set, as disabling gpu slows unit tests
if disableGPU := os.Getenv("CHROMEDP_DISABLE_GPU"); disableGPU != "" && disableGPU != "false" {
allocOpts = append(allocOpts, DisableGPU)
}
ctx, cancel := NewAllocator(context.Background(), WithExecAllocator(allocOpts...)) ctx, cancel := NewAllocator(context.Background(), WithExecAllocator(allocOpts...))
allocCtx = ctx allocCtx = ctx