1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#!/usr/bin/perl -w
# Duncan Findlay
# Remove regression tests from the rules to a separate file, so they
# aren't included with the default config (somewhat useless!)
my $num_tests = 0;
my @files = <./*.cf>;
open (TESTS, ">> regression_tests.cf");
foreach my $file (@files) {
if ($file =~ /regression_tests\.cf/) {
next;
}
rename "$file", "$file.bak" or die "Can't rename: $!";
open IN, "$file.bak";
open OUT, ">>$file";
while (<IN>) {
if (/^test/) {
print TESTS $_;
$num_tests++;
} else {
print OUT $_;
}
};
close IN;
close OUT;
unlink "$file.bak" or die "Can't delete: $!";
}
close TESTS;
print "All done! $num_tests moved.\n";
|