Add Correctness tests for Chromecast

Bug: skia:
NOTRY=true
Change-Id: Ib604bad8eda6ba4382b850f7c5f318fb0f114401
Reviewed-on: https://skia-review.googlesource.com/20051
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
diff --git a/infra/bots/recipes/test.py b/infra/bots/recipes/test.py
index ad0334c..012b4c2 100644
--- a/infra/bots/recipes/test.py
+++ b/infra/bots/recipes/test.py
@@ -59,6 +59,9 @@
   if '-x86-' in bot and not 'NexusPlayer' in bot:
     args.extend(['--threads', '4'])
 
+  if 'Chromecast' in bot:
+    args.extend(['--threads', '0'])
+
   # Avoid issues with dynamically exceeding resource cache limits.
   if 'Test' in bot and 'DISCARDABLE' in bot:
     args.extend(['--threads', '0'])
@@ -213,6 +216,9 @@
       # Just run GLES for now - maybe add gles_msaa4 in the future
       configs = ['gles']
 
+    if 'Chromecast' in bot:
+      configs = ['gles', '8888']
+
     # Test coverage counting path renderer.
     if 'CCPR' in bot:
       configs = [c for c in configs if c == 'gl' or c == 'gles']
@@ -312,7 +318,7 @@
     blacklist('_ image gen_platf rle8-height-negative.bmp')
     blacklist('_ image gen_platf rle4-height-negative.bmp')
 
-  if 'Android' in bot or 'iOS' in bot:
+  if 'Android' in bot or 'iOS' in bot or 'Chromecast' in bot:
     # This test crashes the N9 (perhaps because of large malloc/frees). It also
     # is fairly slow and not platform-specific. So we just disable it on all of
     # Android and iOS. skia:5438
@@ -370,7 +376,7 @@
     for test in ['bleed_alpha_image', 'bleed_alpha_image_shader']:
       blacklist(['serialize-8888', 'gm', '_', test])
   # It looks like we skip these only for out-of-memory concerns.
-  if 'Win' in bot or 'Android' in bot:
+  if 'Win' in bot or 'Android' in bot or 'Chromecast' in bot:
     for test in ['verylargebitmap', 'verylarge_picture_image']:
       blacklist(['serialize-8888', 'gm', '_', test])
   if 'Mac' in bot and 'CPU' in bot and 'Release' in bot:
@@ -473,6 +479,12 @@
   if 'AndroidOne' in bot:  # skia:4711
     match.append('~WritePixels')
 
+  if 'Chromecast' in bot: # skia:6581
+    match.append('~matrixconvolution')
+    match.append('~blur_image_filter')
+    match.append('~blur_0.01')
+    match.append('~GM_animated-image-blurs')
+
   if 'NexusPlayer' in bot:
     match.append('~ResourceCache')
 
@@ -763,6 +775,17 @@
   if api.vars.upload_dm_results:
     args.extend(['--writePath', api.flavor.device_dirs.dm_dir])
 
+  if 'Chromecast' in api.vars.builder_cfg.get('os', ''):
+    # Due to limited disk space, we only deal with skps and one image.
+    args = [
+      'dm',
+      '--undefok',   # This helps branches that may not know new flags.
+      '--resourcePath', api.flavor.device_dirs.resource_dir,
+      '--skps', api.flavor.device_dirs.skp_dir,
+      '--images', api.flavor.device_path_join(
+          api.flavor.device_dirs.resource_dir, 'color_wheel.jpg'),
+    ]
+
   args.extend(dm_flags(api, api.vars.builder_name))
 
   env = {}
@@ -815,7 +838,10 @@
     env['IOS_MOUNT_POINT'] = api.vars.slave_dir.join('mnt_iosdevice')
   with api.context(env=env):
     try:
-      api.flavor.install_everything()
+      if 'Chromecast' in api.vars.builder_name:
+        api.flavor.install(resources=True, skps=True)
+      else:
+        api.flavor.install_everything()
       test_steps(api)
     finally:
       api.flavor.cleanup_steps()
@@ -840,6 +866,7 @@
   'Test-Android-Clang-PixelC-CPU-TegraX1-arm64-Debug-Android',
   'Test-ChromeOS-Clang-Chromebook_C100p-GPU-MaliT764-arm-Debug',
   'Test-ChromeOS-Clang-Chromebook_CB5_312T-GPU-PowerVRGX6250-arm-Debug',
+  'Test-Chromecast-GCC-Chorizo-GPU-Cortex_A7-arm-Release',
   'Test-Mac-Clang-MacMini7.1-CPU-AVX-x86_64-Release',
   'Test-Mac-Clang-MacMini7.1-GPU-IntelIris5100-x86_64-Debug-CommandBuffer',
   'Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-ASAN',
@@ -901,6 +928,11 @@
     if 'Win' in builder:
       test += api.platform('win', 64)
 
+    if 'Chromecast' in builder:
+      test += api.step_data(
+          'read chromecast ip',
+          stdout=api.raw_io.output('192.168.1.2:5555'))
+
     if 'ChromeOS' in builder:
       test += api.step_data(
           'read chromeos ip',