Bug 1279020 - Symlink mach binary to $HOME/bin after mozharness setup on interactive workers, r?armenzg draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Thu, 09 Jun 2016 17:20:19 -0400
changeset 381551 2de696f9f3711f67457f31c2a0d4006cab5dde54
parent 381550 d92db5303df0b28a87b543cdb9f31846139a3409
child 523989 127460cc6444773860c9d6207e59ade17a13aee8
push id21508
push userahalberstadt@mozilla.com
push dateMon, 27 Jun 2016 18:40:30 +0000
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
--- a/taskcluster/scripts/tester/run-wizard
+++ b/taskcluster/scripts/tester/run-wizard
@@ -16,19 +16,37 @@ def call(cmd, **kwargs):
     return subprocess.call(cmd, **kwargs)
 def resume():
 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')))
+    status = call(['run-mozharness', '--no-run-tests'])
+    if status:
+        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
 def clone():
     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
@@ -48,18 +66,18 @@ def exit():
     ('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}"
 # 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
 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