Merge branch 'jc/skip-test-in-the-middle'
authorJunio C Hamano <gitster@pobox.com>
Tue, 30 May 2017 02:16:44 +0000 (11:16 +0900)
committerJunio C Hamano <gitster@pobox.com>
Tue, 30 May 2017 02:16:44 +0000 (11:16 +0900)
A recent update to t5545-push-options.sh started skipping all the
tests in the script when a web server testing is disabled or
unavailable, not just the ones that require a web server. Non HTTP
tests have been salvaged to always run in this script.

* jc/skip-test-in-the-middle:
t5545: enhance test coverage when no http server is installed
test: allow skipping the remainder

1  2 
t/test-lib.sh
diff --combined t/test-lib.sh
index 26b3edfb2e4e725f589fc99986587aa3ecb48b75,30eb7437198dddbb2d251e9ec91590754b1eddcf..ec2571f0185b7c6aad15e3b01e67f6b79b643928
@@@ -745,31 -745,31 +745,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 ;;
@@@ -924,6 -924,7 +929,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"
@@@ -1168,6 -1169,3 +1173,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'