Browse Source

tests: use 'test_atexit' to stop httpd

Use 'test_atexit' to run cleanup commands to stop httpd at the end of
the test script or upon interrupt or failure, as it is shorter,
simpler, and more robust than registering such cleanup commands in the
trap on EXIT in the test scripts.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
SZEDER Gábor 6 years ago committed by Junio C Hamano
parent
commit
8c3b9f7faa
  1. 5
      t/lib-git-svn.sh
  2. 6
      t/lib-httpd.sh
  3. 2
      t/t0410-partial-clone.sh
  4. 3
      t/t5500-fetch-pack.sh
  5. 2
      t/t5510-fetch.sh
  6. 2
      t/t5537-fetch-shallow.sh
  7. 1
      t/t5539-fetch-http-shallow.sh
  8. 2
      t/t5540-http-push-webdav.sh
  9. 1
      t/t5541-http-push-smart.sh
  10. 1
      t/t5542-push-http-shallow.sh
  11. 2
      t/t5545-push-options.sh
  12. 1
      t/t5550-http-fetch-dumb.sh
  13. 1
      t/t5551-http-fetch-smart.sh
  14. 1
      t/t5561-http-backend.sh
  15. 2
      t/t5581-http-curl-verbose.sh
  16. 2
      t/t5601-clone.sh
  17. 2
      t/t5616-partial-clone.sh
  18. 2
      t/t5700-protocol-v1.sh
  19. 2
      t/t5702-protocol-v2.sh
  20. 2
      t/t5703-upload-pack-ref-in-want.sh
  21. 1
      t/t5812-proto-disable-http.sh
  22. 2
      t/t9115-git-svn-dcommit-funky-renames.sh
  23. 2
      t/t9118-git-svn-funky-branch-names.sh
  24. 2
      t/t9120-git-svn-clone-with-percent-escapes.sh
  25. 2
      t/t9142-git-svn-shallow-clone.sh

5
t/lib-git-svn.sh

@ -76,11 +76,6 @@ maybe_start_httpd () {
LIB_HTTPD_SVN="$loc" LIB_HTTPD_SVN="$loc"
start_httpd start_httpd
;; ;;
*)
stop_httpd () {
: noop
}
;;
esac esac
} }



6
t/lib-httpd.sh

@ -14,7 +14,6 @@
# #
# test_expect_success ... # test_expect_success ...
# #
# stop_httpd
# test_done # test_done
# #
# Can be configured using the following variables. # Can be configured using the following variables.
@ -176,7 +175,7 @@ prepare_httpd() {
start_httpd() { start_httpd() {
prepare_httpd >&3 2>&4 prepare_httpd >&3 2>&4


trap 'code=$?; stop_httpd; (exit $code); die' EXIT test_atexit stop_httpd


"$LIB_HTTPD_PATH" -d "$HTTPD_ROOT_PATH" \ "$LIB_HTTPD_PATH" -d "$HTTPD_ROOT_PATH" \
-f "$TEST_PATH/apache.conf" $HTTPD_PARA \ -f "$TEST_PATH/apache.conf" $HTTPD_PARA \
@ -184,15 +183,12 @@ start_httpd() {
>&3 2>&4 >&3 2>&4
if test $? -ne 0 if test $? -ne 0
then then
trap 'die' EXIT
cat "$HTTPD_ROOT_PATH"/error.log >&4 2>/dev/null cat "$HTTPD_ROOT_PATH"/error.log >&4 2>/dev/null
test_skip_or_die $GIT_TEST_HTTPD "web server setup failed" test_skip_or_die $GIT_TEST_HTTPD "web server setup failed"
fi fi
} }


stop_httpd() { stop_httpd() {
trap 'die' EXIT

"$LIB_HTTPD_PATH" -d "$HTTPD_ROOT_PATH" \ "$LIB_HTTPD_PATH" -d "$HTTPD_ROOT_PATH" \
-f "$TEST_PATH/apache.conf" $HTTPD_PARA -k stop -f "$TEST_PATH/apache.conf" $HTTPD_PARA -k stop
} }

2
t/t0410-partial-clone.sh

@ -518,6 +518,4 @@ test_expect_success 'fetching of missing objects from an HTTP server' '
git verify-pack --verbose "$IDX" | grep "$HASH" git verify-pack --verbose "$IDX" | grep "$HASH"
' '


stop_httpd

test_done test_done

3
t/t5500-fetch-pack.sh

@ -918,7 +918,4 @@ test_expect_success 'fetch with --filter=blob:limit=0 and HTTP' '
fetch_filter_blob_limit_zero "$HTTPD_DOCUMENT_ROOT_PATH/server" "$HTTPD_URL/smart/server" fetch_filter_blob_limit_zero "$HTTPD_DOCUMENT_ROOT_PATH/server" "$HTTPD_URL/smart/server"
' '


stop_httpd


test_done test_done

2
t/t5510-fetch.sh

@ -978,6 +978,4 @@ test_expect_success '--negotiation-tip limits "have" lines sent with HTTP protoc
check_negotiation_tip check_negotiation_tip
' '


stop_httpd

test_done test_done

2
t/t5537-fetch-shallow.sh

@ -255,6 +255,4 @@ test_expect_success 'shallow fetches check connectivity before writing shallow f
git -C client fsck git -C client fsck
' '


stop_httpd

test_done test_done

1
t/t5539-fetch-http-shallow.sh

@ -146,5 +146,4 @@ test_expect_success 'fetching deepen' '
) )
' '


stop_httpd
test_done test_done

2
t/t5540-http-push-webdav.sh

@ -176,6 +176,4 @@ test_expect_failure 'push to password-protected repository (no user in URL)' '
test_cmp expect actual test_cmp expect actual
' '


stop_httpd

test_done test_done

1
t/t5541-http-push-smart.sh

@ -373,5 +373,4 @@ test_expect_success 'colorize errors/hints' '
test_i18ngrep ! "^hint: " decoded test_i18ngrep ! "^hint: " decoded
' '


stop_httpd
test_done test_done

1
t/t5542-push-http-shallow.sh

@ -90,5 +90,4 @@ EOF
) )
' '


stop_httpd
test_done test_done

2
t/t5545-push-options.sh

@ -278,6 +278,4 @@ test_expect_success 'push options keep quoted characters intact (http)' '
test_cmp expect "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git/hooks/pre-receive.push_options test_cmp expect "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git/hooks/pre-receive.push_options
' '


stop_httpd

test_done test_done

1
t/t5550-http-fetch-dumb.sh

@ -408,5 +408,4 @@ test_expect_success 'print HTTP error when any intermediate redirect throws erro
test_i18ngrep "unable to access.*/redir-to/502" stderr test_i18ngrep "unable to access.*/redir-to/502" stderr
' '


stop_httpd
test_done test_done

1
t/t5551-http-fetch-smart.sh

@ -434,5 +434,4 @@ test_expect_success 'server-side error detected' '
grep "server-side error" actual grep "server-side error" actual
' '


stop_httpd
test_done test_done

1
t/t5561-http-backend.sh

@ -132,5 +132,4 @@ test_expect_success 'server request log matches test results' '
check_access_log exp check_access_log exp
' '


stop_httpd
test_done test_done

2
t/t5581-http-curl-verbose.sh

@ -23,6 +23,4 @@ test_expect_success 'failure in git-upload-pack is shown' '
grep "< HTTP/1.1 500 Intentional Breakage" curl_log grep "< HTTP/1.1 500 Intentional Breakage" curl_log
' '


stop_httpd

test_done test_done

2
t/t5601-clone.sh

@ -733,6 +733,4 @@ test_expect_success 'partial clone using HTTP' '
partial_clone "$HTTPD_DOCUMENT_ROOT_PATH/server" "$HTTPD_URL/smart/server" partial_clone "$HTTPD_DOCUMENT_ROOT_PATH/server" "$HTTPD_URL/smart/server"
' '


stop_httpd

test_done test_done

2
t/t5616-partial-clone.sh

@ -331,6 +331,4 @@ test_expect_success 'when partial cloning, tolerate server not sending target of
! test -e "$HTTPD_ROOT_PATH/one-time-sed" ! test -e "$HTTPD_ROOT_PATH/one-time-sed"
' '


stop_httpd

test_done test_done

2
t/t5700-protocol-v1.sh

@ -289,6 +289,4 @@ test_expect_success 'push with http:// using protocol v1' '
grep "git< version 1" log grep "git< version 1" log
' '


stop_httpd

test_done test_done

2
t/t5702-protocol-v2.sh

@ -687,6 +687,4 @@ test_expect_success 'when server does not send "ready", expect FLUSH' '
test_i18ngrep "expected no other sections to be sent after no .ready." err test_i18ngrep "expected no other sections to be sent after no .ready." err
' '


stop_httpd

test_done test_done

2
t/t5703-upload-pack-ref-in-want.sh

@ -257,8 +257,6 @@ test_expect_success 'server loses a ref - ref in want' '
test_i18ngrep "fatal: remote error: unknown ref refs/heads/raster" err test_i18ngrep "fatal: remote error: unknown ref refs/heads/raster" err
' '


stop_httpd

REPO="$(pwd)/repo" REPO="$(pwd)/repo"
LOCAL_PRISTINE="$(pwd)/local_pristine" LOCAL_PRISTINE="$(pwd)/local_pristine"



1
t/t5812-proto-disable-http.sh

@ -34,5 +34,4 @@ test_expect_success 'http can be limited to from-user' '
clone "$HTTPD_URL/smart-redir-perm/repo.git" redir.git clone "$HTTPD_URL/smart-redir-perm/repo.git" redir.git
' '


stop_httpd
test_done test_done

2
t/t9115-git-svn-dcommit-funky-renames.sh

@ -120,6 +120,4 @@ test_expect_success !MINGW,!UTF8_NFD_TO_NFC 'svn.pathnameencoding=cp932 rename o
git svn dcommit git svn dcommit
' '


stop_httpd

test_done test_done

2
t/t9118-git-svn-funky-branch-names.sh

@ -87,6 +87,4 @@ test_expect_success 'test dcommit to trailing_dotlock branch' '
) )
' '


stop_httpd

test_done test_done

2
t/t9120-git-svn-clone-with-percent-escapes.sh

@ -74,6 +74,4 @@ test_expect_success 'test clone -s with unescaped space' '
) )
' '


stop_httpd

test_done test_done

2
t/t9142-git-svn-shallow-clone.sh

@ -26,6 +26,4 @@ test_expect_success 'clone trunk with "-r HEAD"' '
( cd g && git rev-parse --symbolic --verify HEAD ) ( cd g && git rev-parse --symbolic --verify HEAD )
' '


stop_httpd

test_done test_done

Loading…
Cancel
Save