Skip to content

Commit 2a8a449

Browse files
Ramsay Jonesgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0f3ddd4 commit 2a8a449

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

t/t9501-gitweb-standalone-http-status.sh

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ code and message.'
1212

1313
. ./gitweb-lib.sh
1414

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+
1522
# ----------------------------------------------------------------------
1623
# snapshot settings
1724

@@ -115,53 +122,53 @@ test_debug 'cat gitweb.output'
115122
# ----------------------------------------------------------------------
116123
# modification times (Last-Modified and If-Modified-Since)
117124

118-
test_expect_success 'modification: feed last-modified' '
125+
test_expect_success DATE_PARSER 'modification: feed last-modified' '
119126
gitweb_run "p=.git;a=atom;h=master" &&
120127
grep "Status: 200 OK" gitweb.headers &&
121128
grep "Last-modified: Thu, 7 Apr 2005 22:14:13 +0000" gitweb.headers
122129
'
123130
test_debug 'cat gitweb.headers'
124131

125-
test_expect_success 'modification: feed if-modified-since (modified)' '
132+
test_expect_success DATE_PARSER 'modification: feed if-modified-since (modified)' '
126133
export HTTP_IF_MODIFIED_SINCE="Wed, 6 Apr 2005 22:14:13 +0000" &&
127134
test_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&
128135
gitweb_run "p=.git;a=atom;h=master" &&
129136
grep "Status: 200 OK" gitweb.headers
130137
'
131138
test_debug 'cat gitweb.headers'
132139

133-
test_expect_success 'modification: feed if-modified-since (unmodified)' '
140+
test_expect_success DATE_PARSER 'modification: feed if-modified-since (unmodified)' '
134141
export HTTP_IF_MODIFIED_SINCE="Thu, 7 Apr 2005 22:14:13 +0000" &&
135142
test_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&
136143
gitweb_run "p=.git;a=atom;h=master" &&
137144
grep "Status: 304 Not Modified" gitweb.headers
138145
'
139146
test_debug 'cat gitweb.headers'
140147

141-
test_expect_success 'modification: snapshot last-modified' '
148+
test_expect_success DATE_PARSER 'modification: snapshot last-modified' '
142149
gitweb_run "p=.git;a=snapshot;h=master;sf=tgz" &&
143150
grep "Status: 200 OK" gitweb.headers &&
144151
grep "Last-modified: Thu, 7 Apr 2005 22:14:13 +0000" gitweb.headers
145152
'
146153
test_debug 'cat gitweb.headers'
147154

148-
test_expect_success 'modification: snapshot if-modified-since (modified)' '
155+
test_expect_success DATE_PARSER 'modification: snapshot if-modified-since (modified)' '
149156
export HTTP_IF_MODIFIED_SINCE="Wed, 6 Apr 2005 22:14:13 +0000" &&
150157
test_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&
151158
gitweb_run "p=.git;a=snapshot;h=master;sf=tgz" &&
152159
grep "Status: 200 OK" gitweb.headers
153160
'
154161
test_debug 'cat gitweb.headers'
155162

156-
test_expect_success 'modification: snapshot if-modified-since (unmodified)' '
163+
test_expect_success DATE_PARSER 'modification: snapshot if-modified-since (unmodified)' '
157164
export HTTP_IF_MODIFIED_SINCE="Thu, 7 Apr 2005 22:14:13 +0000" &&
158165
test_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&
159166
gitweb_run "p=.git;a=snapshot;h=master;sf=tgz" &&
160167
grep "Status: 304 Not Modified" gitweb.headers
161168
'
162169
test_debug 'cat gitweb.headers'
163170

164-
test_expect_success 'modification: tree snapshot' '
171+
test_expect_success DATE_PARSER 'modification: tree snapshot' '
165172
ID=`git rev-parse --verify HEAD^{tree}` &&
166173
export HTTP_IF_MODIFIED_SINCE="Wed, 6 Apr 2005 22:14:13 +0000" &&
167174
test_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&

0 commit comments

Comments
 (0)