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