diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-08-03 01:30:39 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-03 01:30:39 +0300 |
commit | bc6d33e87ac930286fe0bfc882b837bba4b18501 (patch) | |
tree | 6aefd65164f3655090dd213322be1f2692dd59e9 /t/lib-httpd.sh | |
parent | 5e98080188f2ef8034947b5c341371e1dfb6c2aa (diff) | |
parent | e8b3b2e275106c4fae1fb2b5969924a4565615e6 (diff) |
Merge branch 'sg/httpd-test-unflake'
httpd tests saw occasional breakage due to the way its access log
gets inspected by the tests, which has been updated to make them
less flaky.
* sg/httpd-test-unflake:
t/lib-httpd: avoid occasional failures when checking access.log
t/lib-httpd: add the strip_access_log() helper function
t5541: clean up truncating access log
Diffstat (limited to 't/lib-httpd.sh')
-rw-r--r-- | t/lib-httpd.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh index ed41b155af..a8729f8232 100644 --- a/t/lib-httpd.sh +++ b/t/lib-httpd.sh @@ -288,3 +288,24 @@ expect_askpass() { test_cmp "$TRASH_DIRECTORY/askpass-expect" \ "$TRASH_DIRECTORY/askpass-query" } + +strip_access_log() { + sed -e " + s/^.* \"// + s/\"// + s/ [1-9][0-9]*\$// + s/^GET /GET / + " "$HTTPD_ROOT_PATH"/access.log +} + +# Requires one argument: the name of a file containing the expected stripped +# access log entries. +check_access_log() { + sort "$1" >"$1".sorted && + strip_access_log >access.log.stripped && + sort access.log.stripped >access.log.sorted && + if ! test_cmp "$1".sorted access.log.sorted + then + test_cmp "$1" access.log.stripped + fi +} |