Commit 3d46ba59 authored by jake%acutex.net's avatar jake%acutex.net

Don't rely on the TEST_VERBOSE environment variable (no longer exported from…

Don't rely on the TEST_VERBOSE environment variable (no longer exported from runtests.sh) and instead print to the TESTOUT file handle pulled in from Test::More. This will allow the testing backend to check for verbosity rather than having to handle it in the .t files.
parent 1339fc04
#!/bin/sh #!/bin/sh
export TEST_VERBOSE=0 TEST_VERBOSE=0
PART1='use Test::Harness qw(&runtests $verbose); $verbose=' PART1='use Test::Harness qw(&runtests $verbose); $verbose='
PART2='; runtests @ARGV;' PART2='; runtests @ARGV;'
for f in $*; do for f in $*; do
if [ $f == "--verbose" ] ; then if [ $f == "--verbose" ] ; then
export TEST_VERBOSE=1 TEST_VERBOSE=1
fi fi
done done
......
...@@ -45,8 +45,9 @@ use strict; ...@@ -45,8 +45,9 @@ use strict;
# First now we test the scripts # First now we test the scripts
my @testitems = @Support::Files::testitems; my @testitems = @Support::Files::testitems;
#my %warnings; # Capture the TESTERR from Test::More for printing errors.
my $verbose = $::ENV{TEST_VERBOSE}; # This will handle verbosity for us automatically
*TESTOUT = \*Test::More::TESTOUT;
my $perlapp = $^X; my $perlapp = $^X;
foreach my $file (@testitems) { foreach my $file (@testitems) {
...@@ -63,15 +64,14 @@ foreach my $file (@testitems) { ...@@ -63,15 +64,14 @@ foreach my $file (@testitems) {
my $loginfo=`$command`; my $loginfo=`$command`;
#print '@@'.$loginfo.'##'; #print '@@'.$loginfo.'##';
if ($loginfo =~ /syntax ok$/im) { if ($loginfo =~ /syntax ok$/im) {
# $warnings{$_} = 1 foreach ($loginfo =~ /\((W.*?)\)/mg);
if ($loginfo ne "$file syntax OK\n") { if ($loginfo ne "$file syntax OK\n") {
if ($verbose) { print STDERR $loginfo; } print TESTOUT $loginfo;
ok(0,$file."--WARNING"); ok(0,$file."--WARNING");
} else { } else {
ok(1,$file); ok(1,$file);
} }
} else { } else {
if ($verbose) { print STDERR $loginfo; } print TESTOUT $loginfo;
ok(0,$file."--ERROR"); ok(0,$file."--ERROR");
} }
} }
......
...@@ -44,7 +44,6 @@ BEGIN { use Test::More tests => $tests; } ...@@ -44,7 +44,6 @@ BEGIN { use Test::More tests => $tests; }
use strict; use strict;
my @testitems = @Support::Files::testitems; # get the files to test. my @testitems = @Support::Files::testitems; # get the files to test.
my $verbose = $::ENV{TEST_VERBOSE};
foreach my $file (@testitems) { foreach my $file (@testitems) {
$file =~ s/\s.*$//; # nuke everything after the first space (#comment) $file =~ s/\s.*$//; # nuke everything after the first space (#comment)
......
...@@ -44,7 +44,9 @@ BEGIN { use Test::More tests => $tests; } ...@@ -44,7 +44,9 @@ BEGIN { use Test::More tests => $tests; }
use strict; use strict;
my @testitems = @Support::Files::testitems; my @testitems = @Support::Files::testitems;
my $verbose = $::ENV{TEST_VERBOSE}; # Capture the TESTERR from Test::More for printing errors.
# This will handle verbosity for us automatically
*TESTOUT = \*Test::More::TESTOUT;
my $perlapp = $^X; my $perlapp = $^X;
foreach my $file (@testitems) { foreach my $file (@testitems) {
...@@ -54,7 +56,7 @@ foreach my $file (@testitems) { ...@@ -54,7 +56,7 @@ foreach my $file (@testitems) {
my $loginfo=`$command`; my $loginfo=`$command`;
if ($loginfo =~ /arguments for Support::Systemexec::(system|exec)/im) { if ($loginfo =~ /arguments for Support::Systemexec::(system|exec)/im) {
ok(0,"$file DOES NOT use proper system or exec calls"); ok(0,"$file DOES NOT use proper system or exec calls");
if ($verbose) { print STDERR $loginfo; } print TESTOUT $loginfo;
} else { } else {
ok(1,"$file uses proper system and exec calls"); ok(1,"$file uses proper system and exec calls");
} }
......
...@@ -34,7 +34,6 @@ use Template; ...@@ -34,7 +34,6 @@ use Template;
my @testitems = @Support::Templates::testitems; my @testitems = @Support::Templates::testitems;
my $include_path = $Support::Templates::include_path; my $include_path = $Support::Templates::include_path;
my $verbose = $::ENV{TEST_VERBOSE};
# Check to make sure all templates that are referenced in # Check to make sure all templates that are referenced in
# Bugzilla exist in the proper place. # Bugzilla exist in the proper place.
......
...@@ -32,7 +32,6 @@ BEGIN { use Test::More tests => $tests; } ...@@ -32,7 +32,6 @@ BEGIN { use Test::More tests => $tests; }
use strict; use strict;
my @testitems = @Support::Files::testitems; my @testitems = @Support::Files::testitems;
my $verbose = $::ENV{TEST_VERBOSE};
foreach my $file (@testitems) { foreach my $file (@testitems) {
open (FILE, "$file"); open (FILE, "$file");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment