diff options
author | Dmitry Lomov <dslomov@google.com> | 2016-06-21 12:04:34 +0000 |
---|---|---|
committer | Philipp Wollermann <philwo@google.com> | 2016-06-21 12:24:19 +0000 |
commit | a148b4c25a7e343eac6a9a972f482711f8bef944 (patch) | |
tree | da63f4fb5871d974096a2f37d432af393c2a45ba /tools | |
parent | 83131623f73bde31ba51f4ceda7fa601a5b122c3 (diff) |
Disable runfiles on Windows.
This adds a new configuration option that allows disabling the creation of symlink forest for runfiles.
On Windows, symlink forest is disabled by default; only the runfiles manifest is created.
For shell tests, a function 'rlocation' is provided that converts from runfiles location to a real location.
Work towards #1212.
--
MOS_MIGRATED_REVID=125439553
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/test/test-setup.sh | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/tools/test/test-setup.sh b/tools/test/test-setup.sh index 6fa814aeda..150b9faaa3 100755 --- a/tools/test/test-setup.sh +++ b/tools/test/test-setup.sh @@ -28,12 +28,36 @@ fi export GTEST_TMP_DIR="${TEST_TMPDIR}" DIR="$TEST_SRCDIR" +RUNFILES_MANIFEST_FILE=$DIR/MANIFEST + +if [ -z "$RUNFILES_MANIFEST_ONLY" ]; then + function rlocation() { + if [[ "$1" = /* ]]; then + echo $1 + else + echo "$(dirname $RUNFILES_MANIFEST_FILE)/$1" + fi + } +else + function rlocation() { + if [[ "$1" = /* ]]; then + echo $1 + else + echo $(grep "^$1 " $MANIFEST_FILE | awk '{ print $2 }') + fi + } +fi + +export -f rlocation +export RUNFILES_MANIFEST_FILE if [ ! -z "$TEST_WORKSPACE" ] then DIR="$DIR"/"$TEST_WORKSPACE" fi + + # 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. @@ -48,8 +72,18 @@ echo "-------------------------------------------------------------------------- # If the test is at the top of the tree, we have to add '.' to $PATH, PATH=".:$PATH" + +TEST_NAME=$1 +shift + +if [[ "$TEST_NAME" = /* ]]; then + EXE="${TEST_NAME}" +else + EXE="$(rlocation $TEST_WORKSPACE/$TEST_NAME)" +fi + exitCode=0 -"$@" || exitCode=$? +"${EXE}" "$@" || exitCode=$? if [ -n "${XML_OUTPUT_FILE-}" -a ! -f "${XML_OUTPUT_FILE-}" ]; then # Create a default XML output file if the test runner hasn't generated it @@ -63,8 +97,8 @@ if [ -n "${XML_OUTPUT_FILE-}" -a ! -f "${XML_OUTPUT_FILE-}" ]; then cat <<EOF >${XML_OUTPUT_FILE} <?xml version="1.0" encoding="UTF-8"?> <testsuites> - <testsuite name="$1" tests="1" failures="0" errors="$errors"> - <testcase name="$1" status="run">$error_msg</testcase> + <testsuite name="$TEST_NAME" tests="1" failures="0" errors="$errors"> + <testcase name="$TEST_NAME" status="run">$error_msg</testcase> </testsuite> </testsuites> EOF |