aboutsummaryrefslogtreecommitdiffhomepage
path: root/base_workspace/tools/test/test-setup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'base_workspace/tools/test/test-setup.sh')
-rwxr-xr-xbase_workspace/tools/test/test-setup.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/base_workspace/tools/test/test-setup.sh b/base_workspace/tools/test/test-setup.sh
new file mode 100755
index 0000000000..35bb6c6284
--- /dev/null
+++ b/base_workspace/tools/test/test-setup.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# shift stderr to stdout.
+exec 2>&1
+
+# Executing the test log will page it.
+echo 'exec ${PAGER:-/usr/bin/less} "$0" || exit 1'
+
+DIR="$TEST_SRCDIR"
+
+# normal commands are run in the exec-root where they have access to
+# the entire source tree. By chdir'ing to the runfiles root, tests only
+# have direct access to their declared dependencies.
+cd "$DIR" || { echo "Could not chdir $DIR"; exit 1; }
+
+"$@"