3 # This script scans the directories of Exim test scripts and lists the first
4 # comment line of each one, which gives a description. The output is piped via
5 # "more". If the script has an argument, it is a pattern that is used to select
6 # only certain subdirectories. If the script has a second argument, it is a
7 # pattern that is used to select only certain test titles from the selected
10 /usr/bin/perl -w - "$1" "$2" <<'PerlEnd' | less
15 opendir(SCRIPTS, "scripts") || die "** Failed to opendir(SCRIPTS): $!\n";
16 @subdirs = readdir(SCRIPTS);
19 foreach $subdir (sort @subdirs)
23 next if $subdir =~ /^\./;
24 next if $dirpat ne "" && $subdir !~ /$dirpat/i;
26 opendir(TESTS, "scripts/$subdir") ||
27 die "** Failed to opendir(scripts/$subdir): $!\n";
28 @tests = readdir(TESTS);
31 foreach $file (sort @tests)
33 next if $file !~ /^\d\d\d\d$/;
35 open(IN, "scripts/$subdir/$file") ||
36 die "** Failed to open scripts/$subdir/$file: $!\n";
37 my($heading) = substr(<IN>, 2);
40 if ($filpat eq "" || $heading =~ /$filpat/i)
44 print "\n=== $subdir ===\n";
45 if (open(REQUIRES, "scripts/$subdir/REQUIRES"))
48 print "=== Requires: ";
54 print "\n" if $indent eq "";
59 printf("%s/%s %s", (substr $subdir, 5), $file, $heading);