test-lib.sh: Fix some shell coding style violations
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
69915d88bc
commit
1c0cc7563b
@ -172,17 +172,23 @@ do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if test -n "$color"; then
|
if test -n "$color"
|
||||||
|
then
|
||||||
say_color () {
|
say_color () {
|
||||||
(
|
(
|
||||||
TERM=$ORIGINAL_TERM
|
TERM=$ORIGINAL_TERM
|
||||||
export TERM
|
export TERM
|
||||||
case "$1" in
|
case "$1" in
|
||||||
error) tput bold; tput setaf 1;; # bold red
|
error)
|
||||||
skip) tput bold; tput setaf 2;; # bold green
|
tput bold; tput setaf 1;; # bold red
|
||||||
pass) tput setaf 2;; # green
|
skip)
|
||||||
info) tput setaf 3;; # brown
|
tput bold; tput setaf 2;; # bold green
|
||||||
*) test -n "$quiet" && return;;
|
pass)
|
||||||
|
tput setaf 2;; # green
|
||||||
|
info)
|
||||||
|
tput setaf 3;; # brown
|
||||||
|
*)
|
||||||
|
test -n "$quiet" && return;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
printf "%s" "$*"
|
printf "%s" "$*"
|
||||||
@ -298,7 +304,8 @@ test_run_ () {
|
|||||||
then
|
then
|
||||||
test_eval_ "$test_cleanup"
|
test_eval_ "$test_cleanup"
|
||||||
fi
|
fi
|
||||||
if test "$verbose" = "t" && test -n "$HARNESS_ACTIVE"; then
|
if test "$verbose" = "t" && test -n "$HARNESS_ACTIVE"
|
||||||
|
then
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
return "$eval_ret"
|
return "$eval_ret"
|
||||||
@ -346,7 +353,8 @@ test_at_end_hook_ () {
|
|||||||
test_done () {
|
test_done () {
|
||||||
GIT_EXIT_OK=t
|
GIT_EXIT_OK=t
|
||||||
|
|
||||||
if test -z "$HARNESS_ACTIVE"; then
|
if test -z "$HARNESS_ACTIVE"
|
||||||
|
then
|
||||||
test_results_dir="$TEST_OUTPUT_DIRECTORY/test-results"
|
test_results_dir="$TEST_OUTPUT_DIRECTORY/test-results"
|
||||||
mkdir -p "$test_results_dir"
|
mkdir -p "$test_results_dir"
|
||||||
test_results_path="$test_results_dir/${0%.sh}-$$.counts"
|
test_results_path="$test_results_dir/${0%.sh}-$$.counts"
|
||||||
@ -377,7 +385,8 @@ test_done () {
|
|||||||
# Maybe print SKIP message
|
# Maybe print SKIP message
|
||||||
[ -z "$skip_all" ] || skip_all=" # SKIP $skip_all"
|
[ -z "$skip_all" ] || skip_all=" # SKIP $skip_all"
|
||||||
|
|
||||||
if test $test_external_has_tap -eq 0; then
|
if test $test_external_has_tap -eq 0
|
||||||
|
then
|
||||||
say_color pass "# passed all $msg"
|
say_color pass "# passed all $msg"
|
||||||
say "1..$test_count$skip_all"
|
say "1..$test_count$skip_all"
|
||||||
fi
|
fi
|
||||||
@ -391,7 +400,8 @@ test_done () {
|
|||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
if test $test_external_has_tap -eq 0; then
|
if test $test_external_has_tap -eq 0
|
||||||
|
then
|
||||||
say_color error "# failed $test_failure among $msg"
|
say_color error "# failed $test_failure among $msg"
|
||||||
say "1..$test_count"
|
say "1..$test_count"
|
||||||
fi
|
fi
|
||||||
@ -471,22 +481,26 @@ then
|
|||||||
PATH=$GIT_VALGRIND/bin:$PATH
|
PATH=$GIT_VALGRIND/bin:$PATH
|
||||||
GIT_EXEC_PATH=$GIT_VALGRIND/bin
|
GIT_EXEC_PATH=$GIT_VALGRIND/bin
|
||||||
export GIT_VALGRIND
|
export GIT_VALGRIND
|
||||||
elif test -n "$GIT_TEST_INSTALLED" ; then
|
elif test -n "$GIT_TEST_INSTALLED"
|
||||||
|
then
|
||||||
GIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path) ||
|
GIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path) ||
|
||||||
error "Cannot run git from $GIT_TEST_INSTALLED."
|
error "Cannot run git from $GIT_TEST_INSTALLED."
|
||||||
PATH=$GIT_TEST_INSTALLED:$GIT_BUILD_DIR:$PATH
|
PATH=$GIT_TEST_INSTALLED:$GIT_BUILD_DIR:$PATH
|
||||||
GIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}
|
GIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}
|
||||||
else # normal case, use ../bin-wrappers only unless $with_dashes:
|
else # normal case, use ../bin-wrappers only unless $with_dashes:
|
||||||
git_bin_dir="$GIT_BUILD_DIR/bin-wrappers"
|
git_bin_dir="$GIT_BUILD_DIR/bin-wrappers"
|
||||||
if ! test -x "$git_bin_dir/git" ; then
|
if ! test -x "$git_bin_dir/git"
|
||||||
if test -z "$with_dashes" ; then
|
then
|
||||||
|
if test -z "$with_dashes"
|
||||||
|
then
|
||||||
say "$git_bin_dir/git is not executable; using GIT_EXEC_PATH"
|
say "$git_bin_dir/git is not executable; using GIT_EXEC_PATH"
|
||||||
fi
|
fi
|
||||||
with_dashes=t
|
with_dashes=t
|
||||||
fi
|
fi
|
||||||
PATH="$git_bin_dir:$PATH"
|
PATH="$git_bin_dir:$PATH"
|
||||||
GIT_EXEC_PATH=$GIT_BUILD_DIR
|
GIT_EXEC_PATH=$GIT_BUILD_DIR
|
||||||
if test -n "$with_dashes" ; then
|
if test -n "$with_dashes"
|
||||||
|
then
|
||||||
PATH="$GIT_BUILD_DIR:$PATH"
|
PATH="$GIT_BUILD_DIR:$PATH"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -521,7 +535,8 @@ then
|
|||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! test -x "$GIT_BUILD_DIR"/test-chmtime; then
|
if ! test -x "$GIT_BUILD_DIR"/test-chmtime
|
||||||
|
then
|
||||||
echo >&2 'You need to build test-chmtime:'
|
echo >&2 'You need to build test-chmtime:'
|
||||||
echo >&2 'Run "make test-chmtime" in the source (toplevel) directory'
|
echo >&2 'Run "make test-chmtime" in the source (toplevel) directory'
|
||||||
exit 1
|
exit 1
|
||||||
@ -544,7 +559,8 @@ rm -fr "$test" || {
|
|||||||
HOME="$TRASH_DIRECTORY"
|
HOME="$TRASH_DIRECTORY"
|
||||||
export HOME
|
export HOME
|
||||||
|
|
||||||
if test -z "$TEST_NO_CREATE_REPO"; then
|
if test -z "$TEST_NO_CREATE_REPO"
|
||||||
|
then
|
||||||
test_create_repo "$test"
|
test_create_repo "$test"
|
||||||
else
|
else
|
||||||
mkdir -p "$test"
|
mkdir -p "$test"
|
||||||
|
Loading…
Reference in New Issue
Block a user