test_that: handle provision failure prior to any jobs correctly

BUG=chromium:653002
TEST=None

Change-Id: I9515cce6fe6c9895f2607a65324a1718695fca3f
Reviewed-on: https://chromium-review.googlesource.com/393270
Commit-Ready: Aviv Keshet <[email protected]>
Tested-by: Aviv Keshet <[email protected]>
Reviewed-by: Simran Basi <[email protected]>
diff --git a/site_utils/test_runner_utils.py b/site_utils/test_runner_utils.py
index 69ced58..56e71e2 100755
--- a/site_utils/test_runner_utils.py
+++ b/site_utils/test_runner_utils.py
@@ -472,7 +472,8 @@
     @param iterations: int number of times to schedule tests.
     @param host_attributes: Dict of host attributes to pass into autoserv.
 
-    @returns: A list of return codes each job that has run.
+    @returns: A list of return codes each job that has run. Or [1] if
+              provision failed prior to running any jobs.
     """
     # Create host in afe, add board and build labels.
     cros_version_label = provision.cros_version_to_label(build)
@@ -495,7 +496,7 @@
             logging.error('Provisioning %s to %s failed, tests are aborted, '
                           'failure reason: %s',
                           remote, cros_version_label, e)
-            return
+            return [1]
 
     # Create suites that will be scheduled.
     suites_and_descriptions = []
@@ -524,7 +525,7 @@
 
     if not afe.get_jobs():
         logging.info('No jobs scheduled. End of local run.')
-        return
+        return []
 
     last_job_id = afe.get_jobs()[-1].id
     job_id_digits = len(str(last_job_id))