[canvaskit] Try some things to reduce GPU test flakiness

1) some flags that "The Internet" says may help
2) retry running the test script up to 3 times.

I wasn't able to reproduce the crashes with a non-Docker
Chrome, only in the Docker container, which was
very hard to debug.

Change-Id: I87f31c32f63b2770d8d5afa6a8e4b90c35dbf0bb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255820
Reviewed-by: Eric Boren <borenet@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
diff --git a/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-GCC-loongson3a-Release-Docker.json b/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-GCC-loongson3a-Release-Docker.json
index 4f7719b..2a3d723 100644
--- a/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-GCC-loongson3a-Release-Docker.json
+++ b/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-GCC-loongson3a-Release-Docker.json
@@ -72,7 +72,9 @@
       "cc=\"/usr/bin/mips64el-linux-gnuabi64-gcc-8\" cxx=\"/usr/bin/mips64el-linux-gnuabi64-g++-8\" extra_cflags=[\"-DDUMMY_docker_image=gcr.io/skia-public/gcc-debian10-mips64el@sha256:c173a718d9f62f0cd1e5335713ebc4721d5dcf662fb02597744b71c53338a540\"] extra_ldflags=[] is_debug=false target_cpu=\"loongson3a\" werror=true"
     ],
     "env": {
-      "DOCKER_CONFIG": "/home/chrome-bot/.docker"
+      "CHROME_HEADLESS": "1",
+      "DOCKER_CONFIG": "/home/chrome-bot/.docker",
+      "PATH": "<PATH>:RECIPE_REPO[depot_tools]"
     },
     "name": "Run build script in Docker"
   },
diff --git a/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-GCC-x86-Debug-Docker.json b/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-GCC-x86-Debug-Docker.json
index 581ebae..5788145 100644
--- a/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-GCC-x86-Debug-Docker.json
+++ b/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-GCC-x86-Debug-Docker.json
@@ -72,7 +72,9 @@
       "cc=\"gcc\" cxx=\"g++\" extra_cflags=[\"-DDUMMY_docker_image=gcr.io/skia-public/gcc-debian10-x86@sha256:b1ec55403ac66d9500d033d6ffd7663894d32335711fbbb0fb4c67dfce812203\"] extra_ldflags=[] target_cpu=\"x86\" werror=true"
     ],
     "env": {
-      "DOCKER_CONFIG": "/home/chrome-bot/.docker"
+      "CHROME_HEADLESS": "1",
+      "DOCKER_CONFIG": "/home/chrome-bot/.docker",
+      "PATH": "<PATH>:RECIPE_REPO[depot_tools]"
     },
     "name": "Run build script in Docker"
   },
diff --git a/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-GCC-x86_64-Debug-Docker.json b/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-GCC-x86_64-Debug-Docker.json
index 94ca154..3a0a196 100644
--- a/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-GCC-x86_64-Debug-Docker.json
+++ b/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-GCC-x86_64-Debug-Docker.json
@@ -72,7 +72,9 @@
       "cc=\"gcc\" cxx=\"g++\" extra_cflags=[\"-DDUMMY_docker_image=gcr.io/skia-public/gcc-debian10@sha256:89a72df1e2fdea6f774a3fa4199bb9aaa4a0526a3ac1f233e604d689b694f95c\"] extra_ldflags=[] target_cpu=\"x86_64\" werror=true"
     ],
     "env": {
-      "DOCKER_CONFIG": "/home/chrome-bot/.docker"
+      "CHROME_HEADLESS": "1",
+      "DOCKER_CONFIG": "/home/chrome-bot/.docker",
+      "PATH": "<PATH>:RECIPE_REPO[depot_tools]"
     },
     "name": "Run build script in Docker"
   },
diff --git a/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-GCC-x86_64-Release-NoGPU_Docker.json b/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-GCC-x86_64-Release-NoGPU_Docker.json
index b2e358c..ef87b5c 100644
--- a/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-GCC-x86_64-Release-NoGPU_Docker.json
+++ b/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-GCC-x86_64-Release-NoGPU_Docker.json
@@ -72,7 +72,9 @@
       "cc=\"gcc\" cxx=\"g++\" extra_cflags=[\"-DDUMMY_docker_image=gcr.io/skia-public/gcc-debian10@sha256:89a72df1e2fdea6f774a3fa4199bb9aaa4a0526a3ac1f233e604d689b694f95c\"] extra_ldflags=[] is_debug=false skia_enable_gpu=false target_cpu=\"x86_64\" werror=true"
     ],
     "env": {
-      "DOCKER_CONFIG": "/home/chrome-bot/.docker"
+      "CHROME_HEADLESS": "1",
+      "DOCKER_CONFIG": "/home/chrome-bot/.docker",
+      "PATH": "<PATH>:RECIPE_REPO[depot_tools]"
     },
     "name": "Run build script in Docker"
   },
diff --git a/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-GCC-x86_64-Release-Shared_Docker.json b/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-GCC-x86_64-Release-Shared_Docker.json
index 4f58a49..d9177ed 100644
--- a/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-GCC-x86_64-Release-Shared_Docker.json
+++ b/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-GCC-x86_64-Release-Shared_Docker.json
@@ -72,7 +72,9 @@
       "cc=\"gcc\" cxx=\"g++\" extra_cflags=[\"-DDUMMY_docker_image=gcr.io/skia-public/gcc-debian10@sha256:89a72df1e2fdea6f774a3fa4199bb9aaa4a0526a3ac1f233e604d689b694f95c\"] extra_ldflags=[] is_component_build=true is_debug=false target_cpu=\"x86_64\" werror=true"
     ],
     "env": {
-      "DOCKER_CONFIG": "/home/chrome-bot/.docker"
+      "CHROME_HEADLESS": "1",
+      "DOCKER_CONFIG": "/home/chrome-bot/.docker",
+      "PATH": "<PATH>:RECIPE_REPO[depot_tools]"
     },
     "name": "Run build script in Docker"
   },
diff --git a/infra/bots/recipe_modules/build/examples/full.expected/Build-Ubuntu18-GCC-x86_64-Release-Docker.json b/infra/bots/recipe_modules/build/examples/full.expected/Build-Ubuntu18-GCC-x86_64-Release-Docker.json
index 5b13def..2852f68 100644
--- a/infra/bots/recipe_modules/build/examples/full.expected/Build-Ubuntu18-GCC-x86_64-Release-Docker.json
+++ b/infra/bots/recipe_modules/build/examples/full.expected/Build-Ubuntu18-GCC-x86_64-Release-Docker.json
@@ -72,7 +72,9 @@
       "cc=\"gcc\" cxx=\"g++\" extra_cflags=[\"-DDUMMY_docker_image=gcr.io/skia-public/gcc-ubuntu18@sha256:3439bba135be1593de385f89b59e503ab28ef637ba634e2ecec43559dd928c69\"] extra_ldflags=[] is_debug=false target_cpu=\"x86_64\" werror=true"
     ],
     "env": {
-      "DOCKER_CONFIG": "/home/chrome-bot/.docker"
+      "CHROME_HEADLESS": "1",
+      "DOCKER_CONFIG": "/home/chrome-bot/.docker",
+      "PATH": "<PATH>:RECIPE_REPO[depot_tools]"
     },
     "name": "Run build script in Docker"
   },
diff --git a/infra/bots/recipe_modules/docker/api.py b/infra/bots/recipe_modules/docker/api.py
index 1fe560d..4fb7560 100644
--- a/infra/bots/recipe_modules/docker/api.py
+++ b/infra/bots/recipe_modules/docker/api.py
@@ -21,7 +21,7 @@
     name = ' '.join([str(elem) for elem in cmd])
     self.m.step(name, cmd=cmd, infra_step=True)
 
-  def run(self, name, docker_image, src_dir, out_dir, script, args=None, docker_args=None, copies=None, recursive_read=None):
+  def run(self, name, docker_image, src_dir, out_dir, script, args=None, docker_args=None, copies=None, recursive_read=None, attempts=1):
     # Setup. Docker runs as a different user, so we need to give it access to
     # read, write, and execute certain files.
     with self.m.step.nest('Docker setup'):
@@ -69,4 +69,4 @@
 
     env = {'DOCKER_CONFIG': '/home/chrome-bot/.docker'}
     with self.m.env(env):
-      self.m.step(name, cmd=cmd)
+      self.m.run.with_retry(self.m.step, name, attempts, cmd=cmd)
diff --git a/infra/bots/recipe_modules/docker/examples/full.expected/test.json b/infra/bots/recipe_modules/docker/examples/full.expected/test.json
index b300a70..f1aca22 100644
--- a/infra/bots/recipe_modules/docker/examples/full.expected/test.json
+++ b/infra/bots/recipe_modules/docker/examples/full.expected/test.json
@@ -135,7 +135,9 @@
       "value"
     ],
     "env": {
-      "DOCKER_CONFIG": "/home/chrome-bot/.docker"
+      "CHROME_HEADLESS": "1",
+      "DOCKER_CONFIG": "/home/chrome-bot/.docker",
+      "PATH": "<PATH>:RECIPE_REPO[depot_tools]"
     },
     "name": "do Docker stuff"
   },
diff --git a/infra/bots/recipe_modules/docker/examples/full.py b/infra/bots/recipe_modules/docker/examples/full.py
index d99ba11..f2c620e 100644
--- a/infra/bots/recipe_modules/docker/examples/full.py
+++ b/infra/bots/recipe_modules/docker/examples/full.py
@@ -6,11 +6,14 @@
 DEPS = [
   'docker',
   'recipe_engine/context',
+  'recipe_engine/properties',
   'recipe_engine/step',
+  'vars',
 ]
 
 
 def RunSteps(api):
+  api.vars.setup()
   api.docker.run(
       name='do Docker stuff',
       docker_image='my.docker.image',
@@ -24,4 +27,12 @@
   )
 
 def GenTests(api):
-  yield api.test('test')
+  yield (api.test('test') +
+         api.properties(buildername='Test-Debian9-EMCC-GCE-GPU-WEBGL1-wasm-Debug-All-CanvasKit',
+                        buildbucket_build_id='123454321',
+                        revision='abc123',
+                        path_config='kitchen',
+                        gold_hashes_url='https://example.com/hashes.txt',
+                        swarm_out_dir='[SWARM_OUT_DIR]',
+                        task_id='task_12345')
+  )
diff --git a/infra/bots/recipes/perf_canvaskit.expected/Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-CanvasKit.json b/infra/bots/recipes/perf_canvaskit.expected/Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-CanvasKit.json
index 6683bf2..db7a4ce 100644
--- a/infra/bots/recipes/perf_canvaskit.expected/Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-CanvasKit.json
+++ b/infra/bots/recipes/perf_canvaskit.expected/Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-CanvasKit.json
@@ -220,9 +220,11 @@
       "canvaskit"
     ],
     "env": {
-      "DOCKER_CONFIG": "/home/chrome-bot/.docker"
+      "CHROME_HEADLESS": "1",
+      "DOCKER_CONFIG": "/home/chrome-bot/.docker",
+      "PATH": "<PATH>:RECIPE_REPO[depot_tools]"
     },
-    "name": "Test CanvasKit with Docker"
+    "name": "Performance tests of CanvasKit with Docker"
   },
   {
     "name": "$result"
diff --git a/infra/bots/recipes/perf_canvaskit.expected/pathkit_trybot.json b/infra/bots/recipes/perf_canvaskit.expected/pathkit_trybot.json
index 3083801..62744f5 100644
--- a/infra/bots/recipes/perf_canvaskit.expected/pathkit_trybot.json
+++ b/infra/bots/recipes/perf_canvaskit.expected/pathkit_trybot.json
@@ -224,9 +224,11 @@
       "7"
     ],
     "env": {
-      "DOCKER_CONFIG": "/home/chrome-bot/.docker"
+      "CHROME_HEADLESS": "1",
+      "DOCKER_CONFIG": "/home/chrome-bot/.docker",
+      "PATH": "<PATH>:RECIPE_REPO[depot_tools]"
     },
-    "name": "Test CanvasKit with Docker"
+    "name": "Performance tests of CanvasKit with Docker"
   },
   {
     "name": "$result"
diff --git a/infra/bots/recipes/perf_canvaskit.py b/infra/bots/recipes/perf_canvaskit.py
index eb1e882..dcb7bed 100644
--- a/infra/bots/recipes/perf_canvaskit.py
+++ b/infra/bots/recipes/perf_canvaskit.py
@@ -56,7 +56,7 @@
     ])
 
   api.docker.run(
-      name='Test CanvasKit with Docker',
+      name='Performance tests of CanvasKit with Docker',
       docker_image=DOCKER_IMAGE,
       src_dir=checkout_root,
       out_dir=out_dir,
@@ -65,6 +65,7 @@
       docker_args=None,
       copies=copies,
       recursive_read=recursive_read,
+      attempts=3,
   )
 
 
diff --git a/infra/bots/recipes/perf_pathkit.expected/Perf-Debian9-EMCC-GCE-CPU-AVX2-asmjs-Release-All-PathKit.json b/infra/bots/recipes/perf_pathkit.expected/Perf-Debian9-EMCC-GCE-CPU-AVX2-asmjs-Release-All-PathKit.json
index b0543cd..60fbd6f 100644
--- a/infra/bots/recipes/perf_pathkit.expected/Perf-Debian9-EMCC-GCE-CPU-AVX2-asmjs-Release-All-PathKit.json
+++ b/infra/bots/recipes/perf_pathkit.expected/Perf-Debian9-EMCC-GCE-CPU-AVX2-asmjs-Release-All-PathKit.json
@@ -239,7 +239,9 @@
       "asmjs"
     ],
     "env": {
-      "DOCKER_CONFIG": "/home/chrome-bot/.docker"
+      "CHROME_HEADLESS": "1",
+      "DOCKER_CONFIG": "/home/chrome-bot/.docker",
+      "PATH": "<PATH>:RECIPE_REPO[depot_tools]"
     },
     "name": "Performance tests of PathKit with Docker"
   },
diff --git a/infra/bots/recipes/perf_pathkit.expected/Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-PathKit.json b/infra/bots/recipes/perf_pathkit.expected/Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-PathKit.json
index c47474c..68894ae 100644
--- a/infra/bots/recipes/perf_pathkit.expected/Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-PathKit.json
+++ b/infra/bots/recipes/perf_pathkit.expected/Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-PathKit.json
@@ -235,7 +235,9 @@
       "pathkit"
     ],
     "env": {
-      "DOCKER_CONFIG": "/home/chrome-bot/.docker"
+      "CHROME_HEADLESS": "1",
+      "DOCKER_CONFIG": "/home/chrome-bot/.docker",
+      "PATH": "<PATH>:RECIPE_REPO[depot_tools]"
     },
     "name": "Performance tests of PathKit with Docker"
   },
diff --git a/infra/bots/recipes/perf_pathkit.expected/pathkit_trybot.json b/infra/bots/recipes/perf_pathkit.expected/pathkit_trybot.json
index 7af05a6..a93a194 100644
--- a/infra/bots/recipes/perf_pathkit.expected/pathkit_trybot.json
+++ b/infra/bots/recipes/perf_pathkit.expected/pathkit_trybot.json
@@ -239,7 +239,9 @@
       "7"
     ],
     "env": {
-      "DOCKER_CONFIG": "/home/chrome-bot/.docker"
+      "CHROME_HEADLESS": "1",
+      "DOCKER_CONFIG": "/home/chrome-bot/.docker",
+      "PATH": "<PATH>:RECIPE_REPO[depot_tools]"
     },
     "name": "Performance tests of PathKit with Docker"
   },
diff --git a/infra/bots/recipes/perf_pathkit.py b/infra/bots/recipes/perf_pathkit.py
index 4cd7530..d520cc0 100644
--- a/infra/bots/recipes/perf_pathkit.py
+++ b/infra/bots/recipes/perf_pathkit.py
@@ -82,6 +82,7 @@
       docker_args=docker_args,
       copies=copies,
       recursive_read=recursive_read,
+      attempts=3,
   )
 
 
diff --git a/infra/bots/recipes/test_canvaskit.expected/Test-Debian9-EMCC-GCE-GPU-WEBGL1-wasm-Debug-All-CanvasKit.json b/infra/bots/recipes/test_canvaskit.expected/Test-Debian9-EMCC-GCE-GPU-WEBGL1-wasm-Debug-All-CanvasKit.json
index 24580d1..e382257 100644
--- a/infra/bots/recipes/test_canvaskit.expected/Test-Debian9-EMCC-GCE-GPU-WEBGL1-wasm-Debug-All-CanvasKit.json
+++ b/infra/bots/recipes/test_canvaskit.expected/Test-Debian9-EMCC-GCE-GPU-WEBGL1-wasm-Debug-All-CanvasKit.json
@@ -235,7 +235,9 @@
       "canvaskit"
     ],
     "env": {
-      "DOCKER_CONFIG": "/home/chrome-bot/.docker"
+      "CHROME_HEADLESS": "1",
+      "DOCKER_CONFIG": "/home/chrome-bot/.docker",
+      "PATH": "<PATH>:RECIPE_REPO[depot_tools]"
     },
     "name": "Test CanvasKit with Docker"
   },
diff --git a/infra/bots/recipes/test_canvaskit.expected/canvaskit_trybot.json b/infra/bots/recipes/test_canvaskit.expected/canvaskit_trybot.json
index ad3b02c..3b0202b 100644
--- a/infra/bots/recipes/test_canvaskit.expected/canvaskit_trybot.json
+++ b/infra/bots/recipes/test_canvaskit.expected/canvaskit_trybot.json
@@ -239,7 +239,9 @@
       "7"
     ],
     "env": {
-      "DOCKER_CONFIG": "/home/chrome-bot/.docker"
+      "CHROME_HEADLESS": "1",
+      "DOCKER_CONFIG": "/home/chrome-bot/.docker",
+      "PATH": "<PATH>:RECIPE_REPO[depot_tools]"
     },
     "name": "Test CanvasKit with Docker"
   },
diff --git a/infra/bots/recipes/test_canvaskit.py b/infra/bots/recipes/test_canvaskit.py
index 007a63a..956e896 100644
--- a/infra/bots/recipes/test_canvaskit.py
+++ b/infra/bots/recipes/test_canvaskit.py
@@ -66,6 +66,7 @@
       docker_args=None,
       copies=copies,
       recursive_read=recursive_read,
+      attempts=3,
   )
 
 
diff --git a/infra/bots/recipes/test_pathkit.expected/Test-Debian9-EMCC-GCE-CPU-AVX2-asmjs-Debug-All-PathKit.json b/infra/bots/recipes/test_pathkit.expected/Test-Debian9-EMCC-GCE-CPU-AVX2-asmjs-Debug-All-PathKit.json
index 8977407..d8e592c 100644
--- a/infra/bots/recipes/test_pathkit.expected/Test-Debian9-EMCC-GCE-CPU-AVX2-asmjs-Debug-All-PathKit.json
+++ b/infra/bots/recipes/test_pathkit.expected/Test-Debian9-EMCC-GCE-CPU-AVX2-asmjs-Debug-All-PathKit.json
@@ -177,7 +177,9 @@
       "asmjs"
     ],
     "env": {
-      "DOCKER_CONFIG": "/home/chrome-bot/.docker"
+      "CHROME_HEADLESS": "1",
+      "DOCKER_CONFIG": "/home/chrome-bot/.docker",
+      "PATH": "<PATH>:RECIPE_REPO[depot_tools]"
     },
     "name": "Test PathKit with Docker"
   },
diff --git a/infra/bots/recipes/test_pathkit.expected/Test-Debian9-EMCC-GCE-CPU-AVX2-asmjs-Release-All-PathKit.json b/infra/bots/recipes/test_pathkit.expected/Test-Debian9-EMCC-GCE-CPU-AVX2-asmjs-Release-All-PathKit.json
index b8334af..8bde211 100644
--- a/infra/bots/recipes/test_pathkit.expected/Test-Debian9-EMCC-GCE-CPU-AVX2-asmjs-Release-All-PathKit.json
+++ b/infra/bots/recipes/test_pathkit.expected/Test-Debian9-EMCC-GCE-CPU-AVX2-asmjs-Release-All-PathKit.json
@@ -224,7 +224,9 @@
       "asmjs"
     ],
     "env": {
-      "DOCKER_CONFIG": "/home/chrome-bot/.docker"
+      "CHROME_HEADLESS": "1",
+      "DOCKER_CONFIG": "/home/chrome-bot/.docker",
+      "PATH": "<PATH>:RECIPE_REPO[depot_tools]"
     },
     "name": "Test PathKit with Docker"
   },
diff --git a/infra/bots/recipes/test_pathkit.expected/Test-Debian9-EMCC-GCE-CPU-AVX2-wasm-Debug-All-PathKit.json b/infra/bots/recipes/test_pathkit.expected/Test-Debian9-EMCC-GCE-CPU-AVX2-wasm-Debug-All-PathKit.json
index 17379af..7ecd73d 100644
--- a/infra/bots/recipes/test_pathkit.expected/Test-Debian9-EMCC-GCE-CPU-AVX2-wasm-Debug-All-PathKit.json
+++ b/infra/bots/recipes/test_pathkit.expected/Test-Debian9-EMCC-GCE-CPU-AVX2-wasm-Debug-All-PathKit.json
@@ -220,7 +220,9 @@
       "pathkit"
     ],
     "env": {
-      "DOCKER_CONFIG": "/home/chrome-bot/.docker"
+      "CHROME_HEADLESS": "1",
+      "DOCKER_CONFIG": "/home/chrome-bot/.docker",
+      "PATH": "<PATH>:RECIPE_REPO[depot_tools]"
     },
     "name": "Test PathKit with Docker"
   },
diff --git a/infra/bots/recipes/test_pathkit.expected/pathkit_trybot.json b/infra/bots/recipes/test_pathkit.expected/pathkit_trybot.json
index 3da7417..4cc3c0e 100644
--- a/infra/bots/recipes/test_pathkit.expected/pathkit_trybot.json
+++ b/infra/bots/recipes/test_pathkit.expected/pathkit_trybot.json
@@ -224,7 +224,9 @@
       "7"
     ],
     "env": {
-      "DOCKER_CONFIG": "/home/chrome-bot/.docker"
+      "CHROME_HEADLESS": "1",
+      "DOCKER_CONFIG": "/home/chrome-bot/.docker",
+      "PATH": "<PATH>:RECIPE_REPO[depot_tools]"
     },
     "name": "Test PathKit with Docker"
   },
diff --git a/infra/bots/recipes/test_pathkit.py b/infra/bots/recipes/test_pathkit.py
index 3efb05f..a1cfb98 100644
--- a/infra/bots/recipes/test_pathkit.py
+++ b/infra/bots/recipes/test_pathkit.py
@@ -85,6 +85,7 @@
       docker_args=docker_args,
       copies=copies,
       recursive_read=recursive_read,
+      attempts=3,
   )
 
 
diff --git a/modules/canvaskit/karma.bench.conf.js b/modules/canvaskit/karma.bench.conf.js
index d4900b8..1179f72 100644
--- a/modules/canvaskit/karma.bench.conf.js
+++ b/modules/canvaskit/karma.bench.conf.js
@@ -61,12 +61,18 @@
     cfg.browsers = ['ChromeHeadlessNoSandbox'],
     cfg.customLaunchers = {
         ChromeHeadlessNoSandbox: {
-            base: 'ChromeHeadless',
-            flags: [
+          base: 'ChromeHeadless',
+          flags: [
             // Without this flag, we see an error:
             // Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
-                '--no-sandbox'
-            ],
+            '--no-sandbox',
+            // may help tests be less flaky
+            // https://peter.sh/experiments/chromium-command-line-switches/#browser-test
+            '--browser-test',
+            // This can also help avoid crashes/timeouts:
+            // https://github.com/GoogleChrome/puppeteer/issues/1834
+            '--disable-dev-shm-usage',
+          ],
         },
     };
   }
diff --git a/modules/canvaskit/karma.conf.js b/modules/canvaskit/karma.conf.js
index e815e04..dd05944 100644
--- a/modules/canvaskit/karma.conf.js
+++ b/modules/canvaskit/karma.conf.js
@@ -62,12 +62,18 @@
     cfg.browsers = ['ChromeHeadlessNoSandbox'],
     cfg.customLaunchers = {
         ChromeHeadlessNoSandbox: {
-            base: 'ChromeHeadless',
-            flags: [
+          base: 'ChromeHeadless',
+          flags: [
             // Without this flag, we see an error:
             // Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
-                '--no-sandbox'
-            ],
+            '--no-sandbox',
+            // may help tests be less flaky
+            // https://peter.sh/experiments/chromium-command-line-switches/#browser-test
+            '--browser-test',
+            // This can also help avoid crashes/timeouts:
+            // https://github.com/GoogleChrome/puppeteer/issues/1834
+            '--disable-dev-shm-usage',
+          ],
         },
     };
   }
diff --git a/modules/canvaskit/tests/util.js b/modules/canvaskit/tests/util.js
index 34ea63f..2183282 100644
--- a/modules/canvaskit/tests/util.js
+++ b/modules/canvaskit/tests/util.js
@@ -11,7 +11,7 @@
     pixels = new Uint8ClampedArray(pixels.buffer);
     const imageData = new ImageData(pixels, CANVAS_WIDTH, CANVAS_HEIGHT);
 
-    let reportingCanvas =  document.getElementById('report');
+    const reportingCanvas = document.getElementById('report');
     reportingCanvas.getContext('2d').putImageData(imageData, 0, 0);
     reportCanvas(reportingCanvas, testname).then(() => {
         done();
diff --git a/modules/pathkit/karma.bench.conf.js b/modules/pathkit/karma.bench.conf.js
index 315903b..73650d3 100644
--- a/modules/pathkit/karma.bench.conf.js
+++ b/modules/pathkit/karma.bench.conf.js
@@ -59,12 +59,18 @@
     cfg.browsers = ['ChromeHeadlessNoSandbox'],
     cfg.customLaunchers = {
         ChromeHeadlessNoSandbox: {
-            base: 'ChromeHeadless',
-            flags: [
+          base: 'ChromeHeadless',
+          flags: [
             // Without this flag, we see an error:
             // Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
-                '--no-sandbox'
-            ],
+            '--no-sandbox',
+            // may help tests be less flaky
+            // https://peter.sh/experiments/chromium-command-line-switches/#browser-test
+            '--browser-test',
+            // This can also help avoid crashes/timeouts:
+            // https://github.com/GoogleChrome/puppeteer/issues/1834
+            '--disable-dev-shm-usage',
+          ],
         },
     };
   }
diff --git a/modules/pathkit/karma.conf.js b/modules/pathkit/karma.conf.js
index 47ff2d2..04ef023 100644
--- a/modules/pathkit/karma.conf.js
+++ b/modules/pathkit/karma.conf.js
@@ -60,12 +60,18 @@
     cfg.browsers = ['ChromeHeadlessNoSandbox'],
     cfg.customLaunchers = {
         ChromeHeadlessNoSandbox: {
-            base: 'ChromeHeadless',
-            flags: [
+          base: 'ChromeHeadless',
+          flags: [
             // Without this flag, we see an error:
             // Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
-                '--no-sandbox'
-            ],
+            '--no-sandbox',
+            // may help tests be less flaky
+            // https://peter.sh/experiments/chromium-command-line-switches/#browser-test
+            '--browser-test',
+            // This can also help avoid crashes/timeouts:
+            // https://github.com/GoogleChrome/puppeteer/issues/1834
+            '--disable-dev-shm-usage',
+          ],
         },
     };
   }