Commit 24a0df94 authored by zach%zachlipton.com's avatar zach%zachlipton.com

Additional fix for bug 112914: "Test should not `cat $file`" Previous

patch fixed the problem, but this patch stops once it finds strict so it will not take as long to run. Patch by ddkilzer@theracingworld.com. R=zach@zachlipton.com though review is not required for tests.
parent ba971860
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
# #
# Contributor(s): Zach Lipton <zach@zachlipton.com> # Contributor(s): Zach Lipton <zach@zachlipton.com>
# Jacob Steenhagen <jake@acutex.net> # Jacob Steenhagen <jake@acutex.net>
# David D. Kilzer <ddkilzer@theracingworld.com>
# #
# Alternatively, the contents of this file may be used under the # Alternatively, the contents of this file may be used under the
# terms of the GNU General Public License Version 2 or later (the # terms of the GNU General Public License Version 2 or later (the
...@@ -47,37 +48,44 @@ use strict; ...@@ -47,37 +48,44 @@ use strict;
my @testitems = @Support::Files::testitems; # get the files to test. my @testitems = @Support::Files::testitems; # get the files to test.
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)
next if (!$file); # skip null entries next if (!$file); # skip null entries
open (FILE, $file); if (! open (FILE, $file)) {
my @file = <FILE>; ok(0,"could not open $file --WARNING");
close (FILE); }
if ($file[0] !~ /\/usr\/bonsaitools\/bin\/perl/) { my $file_line1 = <FILE>;
ok(1,"$file does not have a shebang"); close (FILE);
next; if ($file_line1 !~ /\/usr\/bonsaitools\/bin\/perl/) {
ok(1,"$file does not have a shebang");
} else {
if ($file_line1 =~ m#/usr/bonsaitools/bin/perl -w#) {
ok(1,"$file uses -w");
} else { } else {
if ($file[0] =~ m#/usr/bonsaitools/bin/perl -w#) { ok(0,"$file is MISSING -w --WARNING");
ok(1,"$file uses -w");
next;
} else {
ok(0,"$file is MISSING -w --WARNING");
next;
}
} }
}
} }
foreach my $file (@testitems) { foreach my $file (@testitems) {
$file =~ s/\s.*$//; # nuke everything after the first space (#comment) my $found_use_strict = 0;
next if (!$file); # skip null entries $file =~ s/\s.*$//; # nuke everything after the first space (#comment)
open (FILE, $file); next if (!$file); # skip null entries
my @file = <FILE>; if (! open (FILE, $file)) {
close (FILE); ok(0,"could not open $file --WARNING");
if (grep /^\s*use strict/, @file) { next;
ok(1,"$file uses strict"); }
} else { while (my $file_line = <FILE>) {
ok(0,"$file DOES NOT use strict --WARNING"); if ($file_line =~ m/^\s*use strict/) {
$found_use_strict = 1;
last;
} }
}
close (FILE);
if ($found_use_strict) {
ok(1,"$file uses strict");
} else {
ok(0,"$file DOES NOT use strict --WARNING");
}
} }
exit 0;
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