gitweb: Skip 'modification times' tests when no date parser available
The If-Modified-Since support in Gitweb is conditional on the availability of a date parser from either the HTTP::Date or Time::ParseDate modules. If a suitable parser is not available, then the corresponding 'modification times' tests should be skipped. Introduce the DATE_PARSER test prerequisite and use it to skip all of the dependent tests. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ramsay Jones committed
Jun 12, 2012 at 19:09 UTC
2a8a4490c20e3f39dc15721b49715867511163ba
1 file changed
+14
-7
t/t9501-gitweb-standalone-http-status.sh
+14
-7
@@ -12,6 +12,13 @@ code and message.'
12
13
. ./gitweb-lib.sh
14
15
+#
16
+# Gitweb only provides the functionality tested by the 'modification times'
17
+# tests if it can access a date parser from one of these modules:
18
+#
19
+perl -MHTTP::Date -e 0 >/dev/null 2>&1 && test_set_prereq DATE_PARSER
20
+perl -MTime::ParseDate -e 0 >/dev/null 2>&1 && test_set_prereq DATE_PARSER
21
+
22
# ----------------------------------------------------------------------
23
# snapshot settings
24
@@ -115,14 +122,14 @@ test_debug 'cat gitweb.output'
122
# ----------------------------------------------------------------------
123
# modification times (Last-Modified and If-Modified-Since)
124
118
-test_expect_success 'modification: feed last-modified' '
125
+test_expect_success DATE_PARSER 'modification: feed last-modified' '
126
gitweb_run "p=.git;a=atom;h=master" &&
127
grep "Status: 200 OK" gitweb.headers &&
128
grep "Last-modified: Thu, 7 Apr 2005 22:14:13 +0000" gitweb.headers
129
'
130
test_debug 'cat gitweb.headers'
131
125
-test_expect_success 'modification: feed if-modified-since (modified)' '
132
+test_expect_success DATE_PARSER 'modification: feed if-modified-since (modified)' '
133
export HTTP_IF_MODIFIED_SINCE="Wed, 6 Apr 2005 22:14:13 +0000" &&
134
test_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&
135
gitweb_run "p=.git;a=atom;h=master" &&
@@ -130,7 +137,7 @@ test_expect_success 'modification: feed if-modified-since (modified)' '
137
'
138
test_debug 'cat gitweb.headers'
139
133
-test_expect_success 'modification: feed if-modified-since (unmodified)' '
140
+test_expect_success DATE_PARSER 'modification: feed if-modified-since (unmodified)' '
141
export HTTP_IF_MODIFIED_SINCE="Thu, 7 Apr 2005 22:14:13 +0000" &&
142
test_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&
143
gitweb_run "p=.git;a=atom;h=master" &&
@@ -138,14 +145,14 @@ test_expect_success 'modification: feed if-modified-since (unmodified)' '
145
'
146
test_debug 'cat gitweb.headers'
147
141
-test_expect_success 'modification: snapshot last-modified' '
148
+test_expect_success DATE_PARSER 'modification: snapshot last-modified' '
149
gitweb_run "p=.git;a=snapshot;h=master;sf=tgz" &&
150
grep "Status: 200 OK" gitweb.headers &&
151
grep "Last-modified: Thu, 7 Apr 2005 22:14:13 +0000" gitweb.headers
152
'
153
test_debug 'cat gitweb.headers'
154
148
-test_expect_success 'modification: snapshot if-modified-since (modified)' '
155
+test_expect_success DATE_PARSER 'modification: snapshot if-modified-since (modified)' '
156
export HTTP_IF_MODIFIED_SINCE="Wed, 6 Apr 2005 22:14:13 +0000" &&
157
test_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&
158
gitweb_run "p=.git;a=snapshot;h=master;sf=tgz" &&
@@ -153,7 +160,7 @@ test_expect_success 'modification: snapshot if-modified-since (modified)' '
160
'
161
test_debug 'cat gitweb.headers'
162
156
-test_expect_success 'modification: snapshot if-modified-since (unmodified)' '
163
+test_expect_success DATE_PARSER 'modification: snapshot if-modified-since (unmodified)' '
164
export HTTP_IF_MODIFIED_SINCE="Thu, 7 Apr 2005 22:14:13 +0000" &&
165
test_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&
166
gitweb_run "p=.git;a=snapshot;h=master;sf=tgz" &&
@@ -161,7 +168,7 @@ test_expect_success 'modification: snapshot if-modified-since (unmodified)' '
168
'
169
test_debug 'cat gitweb.headers'
170
164
-test_expect_success 'modification: tree snapshot' '
171
+test_expect_success DATE_PARSER 'modification: tree snapshot' '
172
ID=`git rev-parse --verify HEAD^{tree}` &&
173
export HTTP_IF_MODIFIED_SINCE="Wed, 6 Apr 2005 22:14:13 +0000" &&
174
test_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&