[recipes] Fix *_VERSION step failure handling
authorEric Boren <borenet@google.com>
Mon, 24 Apr 2017 19:59:55 +0000 (15:59 -0400)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Mon, 24 Apr 2017 21:20:04 +0000 (21:20 +0000)
Bug: skia:6473
Change-Id: I2fa6f800f59f40f74b5c080c52cdec3a32329ef7
NOTRY=true
Reviewed-on: https://skia-review.googlesource.com/14240
Commit-Queue: Stephan Altmueller <stephana@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Stephan Altmueller <stephana@google.com>
infra/bots/recipe_modules/flavor/api.py
infra/bots/recipe_modules/flavor/example.expected/Perf-ChromeOS-Clang-Chromebook_513C24_K01-GPU-MaliT860-arm-Release.json
infra/bots/recipe_modules/flavor/example.expected/failed_read_version.json
infra/bots/recipe_modules/flavor/gn_android_flavor.py
infra/bots/recipe_modules/flavor/gn_chromebook_flavor.py
infra/bots/recipe_modules/flavor/ios_flavor.py
infra/bots/recipes/perf.expected/Perf-ChromeOS-Clang-Chromebook_C100p-GPU-MaliT764-arm-Release.json
infra/bots/recipes/test.expected/Test-ChromeOS-Clang-Chromebook_C100p-GPU-MaliT764-arm-Debug.json

index 7a1ae2548cf0237ee7dab135ee64c7e6149f3f29..a2ac1f1eb0f05b59d0ceffc32806b33fc6d55bd2 100644 (file)
@@ -108,8 +108,8 @@ class SkiaFlavorApi(recipe_api.RecipeApi):
   def create_clean_device_dir(self, path):
     return self._f.create_clean_device_dir(path)
 
-  def read_file_on_device(self, path):
-    return self._f.read_file_on_device(path)
+  def read_file_on_device(self, path, **kwargs):
+    return self._f.read_file_on_device(path, **kwargs)
 
   def remove_file_on_device(self, path):
     return self._f.remove_file_on_device(path)
@@ -145,9 +145,10 @@ class SkiaFlavorApi(recipe_api.RecipeApi):
     device_version_file = self.device_path_join(
         self.device_dirs.tmp_dir, version_file)
     if str(actual_version_file) != str(device_version_file):
-      try:
-        device_version = self.read_file_on_device(device_version_file)
-      except self.m.step.StepFailure:
+      device_version = self.read_file_on_device(device_version_file,
+                                                abort_on_failure=False,
+                                                fail_build_on_failure=False)
+      if not device_version:
         device_version = VERSION_NONE
       if device_version != host_version:
         self.remove_file_on_device(device_version_file)
index 20bbe0be067b26b12a1f8425250a070faa5c15ad..30493caf42499decf55bccc02b3f4157271e3d37 100644 (file)
     "infra_step": true,
     "name": "write SKP_VERSION"
   },
-  {
-    "cmd": [
-      "ssh",
-      "-oConnectTimeout=15",
-      "-oBatchMode=yes",
-      "-t",
-      "-t",
-      "foo@127.0.0.1",
-      "touch",
-      "/home/chronos/user/SKP_VERSION"
-    ],
-    "env": {
-      "BUILDTYPE": "Release",
-      "CHROME_HEADLESS": "1",
-      "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]",
-      "SKIA_OUT": "[START_DIR]/out"
-    },
-    "infra_step": true,
-    "name": "touch /home/chronos/user/SKP_VERSION"
-  },
   {
     "cmd": [
       "ssh",
     "infra_step": true,
     "name": "write SK_IMAGE_VERSION"
   },
-  {
-    "cmd": [
-      "ssh",
-      "-oConnectTimeout=15",
-      "-oBatchMode=yes",
-      "-t",
-      "-t",
-      "foo@127.0.0.1",
-      "touch",
-      "/home/chronos/user/SK_IMAGE_VERSION"
-    ],
-    "env": {
-      "BUILDTYPE": "Release",
-      "CHROME_HEADLESS": "1",
-      "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]",
-      "SKIA_OUT": "[START_DIR]/out"
-    },
-    "infra_step": true,
-    "name": "touch /home/chronos/user/SK_IMAGE_VERSION"
-  },
   {
     "cmd": [
       "ssh",
     "infra_step": true,
     "name": "write SVG_VERSION"
   },
-  {
-    "cmd": [
-      "ssh",
-      "-oConnectTimeout=15",
-      "-oBatchMode=yes",
-      "-t",
-      "-t",
-      "foo@127.0.0.1",
-      "touch",
-      "/home/chronos/user/SVG_VERSION"
-    ],
-    "env": {
-      "BUILDTYPE": "Release",
-      "CHROME_HEADLESS": "1",
-      "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]",
-      "SKIA_OUT": "[START_DIR]/out"
-    },
-    "infra_step": true,
-    "name": "touch /home/chronos/user/SVG_VERSION"
-  },
   {
     "cmd": [
       "ssh",
index 1a6925edf990c6b9d75e2cbde554efd5fd6e26b7..bf289bddd912564aeadde6cfccf89a568e8bfd59 100644 (file)
       "@@@STEP_LOG_END@python.inline@@@"
     ]
   },
-  {
-    "cmd": [
-      "adb",
-      "shell",
-      "reboot",
-      "-p"
-    ],
-    "cwd": "[START_DIR]/skia",
-    "env": {
-      "BUILDTYPE": "Debug",
-      "CHROME_HEADLESS": "1",
-      "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]",
-      "SKIA_OUT": "[START_DIR]/out"
-    },
-    "infra_step": true,
-    "name": "shut down device to quarantine bot"
-  },
   {
     "cmd": [
       "adb",
   },
   {
     "name": "$result",
-    "reason": "Failed build steps: read /sdcard/revenge_of_the_skiabot/SK_IMAGE_VERSION",
     "recipe_result": null,
-    "status_code": 1
+    "status_code": 0
   }
 ]
\ No newline at end of file
index dce8c601ba53382b7f3c8e9352a83b5bb13c63c8..318915afc8292d07c046c9f084952025268bbaa8 100644 (file)
@@ -218,9 +218,11 @@ class GNAndroidFlavorUtils(default_flavor.DefaultFlavorUtils):
   def copy_directory_contents_to_host(self, device, host):
     self._adb('pull %s %s' % (device, host), 'pull', device, host)
 
-  def read_file_on_device(self, path):
-    return self._adb('read %s' % path,
-                     'shell', 'cat', path, stdout=self.m.raw_io.output()).stdout
+  def read_file_on_device(self, path, **kwargs):
+    rv = self._adb('read %s' % path,
+                   'shell', 'cat', path, stdout=self.m.raw_io.output(),
+                   **kwargs)
+    return rv.stdout.rstrip() if rv and rv.stdout else None
 
   def remove_file_on_device(self, path):
     self._adb('rm %s' % path, 'shell', 'rm', '-f', path)
index 34ffa541975fc4b41071f4db990a1cc5d9c96aa0..c004d9971e4ee4e9eb6726d0c97bb926022b28c9 100644 (file)
@@ -151,11 +151,11 @@ class GNChromebookFlavorUtils(gn_flavor.GNFlavorUtils):
     self._ssh('rm %s' % path, 'rm', '-rf', path)
     self._ssh('mkdir %s' % path, 'mkdir', '-p', path)
 
-  def read_file_on_device(self, path):
-    # To avoid failure if file doesn't exist.
-    self._ssh('touch %s' % path, 'touch', path)
-    return self._ssh('read %s' % path,
-                     'cat', path, stdout=self.m.raw_io.output()).stdout
+  def read_file_on_device(self, path, **kwargs):
+    rv = self._ssh('read %s' % path,
+                   'cat', path, stdout=self.m.raw_io.output(),
+                   **kwargs)
+    return rv.stdout.rstrip() if rv and rv.stdout else None
 
   def remove_file_on_device(self, path):
     # use -f to silently return if path doesn't exist
index 45b33448a14cf018dd5c6c39b0536de87b8acc2b..976e840f9356d19a292ecfd7d22527eb2db50e34 100644 (file)
@@ -65,11 +65,12 @@ class iOSFlavorUtils(gn_flavor.GNFlavorUtils):
     self._run_ios_script('rm',    path)
     self._run_ios_script('mkdir', path)
 
-  def read_file_on_device(self, path):
+  def read_file_on_device(self, path, **kwargs):
     full = self.m.vars.skia_dir.join('platform_tools/ios/bin/ios_cat_file')
-    rc = self.m.run(self.m.step,
+    rv = self.m.run(self.m.step,
                     name = 'cat_file %s' % path,
                     cmd = [full, path],
                     stdout=self.m.raw_io.output(),
-                    infra_step=kInfraStep)
-    return rc.stdout.rstrip() if rc.stdout else rc.stdout
+                    infra_step=kInfraStep,
+                    **kwargs)
+    return rv.stdout.rstrip() if rv and rv.stdout else None
index 272d36746da2ad3daf0bf6ab321ff711107108d5..25c79633d207295da0c160151664e4e1c984c01a 100644 (file)
     "infra_step": true,
     "name": "write SKP_VERSION"
   },
-  {
-    "cmd": [
-      "ssh",
-      "-oConnectTimeout=15",
-      "-oBatchMode=yes",
-      "-t",
-      "-t",
-      "foo@127.0.0.1",
-      "touch",
-      "/home/chronos/user/SKP_VERSION"
-    ],
-    "env": {
-      "BUILDTYPE": "Release",
-      "CHROME_HEADLESS": "1",
-      "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]",
-      "SKIA_OUT": "[START_DIR]/out"
-    },
-    "infra_step": true,
-    "name": "touch /home/chronos/user/SKP_VERSION"
-  },
   {
     "cmd": [
       "ssh",
     "infra_step": true,
     "name": "write SK_IMAGE_VERSION"
   },
-  {
-    "cmd": [
-      "ssh",
-      "-oConnectTimeout=15",
-      "-oBatchMode=yes",
-      "-t",
-      "-t",
-      "foo@127.0.0.1",
-      "touch",
-      "/home/chronos/user/SK_IMAGE_VERSION"
-    ],
-    "env": {
-      "BUILDTYPE": "Release",
-      "CHROME_HEADLESS": "1",
-      "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]",
-      "SKIA_OUT": "[START_DIR]/out"
-    },
-    "infra_step": true,
-    "name": "touch /home/chronos/user/SK_IMAGE_VERSION"
-  },
   {
     "cmd": [
       "ssh",
     "infra_step": true,
     "name": "write SVG_VERSION"
   },
-  {
-    "cmd": [
-      "ssh",
-      "-oConnectTimeout=15",
-      "-oBatchMode=yes",
-      "-t",
-      "-t",
-      "foo@127.0.0.1",
-      "touch",
-      "/home/chronos/user/SVG_VERSION"
-    ],
-    "env": {
-      "BUILDTYPE": "Release",
-      "CHROME_HEADLESS": "1",
-      "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]",
-      "SKIA_OUT": "[START_DIR]/out"
-    },
-    "infra_step": true,
-    "name": "touch /home/chronos/user/SVG_VERSION"
-  },
   {
     "cmd": [
       "ssh",
index b66f798bda1d3330520ff13abd26e6c734918b50..a578346fd20f584e970c87bcb172ad58c0585eac 100644 (file)
     "infra_step": true,
     "name": "write SKP_VERSION"
   },
-  {
-    "cmd": [
-      "ssh",
-      "-oConnectTimeout=15",
-      "-oBatchMode=yes",
-      "-t",
-      "-t",
-      "foo@127.0.0.1",
-      "touch",
-      "/home/chronos/user/SKP_VERSION"
-    ],
-    "env": {
-      "BUILDTYPE": "Debug",
-      "CHROME_HEADLESS": "1",
-      "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]",
-      "SKIA_OUT": "[START_DIR]/out"
-    },
-    "infra_step": true,
-    "name": "touch /home/chronos/user/SKP_VERSION"
-  },
   {
     "cmd": [
       "ssh",
     "infra_step": true,
     "name": "write SK_IMAGE_VERSION"
   },
-  {
-    "cmd": [
-      "ssh",
-      "-oConnectTimeout=15",
-      "-oBatchMode=yes",
-      "-t",
-      "-t",
-      "foo@127.0.0.1",
-      "touch",
-      "/home/chronos/user/SK_IMAGE_VERSION"
-    ],
-    "env": {
-      "BUILDTYPE": "Debug",
-      "CHROME_HEADLESS": "1",
-      "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]",
-      "SKIA_OUT": "[START_DIR]/out"
-    },
-    "infra_step": true,
-    "name": "touch /home/chronos/user/SK_IMAGE_VERSION"
-  },
   {
     "cmd": [
       "ssh",
     "infra_step": true,
     "name": "write SVG_VERSION"
   },
-  {
-    "cmd": [
-      "ssh",
-      "-oConnectTimeout=15",
-      "-oBatchMode=yes",
-      "-t",
-      "-t",
-      "foo@127.0.0.1",
-      "touch",
-      "/home/chronos/user/SVG_VERSION"
-    ],
-    "env": {
-      "BUILDTYPE": "Debug",
-      "CHROME_HEADLESS": "1",
-      "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]",
-      "SKIA_OUT": "[START_DIR]/out"
-    },
-    "infra_step": true,
-    "name": "touch /home/chronos/user/SVG_VERSION"
-  },
   {
     "cmd": [
       "ssh",