summaryrefslogtreecommitdiffstats
path: root/testserver.pl
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2011-08-17 13:18:47 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2011-08-17 13:18:47 +0200
commit45a4eea5b94d5a90aa83014c51366d42c39ed746 (patch)
tree246c8c9a9e038fd40872601a852422cee8039fc3 /testserver.pl
parent589632e9d5d35c25c932aafa164feb92c26f5e3d (diff)
downloadbugzilla-45a4eea5b94d5a90aa83014c51366d42c39ed746.tar.gz
bugzilla-45a4eea5b94d5a90aa83014c51366d42c39ed746.tar.xz
Bug 662070: Use say() instead of print() where appropriate
r=glob a=LpSolit
Diffstat (limited to 'testserver.pl')
-rwxr-xr-xtestserver.pl63
1 files changed, 32 insertions, 31 deletions
diff --git a/testserver.pl b/testserver.pl
index 3142685bc..c845aa493 100755
--- a/testserver.pl
+++ b/testserver.pl
@@ -23,6 +23,7 @@ use lib qw(. lib);
use Bugzilla;
use Bugzilla::Constants;
+use Bugzilla::Util qw(say);
use Socket;
@@ -33,8 +34,8 @@ my $lwp = $@ ? 0 : 1;
if ((@ARGV != 1) || ($ARGV[0] !~ /^https?:/))
{
- print "Usage: $0 <URL to this Bugzilla installation>\n";
- print "e.g.: $0 http://www.mycompany.com/bugzilla\n";
+ say "Usage: $0 <URL to this Bugzilla installation>";
+ say "e.g.: $0 http://www.mycompany.com/bugzilla";
exit(1);
}
@@ -67,26 +68,26 @@ else {
# Check $webservergroup against the server's GID
if ($sgid > 0) {
if ($webservergroup eq "") {
- print
+ say
"WARNING \$webservergroup is set to an empty string.
That is a very insecure practice. Please refer to the
-Bugzilla documentation.\n";
+Bugzilla documentation.";
}
elsif ($webgroupnum == $sgid || Bugzilla->localconfig->{use_suexec}) {
- print "TEST-OK Webserver is running under group id in \$webservergroup.\n";
+ say "TEST-OK Webserver is running under group id in \$webservergroup.";
}
else {
- print
+ say
"TEST-WARNING Webserver is running under group id not matching \$webservergroup.
This if the tests below fail, this is probably the problem.
Please refer to the web server configuration section of the Bugzilla guide.
-If you are using virtual hosts or suexec, this warning may not apply.\n";
+If you are using virtual hosts or suexec, this warning may not apply.";
}
}
elsif (!ON_WINDOWS) {
- print
+ say
"TEST-WARNING Failed to find the GID for the 'httpd' process, unable
-to validate webservergroup.\n";
+to validate webservergroup.";
}
@@ -94,26 +95,26 @@ to validate webservergroup.\n";
$ARGV[0] =~ s/\/$//;
my $url = $ARGV[0] . "/images/padlock.png";
if (fetch($url)) {
- print "TEST-OK Got padlock picture.\n";
+ say "TEST-OK Got padlock picture.";
} else {
- print
+ say
"TEST-FAILED Fetch of images/padlock.png failed
Your web server could not fetch $url.
-Check your web server configuration and try again.\n";
+Check your web server configuration and try again.";
exit(1);
}
# Try to execute a cgi script
my $response = fetch($ARGV[0] . "/testagent.cgi");
if ($response =~ /^OK (.*)$/) {
- print "TEST-OK Webserver is executing CGIs via $1.\n";
+ say "TEST-OK Webserver is executing CGIs via $1.";
} elsif ($response =~ /^#!/) {
- print
+ say
"TEST-FAILED Webserver is fetching rather than executing CGI files.
-Check the AddHandler statement in your httpd.conf file.\n";
+Check the AddHandler statement in your httpd.conf file.";
exit(1);
} else {
- print "TEST-FAILED Webserver is not executing CGI files.\n";
+ say "TEST-FAILED Webserver is not executing CGI files.";
}
# Make sure that the web server is honoring .htaccess files
@@ -122,13 +123,13 @@ $localconfig =~ s~^\./~~;
$url = $ARGV[0] . "/$localconfig";
$response = fetch($url);
if ($response) {
- print
+ say
"TEST-FAILED Webserver is permitting fetch of $url.
This is a serious security problem.
-Check your web server configuration.\n";
+Check your web server configuration.";
exit(1);
} else {
- print "TEST-OK Webserver is preventing fetch of $url.\n";
+ say "TEST-OK Webserver is preventing fetch of $url.";
}
# Test chart generation
@@ -142,8 +143,8 @@ if ($@ eq '') {
my $gdlib = `gdlib-config --version 2>&1` || "";
$gdlib =~ s/\n$//;
if (!$gdlib) {
- print "TEST-WARNING Failed to run gdlib-config; can't compare " .
- "GD versions.\n";
+ say "TEST-WARNING Failed to run gdlib-config; can't compare " .
+ "GD versions.";
}
else {
my $gd = $GD::VERSION;
@@ -154,9 +155,9 @@ if ($@ eq '') {
$gd =~ s/^([^\.]+)\..*/$1/;
if ($gdlib == $gd) {
- print "TEST-OK $verstring; Major versions match.\n";
+ say "TEST-OK $verstring; Major versions match.";
} else {
- print "TEST-FAILED $verstring; Major versions do not match.\n";
+ say "TEST-FAILED $verstring; Major versions do not match.";
}
}
}
@@ -177,17 +178,17 @@ if ($@ eq '') {
create_file("$datadir/testgd-local.png", $image->png);
check_image("$datadir/testgd-local.png", 'GD');
} else {
- print "TEST-FAILED GD doesn't support PNG generation.\n";
+ say "TEST-FAILED GD doesn't support PNG generation.";
}
};
if ($@ ne '') {
- print "TEST-FAILED GD returned: $@\n";
+ say "TEST-FAILED GD returned: $@";
}
# Test Chart
eval 'use Chart::Lines';
if ($@) {
- print "TEST-FAILED Chart::Lines is not installed.\n";
+ say "TEST-FAILED Chart::Lines is not installed.";
} else {
eval {
my $chart = Chart::Lines->new(400, 400);
@@ -199,16 +200,16 @@ if ($@ eq '') {
check_image("$datadir/testchart-local.png", "Chart");
};
if ($@ ne '') {
- print "TEST-FAILED Chart returned: $@\n";
+ say "TEST-FAILED Chart returned: $@";
}
}
eval 'use Template::Plugin::GD::Image';
if ($@) {
- print "TEST-FAILED Template::Plugin::GD is not installed.\n";
+ say "TEST-FAILED Template::Plugin::GD is not installed.";
}
else {
- print "TEST-OK Template::Plugin::GD is installed.\n";
+ say "TEST-OK Template::Plugin::GD is installed.";
}
}
@@ -262,10 +263,10 @@ sub check_image {
my ($local_file, $library) = @_;
my $filedata = read_file($local_file);
if ($filedata =~ /^\x89\x50\x4E\x47\x0D\x0A\x1A\x0A/) {
- print "TEST-OK $library library generated a good PNG image.\n";
+ say "TEST-OK $library library generated a good PNG image.";
unlink $local_file;
} else {
- print "TEST-WARNING $library library did not generate a good PNG.\n";
+ say "TEST-WARNING $library library did not generate a good PNG.";
}
}