Fix tests by explicitly passing TEST_TMPDIR to mk*temp. We need to tell mktemp to explicitly create temporary files and directories under TEST_TMPDIR. The default of picking up the TMPDIR value (which may be unset) or /tmp may not work and was causing two tests to fail. I suspect that paths outside of TEST_TMPDIR may not be writable due to our sandboxing features. -- MOS_MIGRATED_REVID=131957733
diff --git a/scripts/bash_completion_test.sh b/scripts/bash_completion_test.sh index 82a0fa3..1f261bc 100755 --- a/scripts/bash_completion_test.sh +++ b/scripts/bash_completion_test.sh
@@ -99,7 +99,7 @@ # in STDERR receiving a string containing regex unexpected-error. assert_expansion_error_not_contains() { local prefix=$1 not_expected=$2 flags=${3:-} - local temp_file=$(mktemp -t tmp.stderr.XXXXXX) + local temp_file="$(mktemp "${TEST_TMPDIR}/tmp.stderr.XXXXXX")" for i in ${COMMAND_ALIASES[@]}; do local nprefix="$i " expand "$nprefix\t" "$flags" "$temp_file" > /dev/null
diff --git a/src/test/shell/bazel/bazel_rules_test.sh b/src/test/shell/bazel/bazel_rules_test.sh index cd51087..b34a26b 100755 --- a/src/test/shell/bazel/bazel_rules_test.sh +++ b/src/test/shell/bazel/bazel_rules_test.sh
@@ -231,8 +231,7 @@ EOF local old_path="${PATH}" local old_tmpdir="${TMPDIR-}" - local effective_tmpdir="${TMPDIR:-/tmp}" - local new_tmpdir=$(mktemp -d "${effective_tmpdir}/newfancytmpdirXXXXXX") + local new_tmpdir="$(mktemp -d "${TEST_TMPDIR}/newfancytmpdirXXXXXX")" [ -d "${new_tmpdir}" ] || \ fail "Could not create new temporary directory ${new_tmpdir}" export PATH="/bin:/usr/bin:/random/path"