From: Junio C Hamano Date: Wed, 23 Aug 2017 21:13:09 +0000 (-0700) Subject: Merge branch 'rs/t1002-do-not-use-sum' X-Git-Tag: v2.15.0-rc0~148 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/8a43d3bae50eeb48893d45affbfc772dbac78b6c?hp=-c Merge branch 'rs/t1002-do-not-use-sum' Test simplification. * rs/t1002-do-not-use-sum: t1002: stop using sum(1) --- 8a43d3bae50eeb48893d45affbfc772dbac78b6c diff --combined t/test-lib.sh index 5e3ca30ab3,4d3089d0b2..5fbd8d4a90 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@@ -36,14 -36,6 +36,14 @@@ the fi GIT_BUILD_DIR="$TEST_DIRECTORY"/.. +# If we were built with ASAN, it may complain about leaks +# of program-lifetime variables. Disable it by default to lower +# the noise level. This needs to happen at the start of the script, +# before we even do our "did we build git yet" check (since we don't +# want that one to complain to stderr). +: ${ASAN_OPTIONS=detect_leaks=0:abort_on_error=1} +export ASAN_OPTIONS + ################################################################ # It appears that people try to run tests without building... "$GIT_BUILD_DIR/git" >/dev/null @@@ -99,6 -91,7 +99,6 @@@ unset VISUAL EMAIL LANGUAGE COLUMNS $(" my $ok = join("|", qw( TRACE DEBUG - USE_LOOKUP TEST .*_TEST PROVE @@@ -155,6 -148,9 +155,6 @@@ els } fi -: ${ASAN_OPTIONS=detect_leaks=0} -export ASAN_OPTIONS - # Protect ourselves from common misconfiguration to export # CDPATH into the environment unset CDPATH @@@ -346,7 -342,6 +346,7 @@@ f exec 5>&1 exec 6<&0 +exec 7>&2 if test "$verbose_log" = "t" then exec 3>>"$GIT_TEST_TEE_OUTPUT_FILE" 4>&3 @@@ -629,9 -624,9 +629,9 @@@ test_run_ () trace= # 117 is magic because it is unlikely to match the exit # code of other programs - test_eval_ "(exit 117) && $1" - if test "$?" != 117; then - error "bug in the test script: broken &&-chain: $1" + if test "OK-117" != "$(test_eval_ "(exit 117) && $1${LF}${LF}echo OK-\$?" 3>&1)" + then + error "bug in the test script: broken &&-chain or run-away HERE-DOC: $1" fi trace=$trace_tmp fi @@@ -749,36 -744,26 +749,36 @@@ test_done () fi case "$test_failure" in 0) - # Maybe print SKIP message - if test -n "$skip_all" && test $test_count -gt 0 - then - error "Can't use skip_all after running some tests" - fi - test -z "$skip_all" || skip_all=" # SKIP $skip_all" - if test $test_external_has_tap -eq 0 then if test $test_remaining -gt 0 then say_color pass "# passed all $msg" fi - say "1..$test_count$skip_all" + + # Maybe print SKIP message + test -z "$skip_all" || skip_all="# SKIP $skip_all" + case "$test_count" in + 0) + say "1..$test_count${skip_all:+ $skip_all}" + ;; + *) + test -z "$skip_all" || + say_color warn "$skip_all" + say "1..$test_count" + ;; + esac fi - test -d "$remove_trash" && - cd "$(dirname "$remove_trash")" && - rm -rf "$(basename "$remove_trash")" + if test -z "$debug" + then + test -d "$TRASH_DIRECTORY" || + error "Tests passed but trash directory already removed before test cleanup; aborting" + cd "$TRASH_DIRECTORY/.." && + rm -fr "$TRASH_DIRECTORY" || + error "Tests passed but test cleanup failed; aborting" + fi test_at_end_hook_ exit 0 ;; @@@ -933,6 -918,7 +933,6 @@@ case "$TRASH_DIRECTORY" i /*) ;; # absolute path is good *) TRASH_DIRECTORY="$TEST_OUTPUT_DIRECTORY/$TRASH_DIRECTORY" ;; esac -test ! -z "$debug" || remove_trash=$TRASH_DIRECTORY rm -fr "$TRASH_DIRECTORY" || { GIT_EXIT_OK=t echo >&5 "FATAL: Cannot prepare test area" @@@ -980,8 -966,7 +980,8 @@@ yes () } # Fix some commands on Windows -case $(uname -s) in +uname_s=$(uname -s) +case $uname_s in *MINGW*) # Windows has its own (incompatible) sort and find sort () { @@@ -990,9 -975,6 +990,6 @@@ find () { /usr/bin/find "$@" } - sum () { - md5sum "$@" - } # git sees Windows-style pwd pwd () { builtin pwd -W @@@ -1022,9 -1004,8 +1019,9 @@@ esa ( COLUMNS=1 && test $COLUMNS = 1 ) && test_set_prereq COLUMNS_CAN_BE_1 test -z "$NO_PERL" && test_set_prereq PERL +test -z "$NO_PTHREADS" && test_set_prereq PTHREADS test -z "$NO_PYTHON" && test_set_prereq PYTHON -test -n "$USE_LIBPCRE" && test_set_prereq LIBPCRE +test -n "$USE_LIBPCRE1$USE_LIBPCRE2" && test_set_prereq PCRE test -z "$NO_GETTEXT" && test_set_prereq GETTEXT # Can we rely on git's output in the C locale? @@@ -1122,10 -1103,6 +1119,10 @@@ test_lazy_prereq NOT_ROOT test "$uid" != 0 ' +test_lazy_prereq JGIT ' + type jgit +' + # SANITY is about "can you correctly predict what the filesystem would # do by only looking at the permission bits of the files and # directories?" A typical example of !SANITY is running the test @@@ -1157,7 -1134,6 +1154,7 @@@ test_lazy_prereq SANITY return $status ' +test FreeBSD != $uname_s || GIT_UNZIP=${GIT_UNZIP:-/usr/local/bin/unzip} GIT_UNZIP=${GIT_UNZIP:-unzip} test_lazy_prereq UNZIP ' "$GIT_UNZIP" -v @@@ -1178,6 -1154,3 +1175,6 @@@ build_option () test_lazy_prereq LONG_IS_64BIT ' test 8 -le "$(build_option sizeof-long)" ' + +test_lazy_prereq TIME_IS_64BIT 'test-date is64bit' +test_lazy_prereq TIME_T_IS_64BIT 'test-date time_t-is64bit'