{"thread":{"id":"30785","subject":"[PATCH] gitweb: Skip 'modification times' tests when no date parser available","startedAt":"2012-06-12T18:09:38Z","lastAt":"2012-06-12T18:09:38Z","messageCount":1,"participants":["Ramsay Jones"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"193475","messageId":"4FD785E2.3020207@ramsay1.demon.co.uk","threadId":"30785","inReplyTo":null,"subject":"[PATCH] gitweb: Skip 'modification times' tests when no date parser available","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2012-06-12T18:09:38Z","receivedAt":"2012-06-12T18:09:38Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nThe If-Modified-Since support in Gitweb is conditional on the\navailability of a date parser from either the HTTP::Date or\nTime::ParseDate modules. If a suitable parser is not available,\nthen the corresponding 'modification times' tests should be skipped.\n\nIntroduce the DATE_PARSER test prerequisite and use it to skip\nall of the dependent tests.\n\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n t/t9501-gitweb-standalone-http-status.sh |   21 ++++++++++++++-------\n 1 file changed, 14 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t9501-gitweb-standalone-http-status.sh b/t/t9501-gitweb-standalone-http-status.sh\nindex fa2f65f..ef86948 100755\n--- a/t/t9501-gitweb-standalone-http-status.sh\n+++ b/t/t9501-gitweb-standalone-http-status.sh\n@@ -12,6 +12,13 @@ code and message.'\n \n . ./gitweb-lib.sh\n \n+#\n+# Gitweb only provides the functionality tested by the 'modification times'\n+# tests if it can access a date parser from one of these modules:\n+#\n+perl -MHTTP::Date -e 0 >/dev/null 2>&1 && test_set_prereq DATE_PARSER\n+perl -MTime::ParseDate -e 0 >/dev/null 2>&1 && test_set_prereq DATE_PARSER\n+\n # ----------------------------------------------------------------------\n # snapshot settings\n \n@@ -115,14 +122,14 @@ test_debug 'cat gitweb.output'\n # ----------------------------------------------------------------------\n # modification times (Last-Modified and If-Modified-Since)\n \n-test_expect_success 'modification: feed last-modified' '\n+test_expect_success DATE_PARSER 'modification: feed last-modified' '\n \tgitweb_run \"p=.git;a=atom;h=master\" &&\n \tgrep \"Status: 200 OK\" gitweb.headers &&\n \tgrep \"Last-modified: Thu, 7 Apr 2005 22:14:13 +0000\" gitweb.headers\n '\n test_debug 'cat gitweb.headers'\n \n-test_expect_success 'modification: feed if-modified-since (modified)' '\n+test_expect_success DATE_PARSER 'modification: feed if-modified-since (modified)' '\n \texport HTTP_IF_MODIFIED_SINCE=\"Wed, 6 Apr 2005 22:14:13 +0000\" &&\n \ttest_when_finished \"unset HTTP_IF_MODIFIED_SINCE\" &&\n \tgitweb_run \"p=.git;a=atom;h=master\" &&\n@@ -130,7 +137,7 @@ test_expect_success 'modification: feed if-modified-since (modified)' '\n '\n test_debug 'cat gitweb.headers'\n \n-test_expect_success 'modification: feed if-modified-since (unmodified)' '\n+test_expect_success DATE_PARSER 'modification: feed if-modified-since (unmodified)' '\n \texport HTTP_IF_MODIFIED_SINCE=\"Thu, 7 Apr 2005 22:14:13 +0000\" &&\n \ttest_when_finished \"unset HTTP_IF_MODIFIED_SINCE\" &&\n \tgitweb_run \"p=.git;a=atom;h=master\" &&\n@@ -138,14 +145,14 @@ test_expect_success 'modification: feed if-modified-since (unmodified)' '\n '\n test_debug 'cat gitweb.headers'\n \n-test_expect_success 'modification: snapshot last-modified' '\n+test_expect_success DATE_PARSER 'modification: snapshot last-modified' '\n \tgitweb_run \"p=.git;a=snapshot;h=master;sf=tgz\" &&\n \tgrep \"Status: 200 OK\" gitweb.headers &&\n \tgrep \"Last-modified: Thu, 7 Apr 2005 22:14:13 +0000\" gitweb.headers\n '\n test_debug 'cat gitweb.headers'\n \n-test_expect_success 'modification: snapshot if-modified-since (modified)' '\n+test_expect_success DATE_PARSER 'modification: snapshot if-modified-since (modified)' '\n \texport HTTP_IF_MODIFIED_SINCE=\"Wed, 6 Apr 2005 22:14:13 +0000\" &&\n \ttest_when_finished \"unset HTTP_IF_MODIFIED_SINCE\" &&\n \tgitweb_run \"p=.git;a=snapshot;h=master;sf=tgz\" &&\n@@ -153,7 +160,7 @@ test_expect_success 'modification: snapshot if-modified-since (modified)' '\n '\n test_debug 'cat gitweb.headers'\n \n-test_expect_success 'modification: snapshot if-modified-since (unmodified)' '\n+test_expect_success DATE_PARSER 'modification: snapshot if-modified-since (unmodified)' '\n \texport HTTP_IF_MODIFIED_SINCE=\"Thu, 7 Apr 2005 22:14:13 +0000\" &&\n \ttest_when_finished \"unset HTTP_IF_MODIFIED_SINCE\" &&\n \tgitweb_run \"p=.git;a=snapshot;h=master;sf=tgz\" &&\n@@ -161,7 +168,7 @@ test_expect_success 'modification: snapshot if-modified-since (unmodified)' '\n '\n test_debug 'cat gitweb.headers'\n \n-test_expect_success 'modification: tree snapshot' '\n+test_expect_success DATE_PARSER 'modification: tree snapshot' '\n \tID=`git rev-parse --verify HEAD^{tree}` &&\n \texport HTTP_IF_MODIFIED_SINCE=\"Wed, 6 Apr 2005 22:14:13 +0000\" &&\n \ttest_when_finished \"unset HTTP_IF_MODIFIED_SINCE\" &&\n-- \n1.7.10\n"}]}