You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2008/12/29 13:32:37 UTC

svn commit: r729884 - /spamassassin/trunk/t.rules/run

Author: jm
Date: Mon Dec 29 04:32:37 2008
New Revision: 729884

URL: http://svn.apache.org/viewvc?rev=729884&view=rev
Log:
improve usage for the t.rules test suite runner

Modified:
    spamassassin/trunk/t.rules/run

Modified: spamassassin/trunk/t.rules/run
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t.rules/run?rev=729884&r1=729883&r2=729884&view=diff
==============================================================================
--- spamassassin/trunk/t.rules/run (original)
+++ spamassassin/trunk/t.rules/run Mon Dec 29 04:32:37 2008
@@ -1,9 +1,19 @@
 #!/usr/bin/perl
 #
-# usage: t.rules/run [--verbose] [--tests=BOUNCE_MESSAGE,FOO,BAR] [file ...]
-#
 # TODO: Generate TAP output
 
+sub usage {
+  die "
+usage: t.rules/run [options] [file_or_dir ...]
+
+options:
+--verbose       Verbose output
+--tests=BOUNCE_MESSAGE,FOO,BAR   
+                Select tests to run, instead of selecting from
+                the specified files/dirs
+  ";
+}
+
 use strict;
 use warnings;
 
@@ -20,7 +30,7 @@
   'tests|t=s' => \$opt{'tests'},
   'verbose|v' => \$opt{'verbose'},
   'debug|D' => \$opt{'debug'},
-);
+) or usage();
 
 my $spamtest;
 my $lastconfigtext = '';
@@ -36,7 +46,13 @@
 my $testsfailed = 0;
 if (@ARGV) {
   foreach my $f (@ARGV) {
-    test_msg($f, $1);
+    if (-d $f) {    # recurse down 1 level
+      foreach my $subf (<$f/*>) {
+        test_msg($subf);
+      }
+    } else {        # files directly
+      test_msg($f);
+    }
   }
 } else {
   main();