Merge branch 'jc/skip-test-in-the-middle' into maint
authorJunio C Hamano <gitster@pobox.com>
Tue, 13 Jun 2017 20:27:00 +0000 (13:27 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Jun 2017 20:27:00 +0000 (13:27 -0700)
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

t/t5545-push-options.sh
t/test-lib.sh
index f9232f5d0ffff996359a27d5727f645f8fcff6d3..90a4b0d2fe9d8a1d9963bea54d2d1198a24003c2 100755 (executable)
@@ -3,8 +3,6 @@
 test_description='pushing to a repository using push options'
 
 . ./test-lib.sh
-. "$TEST_DIRECTORY"/lib-httpd.sh
-start_httpd
 
 mk_repo_pair () {
        rm -rf workbench upstream &&
@@ -102,46 +100,6 @@ test_expect_success 'two push options work' '
        test_cmp expect upstream/.git/hooks/post-receive.push_options
 '
 
-test_expect_success 'push option denied properly by http server' '
-       test_when_finished "rm -rf test_http_clone" &&
-       test_when_finished "rm -rf \"$HTTPD_DOCUMENT_ROOT_PATH\"/upstream.git" &&
-       mk_repo_pair &&
-       git -C upstream config receive.advertisePushOptions false &&
-       git -C upstream config http.receivepack true &&
-       cp -R upstream/.git "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git &&
-       git clone "$HTTPD_URL"/smart/upstream test_http_clone &&
-       test_commit -C test_http_clone one &&
-       test_must_fail git -C test_http_clone push --push-option=asdf origin master 2>actual &&
-       test_i18ngrep "the receiving end does not support push options" actual &&
-       git -C test_http_clone push origin master
-'
-
-test_expect_success 'push options work properly across http' '
-       test_when_finished "rm -rf test_http_clone" &&
-       test_when_finished "rm -rf \"$HTTPD_DOCUMENT_ROOT_PATH\"/upstream.git" &&
-       mk_repo_pair &&
-       git -C upstream config receive.advertisePushOptions true &&
-       git -C upstream config http.receivepack true &&
-       cp -R upstream/.git "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git &&
-       git clone "$HTTPD_URL"/smart/upstream test_http_clone &&
-
-       test_commit -C test_http_clone one &&
-       git -C test_http_clone push origin master &&
-       git -C "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git rev-parse --verify master >expect &&
-       git -C test_http_clone rev-parse --verify master >actual &&
-       test_cmp expect actual &&
-
-       test_commit -C test_http_clone two &&
-       git -C test_http_clone push --push-option=asdf --push-option="more structured text" origin master &&
-       printf "asdf\nmore structured text\n" >expect &&
-       test_cmp expect "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git/hooks/pre-receive.push_options &&
-       test_cmp expect "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git/hooks/post-receive.push_options &&
-
-       git -C "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git rev-parse --verify master >expect &&
-       git -C test_http_clone rev-parse --verify master >actual &&
-       test_cmp expect actual
-'
-
 test_expect_success 'push options and submodules' '
        test_when_finished "rm -rf parent" &&
        test_when_finished "rm -rf parent_upstream" &&
@@ -182,6 +140,49 @@ test_expect_success 'push options and submodules' '
        test_cmp expect parent_upstream/.git/hooks/post-receive.push_options
 '
 
+. "$TEST_DIRECTORY"/lib-httpd.sh
+start_httpd
+
+test_expect_success 'push option denied properly by http server' '
+       test_when_finished "rm -rf test_http_clone" &&
+       test_when_finished "rm -rf \"$HTTPD_DOCUMENT_ROOT_PATH\"/upstream.git" &&
+       mk_repo_pair &&
+       git -C upstream config receive.advertisePushOptions false &&
+       git -C upstream config http.receivepack true &&
+       cp -R upstream/.git "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git &&
+       git clone "$HTTPD_URL"/smart/upstream test_http_clone &&
+       test_commit -C test_http_clone one &&
+       test_must_fail git -C test_http_clone push --push-option=asdf origin master 2>actual &&
+       test_i18ngrep "the receiving end does not support push options" actual &&
+       git -C test_http_clone push origin master
+'
+
+test_expect_success 'push options work properly across http' '
+       test_when_finished "rm -rf test_http_clone" &&
+       test_when_finished "rm -rf \"$HTTPD_DOCUMENT_ROOT_PATH\"/upstream.git" &&
+       mk_repo_pair &&
+       git -C upstream config receive.advertisePushOptions true &&
+       git -C upstream config http.receivepack true &&
+       cp -R upstream/.git "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git &&
+       git clone "$HTTPD_URL"/smart/upstream test_http_clone &&
+
+       test_commit -C test_http_clone one &&
+       git -C test_http_clone push origin master &&
+       git -C "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git rev-parse --verify master >expect &&
+       git -C test_http_clone rev-parse --verify master >actual &&
+       test_cmp expect actual &&
+
+       test_commit -C test_http_clone two &&
+       git -C test_http_clone push --push-option=asdf --push-option="more structured text" origin master &&
+       printf "asdf\nmore structured text\n" >expect &&
+       test_cmp expect "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git/hooks/pre-receive.push_options &&
+       test_cmp expect "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git/hooks/post-receive.push_options &&
+
+       git -C "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git rev-parse --verify master >expect &&
+       git -C test_http_clone rev-parse --verify master >actual &&
+       test_cmp expect actual
+'
+
 stop_httpd
 
 test_done
index 13b5696822d7cd054ed00cd5b4111ab39d3606cb..30eb7437198dddbb2d251e9ec91590754b1eddcf 100644 (file)
@@ -745,20 +745,25 @@ 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" &&