--skip FOO Do not test the FOO component.
--only FOO Do not test anything except the FOO component.
+--temp DIR Install components and dependencies under DIR instead of
+ making a new temporary directory. Implies --leave-temp.
--leave-temp Do not remove GOPATH, virtualenv, and other temp dirs at exit.
- Instead, show which directories were used this time so they
- can be reused in subsequent invocations.
+ Instead, show the path to give as --temp to reuse them in
+ subsequent invocations.
--skip-install Do not run any install steps. Just run tests.
You should provide GOPATH, GEMHOME, and VENVDIR options
from a previous invocation if you use this option.
COLUMNS=80
-leave_temp=
skip_install=
+temp=
+temp_preserve=
-declare -A leave_temp
clear_temp() {
- leaving=""
- for var in VENVDIR VENV3DIR GOPATH GITDIR GEMHOME PERLINSTALLBASE
- do
- if [[ -z "${leave_temp[$var]}" ]]
- then
- if [[ -n "${!var}" ]]
- then
- rm -rf "${!var}"
- fi
- else
- leaving+=" $var=\"${!var}\""
- fi
- done
- if [[ -n "$leaving" ]]; then
- echo "Leaving behind temp dirs: $leaving"
+ if [[ -z "$temp" ]]; then
+ # we didn't even get as far as making a temp dir
+ :
+ elif [[ -z "$temp_preserve" ]]; then
+ rm -rf "$temp"
+ else
+ echo "Leaving behind temp dirs in $temp"
fi
}
skip_install=1
only_install="$1"; shift
;;
+ --temp)
+ temp="$1"; shift
+ temp_preserve=1
+ ;;
--leave-temp)
- leave_temp[VENVDIR]=1
- leave_temp[VENV3DIR]=1
- leave_temp[GOPATH]=1
- leave_temp[GEMHOME]=1
- leave_temp[PERLINSTALLBASE]=1
+ temp_preserve=1
;;
--retry)
retry=1
cd "$WORKSPACE"
find -name '*.pyc' -delete
+if [[ -z "$temp" ]]; then
+ temp="$(mktemp -d)"
+fi
+
# Set up temporary install dirs (unless existing dirs were supplied)
for tmpdir in VENVDIR VENV3DIR GOPATH GEMHOME PERLINSTALLBASE
do
if [[ -n "${!tmpdir}" ]]; then
- leave_temp[$tmpdir]=1
+ # Support old user-named temp dirs (but --temp {base} would
+ # be more convenient)
mkdir -p "${!tmpdir}"
else
- eval "$tmpdir"='$(mktemp -d)'
+ eval "$tmpdir"="$temp/$tmpdir"
fi
done