Add --isolated-outdir flag to test executable API.

This adds an optional --isolated=outdir=PATH flag to the
test executable API; this gives the test runners a stable path
to the output directory from a swarming task, so that we can key
other files off of it without needing to pass them all explicitly
via the command line.

This also adds the arg to the isolated_script wrapper, so that we
those types of tests can handle the flag (by ignoring it for now).

We may need to work through the other cases (like gtest tests)
individually, which will be done in subsequent CLs.

Bug: 816629
Change-Id: Ibff6a47544bf94af5d7693a8446dfb669351cc07
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2358604
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Erik Staab <estaab@chromium.org>
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799378}
diff --git a/docs/testing/test_executable_api.md b/docs/testing/test_executable_api.md
index 703fcee1..7b314709 100644
--- a/docs/testing/test_executable_api.md
+++ b/docs/testing/test_executable_api.md
@@ -102,6 +102,13 @@
 The executable must support the following command line arguments (aka flags):
 
 ```
+--isolated-outdir=[PATH]
+```
+
+This argument is required, and should be set to the directory created
+by the swarming task for the task to write outputs into.
+
+```
 --isolated-script-test-output=[FILENAME]
 ```
 
diff --git a/testing/scripts/common.py b/testing/scripts/common.py
index d092dbe1..ea67b5c 100644
--- a/testing/scripts/common.py
+++ b/testing/scripts/common.py
@@ -209,8 +209,13 @@
     self._options = None
     self._rest_args = None
     self._parser.add_argument(
+        '--isolated-outdir', type=str,
+        required=False, # TODO(crbug.com/816629): Make this be required.
+        help='value of $ISOLATED_OUTDIR from swarming task')
+    self._parser.add_argument(
         '--isolated-script-test-output', type=str,
-        required=True)
+        required=True,
+        help='path to write test results JSON object to')
     self._parser.add_argument(
         '--isolated-script-test-filter', type=str,
         required=False)