[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, master, updated. 2.5.2-15-gc900b8d



The following commit has been merged in the master branch:
commit c900b8d319048ef5879d644df5dfed3ff49ca60f
Author: Niels Thykier <niels@thykier.net>
Date:   Sat Aug 13 22:26:09 2011 +0200

    t/runtests: Support "suite:<s>[,...<s>]" to choose test suite
    
    If the new test suite is passed "suite:<list>" it will take
    <list> as a comma-separated list of suite names and run all
    tests in those suites.  I.e.
    
     $ debian/runles runtests onlyrun=suite:scripts,debs
    
    will run all the "scripts" (unit tests) and the "debs"
    (hand-crafted binaries) tests.

diff --git a/t/runtests b/t/runtests
index 227886f..077fa41 100755
--- a/t/runtests
+++ b/t/runtests
@@ -38,6 +38,8 @@ use Data::Dumper;
 use Getopt::Long qw(GetOptions);
 use Text::Template;
 
+use constant SUITES => qw(scripts changes debs source tests);
+
 BEGIN {
     my $LINTIAN_ROOT = $ENV{'LINTIAN_ROOT'};
     if (not $LINTIAN_ROOT) {
@@ -179,12 +181,29 @@ my $status :shared = 0;
 # anything.
 my $tests_run = 0;
 
+my %suites = ();
+
 my @tests;
 my $prev;
 
 my $q = Thread::Queue->new();
 our $MSG_Q = Thread::Queue->new();
 
+if ($singletest && $singletest =~ m/^suite:(.++)/) {
+    my $list = $1;
+    %suites = ();
+    foreach my $s (split m/\s*+,\s*+/, $list) {
+	$suites{$s} = 1;
+    }
+    # clear singletest to avoid find a "single" test.
+    $singletest = '';
+} else {
+    # run / check all of them
+    foreach my $s (SUITES) {
+	$suites{$s} = 1;
+    }
+}
+
 sub msg_flush;
 sub msg_print;
 sub msg_queue_handler;
@@ -199,7 +218,7 @@ if ($singletest) {
     if (-f $script) {
 	@tests = ($script);
     }
-} elsif (not $tag) {
+} elsif (! $tag && $suites{'scripts'}) {
     unless (-d "$TESTSET/scripts") {
 	fail("cannot find $TESTSET/scripts: $!");
     }
@@ -230,7 +249,7 @@ if ($singletest) {
     }
 } elsif ($tag) {
     @tests = find_tests_for_tag($tag, "$TESTSET/changes/*.desc");
-} else {
+} elsif ($suites{'changes'}) {
     unless (-d "$TESTSET/changes") {
 	fail("cannot find $TESTSET/changes: $!");
     }
@@ -259,7 +278,7 @@ foreach my $tsi (['debs', "$TESTSET/debs/*/desc", sub { generic_test_runner('deb
 	}
     } elsif ($tag) {
 	@tests = find_tests_for_tag($tag, $globstr);
-    } else {
+    } elsif ($suites{$tdir}) {
 	unless (-d "$TESTSET/$tdir/") {
 	    fail("cannot find $TESTSET/$tdir: $!");
 	}

-- 
Debian package checker


Reply to: