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
--- 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')