3 # $Cambridge: exim/test/listtests,v 1.1 2006/02/06 16:07:10 ph10 Exp $
5 # This script scans the directories of Exim test scripts and lists the first
6 # comment line of each one, which gives a description. The output is piped via
7 # "more". If the script has an argument, it is a pattern that is used to select
8 # only certain subdirectories. If the script has a second argument, it is a
9 # pattern that is used to select only certain test titles from the selected
12 /usr/bin/perl -w - "$1" "$2" <<'PerlEnd' | less
17 opendir(SCRIPTS, "scripts") || die "** Failed to opendir(SCRIPTS): $!\n";
18 @subdirs = readdir(SCRIPTS);
21 foreach $subdir (sort @subdirs)
25 next if $subdir =~ /^\./;
26 next if $dirpat ne "" && $subdir !~ /$dirpat/i;
28 opendir(TESTS, "scripts/$subdir") ||
29 die "** Failed to opendir(scripts/$subdir): $!\n";
30 @tests = readdir(TESTS);
33 foreach $file (sort @tests)
35 next if $file !~ /^\d\d\d\d$/;
37 open(IN, "scripts/$subdir/$file") ||
38 die "** Failed to open scripts/$subdir/$file: $!\n";
39 my($heading) = substr(<IN>, 2);
42 if ($filpat eq "" || $heading =~ /$filpat/i)
46 print "\n=== $subdir ===\n";
47 if (open(REQUIRES, "scripts/$subdir/REQUIRES"))
50 print "=== Requires: ";
56 print "\n" if $indent eq "";
61 printf("%s/%s %s", (substr $subdir, 5), $file, $heading);