Bug 1285550 - Ensure 'run-mozharness' binary exists before invoking from interactive wizard, r?armenzg draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Fri, 08 Jul 2016 10:28:07 -0400
changeset 385555 f804a8054da52c18ffbd350e06249984e2b53b93
parent 385455 45682df2d2d45e5a8385fd842579e661a4b60bc5
child 385556 c3ec973ee848558770cad1f3c6823b4f44f76c9e
child 386339 9c8996e51b885bb07dfb6da1a3fdc3577f5c12f4
push id22530
push userahalberstadt@mozilla.com
push dateFri, 08 Jul 2016 16:13:31 +0000
reviewersarmenzg
bugs1285550
milestone50.0a1
Bug 1285550 - Ensure 'run-mozharness' binary exists before invoking from interactive wizard, r?armenzg This fixes a race condition between the 'test-linux.sh' process and the 'taskcluster-interactive-shell' process in interactive tasks. MozReview-Commit-ID: GhqKpq5pAtj
taskcluster/scripts/tester/run-wizard
--- a/taskcluster/scripts/tester/run-wizard
+++ b/taskcluster/scripts/tester/run-wizard
@@ -1,37 +1,54 @@
 #!/usr/bin/env python
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this,
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import print_function, unicode_literals
 
+import datetime
 import os
 import subprocess
 import sys
+import time
 from textwrap import wrap
 
+here = os.path.dirname(os.path.abspath(__file__))
+
 
 def call(cmd, **kwargs):
     print(" ".join(cmd))
     return subprocess.call(cmd, **kwargs)
 
 
+def wait_for_run_mozharness(timeout=20):
+    starttime = datetime.datetime.now()
+    while datetime.datetime.now() - starttime < datetime.timedelta(seconds=timeout):
+        if os.path.isfile(os.path.join(here, 'run-mozharness')):
+            break
+        time.sleep(0.2)
+    else:
+        print("Timed out after %d seconds waiting for the 'run-mozharness' binary" % timeout)
+        return 1
+
+
 def resume():
+    wait_for_run_mozharness()
     call(['run-mozharness'])
 
 
 def setup():
     """Run the mozharness script without the 'run-tests' action.
 
     This will do all the necessary setup steps like creating a virtualenv and
     downloading the tests and firefox binary. But it stops before running the
     tests.
     """
+    wait_for_run_mozharness()
     status = call(['run-mozharness', '--no-run-tests'])
 
     if status:
         # something went wrong
         return status
 
     build_dir = os.path.expanduser(os.path.join('~', 'workspace', 'build'))
     mach_src = os.path.join(build_dir, 'tests', 'mach')