aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatthew <matthew>2009-07-15 20:51:21 +0000
committermatthew <matthew>2009-07-15 20:51:21 +0000
commit3a66facfc1c39c19d4e53cdfacaa433a45e44d52 (patch)
treeb9b94bc3d0fefa60870354b8b8225fc08e97ab7f
parent217fb0207d32dd96b1960d93470a065ffcf6df7c (diff)
Add error test script.
-rwxr-xr-xbin/test-run4
-rwxr-xr-xweb/test.cgi25
2 files changed, 27 insertions, 2 deletions
diff --git a/bin/test-run b/bin/test-run
index a91d34d0e..a49bea8c0 100755
--- a/bin/test-run
+++ b/bin/test-run
@@ -19,7 +19,7 @@
# RSS
# Whatever I've missed!
-my $rcsid = ''; $rcsid .= '$Id: test-run,v 1.1 2009-07-15 20:13:51 matthew Exp $';
+my $rcsid = ''; $rcsid .= '$Id: test-run,v 1.2 2009-07-15 20:51:21 matthew Exp $';
use strict;
require 5.8.0;
@@ -122,7 +122,7 @@ $wth->browser_set_validator("/usr/bin/validate");
# Setup error log watching
$wth->log_watcher_setup($httpd_error_log);
-$wth->log_watcher_self_test($base_url . "/test.php?error=1", "deliberate_error_to_test_error_handling");
+$wth->log_watcher_self_test($base_url . "/test.cgi?error=1", "deliberate_error_to_test_error_handling");
# Run the reports
foreach (keys %action) {
diff --git a/web/test.cgi b/web/test.cgi
new file mode 100755
index 000000000..c9b36e6b7
--- /dev/null
+++ b/web/test.cgi
@@ -0,0 +1,25 @@
+#!/usr/bin/perl -w -I../perllib
+
+# test.cgi
+# Part of test suite to force an error to check error handling works.
+#
+# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
+# Email: matthew@mysociety.org. WWW: http://www.mysociety.org
+#
+# $Id: test.cgi,v 1.1 2009-07-15 20:51:21 matthew Exp $
+
+use strict;
+use Standard;
+
+sub main {
+ my $q = shift;
+
+ print $q->header(-charset => 'utf-8', -content_type => 'text/plain');
+ if ($q->param('error')) {
+ print 10 / 0; # Cause an error by dividing by zero.
+ }
+ print "Success";
+}
+
+Page::do_fastcgi(\&main);
+