Bug 1279020 - Symlink mach binary to $HOME/bin after mozharness setup on interactive workers, r=armenzg
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Thu, 09 Jun 2016 17:20:19 -0400
changeset 303753 eb129a2466a9c3beae231ecb9f5f16be16382624
parent 303752 80eb5947da076120f095ac7dd6a32670032e0134
child 303754 6c52fa3a1a9c48c4b1551abce860114450bd28f8
push id30401
push usercbook@mozilla.com
push dateWed, 06 Jul 2016 09:40:34 +0000
treeherdermozilla-central@a7d6bb9e7d12 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarmenzg
bugs1279020
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1279020 - Symlink mach binary to $HOME/bin after mozharness setup on interactive workers, r=armenzg When running an interactive worker (aka one-click loaner), developers have the option of setting up the mozharness environment without running tests. When they do this, we should automatically symlink the mach binary found in the tests.zip to their path. This way developers don't need to go searching for $HOME/workspace/build/tests/mach to run their tests. MozReview-Commit-ID: 1JKPYSsYKlN
taskcluster/scripts/tester/run-wizard
taskcluster/scripts/tester/test-linux.sh
--- a/taskcluster/scripts/tester/run-wizard
+++ b/taskcluster/scripts/tester/run-wizard
@@ -16,22 +16,48 @@ def call(cmd, **kwargs):
     return subprocess.call(cmd, **kwargs)
 
 
 def resume():
     call(['run-mozharness'])
 
 
 def setup():
-    call(['run-mozharness', '--no-run-tests'])
-    print("Mozharness has finished downloading the build and "
-          "tests to {}.".format(os.path.join(os.getcwd(), 'build')))
+    """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.
+    """
+    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')
+    mach_dest = os.path.expanduser(os.path.join('~', 'bin', 'mach'))
+
+    if os.path.exists(mach_dest):
+        os.remove(mach_dest)
+    os.symlink(mach_src, mach_dest)
+
+    print("""
+Mozharness has finished downloading the build and tests to:
+{}
+
+A limited mach environment has also been set up and added to the $PATH, but
+it may be missing the command you need. To see a list of commands, run:
+    $ mach help
+""".lstrip().format(build_dir))
 
 
 def clone():
+    """Clone the correct gecko repository and update to the proper revision."""
     repo = os.environ['GECKO_HEAD_REPOSITORY']
     rev = os.environ['GECKO_HEAD_REV']
     clone_path = os.path.expanduser(os.path.join('~', 'gecko'))
 
     # try is too large to clone, instead clone central and pull
     # in changes from try
     if "hg.mozilla.org/try" in repo:
         central = 'http://hg.mozilla.org/mozilla-central'
@@ -48,18 +74,18 @@ def exit():
 
 
 OPTIONS = [
     ('Resume task', resume,
      "Resume the original task without modification. This can be useful for "
      "passively monitoring it from another shell."),
     ('Setup task', setup,
      "Setup the task (download the application and tests) but don't run the "
-     "tests just yet. The tests can be run with a custom configuration later "
-     "(experimental)."),
+     "tests just yet. The tests can be run with a custom configuration later. "
+     "This will provide a mach environment (experimental)."),
     ('Clone gecko', clone,
      "Perform a clone of gecko using the task's repo and update it to the "
      "task's revision."),
     ('Exit', exit, "Exit this wizard and return to the shell.")
 ]
 
 
 def _fmt_options():
--- a/taskcluster/scripts/tester/test-linux.sh
+++ b/taskcluster/scripts/tester/test-linux.sh
@@ -132,16 +132,19 @@ for cfg in $MOZHARNESS_CONFIG; do
   config_cmds="${config_cmds} --config-file $WORKSPACE/${cfg}"
 done
 
 mozharness_bin="/home/worker/bin/run-mozharness"
 
 # Save the computed mozharness command to a binary which is useful
 # for interactive mode.
 echo -e "#!/usr/bin/env bash
+# Some mozharness scripts assume base_work_dir is in
+# the current working directory, see bug 1279237
+cd $WORKSPACE
 cmd=\"python2.7 $WORKSPACE/${MOZHARNESS_SCRIPT} ${config_cmds} ${@} \${@}\"
 echo \"Running: \${cmd}\"
 exec \${cmd}" > ${mozharness_bin}
 chmod +x ${mozharness_bin}
 
 # In interactive mode, the user will be prompted with options for what to do.
 if [ "$TASKCLUSTER_INTERACTIVE" != "true" ]; then
   # run the given mozharness script and configs, but pass the rest of the