test-lib: handle TEST_OUTPUT_DIRECTORY with spaces

We are careful in test_done to handle a results directory
with a space in it, but the "--tee" code path does not.
Doing:

  export TEST_OUTPUT_DIRECTORY='/tmp/path with spaces'
  ./t000-init.sh --tee

results in errors. Let's consistently double-quote our path
variables so that this works.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King 2016-10-21 06:42:10 -04:00 коммит произвёл Junio C Hamano
Родитель 0b65a8dbdb
Коммит 925bdc928e
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -58,8 +58,8 @@ done,*)
mkdir -p "$TEST_OUTPUT_DIRECTORY/test-results" mkdir -p "$TEST_OUTPUT_DIRECTORY/test-results"
BASE="$TEST_OUTPUT_DIRECTORY/test-results/$(basename "$0" .sh)" BASE="$TEST_OUTPUT_DIRECTORY/test-results/$(basename "$0" .sh)"
(GIT_TEST_TEE_STARTED=done ${SHELL_PATH} "$0" "$@" 2>&1; (GIT_TEST_TEE_STARTED=done ${SHELL_PATH} "$0" "$@" 2>&1;
echo $? > $BASE.exit) | tee $BASE.out echo $? >"$BASE.exit") | tee "$BASE.out"
test "$(cat $BASE.exit)" = 0 test "$(cat "$BASE.exit")" = 0
exit exit
;; ;;
esac esac