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

[SCM] Debian package checker branch, master, updated. 2.3.3-62-g61f1ef5



The following commit has been merged in the master branch:
commit 61f1ef54bb07739d5a55687eaaac11f814b2df5a
Author: Raphael Geissert <atomo64@gmail.com>
Date:   Sun Mar 21 13:34:04 2010 -0600

    Add support for To-Do test cases to t/runtests
    
    * t/runtests:
      + [RG] Add support for To-Do tests.

diff --git a/debian/changelog b/debian/changelog
index f8afb8e..68855fc 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -126,6 +126,7 @@ lintian (2.3.4) UNRELEASED; urgency=low
 
   * t/runtests:
     + [RG] Add support for architecture-specific tests.
+    + [RG] Add support for To-Do tests.
   * t/tests/binaries-multiarch/:
     + [RG] Fix test failure in non-i386 architectures by normalising the
       expected output.  Thanks, Niko Tyni.  (Closes: #568680)
diff --git a/doc/desc-files b/doc/desc-files
index 789c7a8..47d2009 100644
--- a/doc/desc-files
+++ b/doc/desc-files
@@ -46,3 +46,4 @@ Description record of a test case:
   [ Standards-Version: <standard version for control> ]
   [ Options: <options to pass to lintian> ]
   [ Skeleton: <skeleton to base the package on> ]
+  [ Todo: <yes | no> ]
diff --git a/t/runtests b/t/runtests
index 5974902..3af9d08 100755
--- a/t/runtests
+++ b/t/runtests
@@ -479,9 +479,14 @@ sub test_package {
     if ($testok) {
 	print "ok.\n";
     } else {
-	print "FAILED:\n";
-	runsystem_ok("diff", "-u", "$origdir/tags", "$RUNDIR/tags.$pkg");
-	return;
+	if ($testdata->{'todo'} eq 'yes') {
+	    print "TODO\n";
+	    return 1;
+	} else {
+	    print "FAILED:\n";
+	    runsystem_ok("diff", "-u", "$origdir/tags", "$RUNDIR/tags.$pkg");
+	    return;
+	}
     }
 
     # Check the output for invalid lines.  Also verify that all Test-For tags
@@ -491,20 +496,27 @@ sub test_package {
     my %test_for = map { $_ => 1 } split(' ', $testdata->{'test-for'});
     my %test_against = map { $_ => 1 } split(' ', $testdata->{'test-against'});
     if (not %test_for and not %test_against and not $testdata->{sort}) {
-	return 1;
+	if ($testdata->{'todo'} eq 'yes') {
+	    print "E: marked as TODO but succeeded.\n";
+	    return;
+	} else {
+	    return 1;
+	}
     } else {
 	my $okay = 1;
 	open TAGS, "$RUNDIR/tags.$pkg" or fail("Cannot open $RUNDIR/tags.$pkg");
 	while (<TAGS>) {
 		next if m/^N: /;
 		if (not /^(.): (\S+)(?: (?:source|udeb))?: (\S+)/) {
-		    print "E: Invalid line:\n$_";
+		    print (($testdata->{'todo'} eq 'yes')? "TODO" : "E");
+		    print ": Invalid line:\n$_";
 		    $okay = 0;
 		    next;
 		}
 		my $tag = $3;
 		if ($test_against{$tag}) {
-		    print "E: Tag $tag seen but listed in Test-Against\n";
+		    print (($testdata->{'todo'} eq 'yes')? "TODO" : "E");
+		    print ": Tag $tag seen but listed in Test-Against\n";
 		    $okay = 0;
 		}
 		delete $test_for{$tag};
@@ -512,12 +524,17 @@ sub test_package {
 	close TAGS;
 	if (%test_for) {
 		for my $tag (sort keys %test_for) {
-		    print "E: Tag $tag listed in Test-For but not found\n";
+		    print (($testdata->{'todo'} eq 'yes')? "TODO" : "E");
+		    print ": Tag $tag listed in Test-For but not found\n";
 		    $okay = 0;
 		}
 	}
-	return 1 if $okay;
-	return;
+	if ($okay && $testdata->{'todo'} eq 'yes') {
+	    print "E: marked as TODO but succeeded.\n";
+	    return;
+	} else {
+	    return ($okay || $testdata->{'todo'} eq 'yes');
+	}
     }
 }
 
@@ -757,6 +774,7 @@ sub check_test_is_sane {
 
     $data->{skeleton} ||= 'skel';
     $data->{options} ||= '-I -E';
+    $data->{todo} ||= 'no';
 
     # Unwrap the options in case we used continuation lines.
     $data->{options} =~ s/\n//g;
diff --git a/t/tests/README b/t/tests/README
index 8e79bc1..f951a28 100644
--- a/t/tests/README
+++ b/t/tests/README
@@ -88,6 +88,17 @@ the test case as a non-native package, add:
 to the .desc file.  You will also want to change the version number to
 be non-native unless you're testing a mismatch.
 
+There are times when one wants to add a test for something that needs
+to be done.  To mark it as such, preventing the test suite from
+failing, use:
+
+    Todo: yes
+
+Test cases marked as Todo will suceed if they fail _the testing step_
+and fail if they suceed.  Although this option can be very useful to
+document what needs to be done, the ideal situation is to have none of
+them :)
+
 Unless you're writing a test case just to improve Lintian's test coverage,
 you will normally want to add a References field giving the source of the
 test or the bug that you're testing for.  This should be one of "Debian
diff --git a/t/tests/runtests-todo-test-for/debian/debian/install b/t/tests/runtests-todo-test-for/debian/debian/install
new file mode 100644
index 0000000..7707533
--- /dev/null
+++ b/t/tests/runtests-todo-test-for/debian/debian/install
@@ -0,0 +1 @@
+dummy usr/share/lintian/
diff --git a/t/tests/runtests-todo-test-for/debian/dummy b/t/tests/runtests-todo-test-for/debian/dummy
new file mode 100644
index 0000000..b60941c
--- /dev/null
+++ b/t/tests/runtests-todo-test-for/debian/dummy
@@ -0,0 +1 @@
+hello lintian!
diff --git a/t/tests/runtests-todo-test-for/desc b/t/tests/runtests-todo-test-for/desc
new file mode 100644
index 0000000..23662b2
--- /dev/null
+++ b/t/tests/runtests-todo-test-for/desc
@@ -0,0 +1,6 @@
+Testname: runtests-todo-test-for
+Sequence: 0700
+Version: 1.0
+Todo: yes
+Description: Test todo tests support
+Test-For: lintian-easter-egg
diff --git a/t/debs/deb-format-record-size/tags b/t/tests/runtests-todo-test-for/tags
similarity index 100%
copy from t/debs/deb-format-record-size/tags
copy to t/tests/runtests-todo-test-for/tags
diff --git a/t/tests/runtests-todo/debian/debian/install b/t/tests/runtests-todo/debian/debian/install
new file mode 100644
index 0000000..7707533
--- /dev/null
+++ b/t/tests/runtests-todo/debian/debian/install
@@ -0,0 +1 @@
+dummy usr/share/lintian/
diff --git a/t/tests/runtests-todo/debian/dummy b/t/tests/runtests-todo/debian/dummy
new file mode 100644
index 0000000..b60941c
--- /dev/null
+++ b/t/tests/runtests-todo/debian/dummy
@@ -0,0 +1 @@
+hello lintian!
diff --git a/t/tests/runtests-todo/desc b/t/tests/runtests-todo/desc
new file mode 100644
index 0000000..cf441a9
--- /dev/null
+++ b/t/tests/runtests-todo/desc
@@ -0,0 +1,5 @@
+Testname: runtests-todo
+Sequence: 0700
+Version: 1.0
+Todo: yes
+Description: Test todo tests support
diff --git a/t/tests/runtests-todo/tags b/t/tests/runtests-todo/tags
new file mode 100644
index 0000000..5f3c9af
--- /dev/null
+++ b/t/tests/runtests-todo/tags
@@ -0,0 +1 @@
+E: runtests-todo source: lintian-says-hi ;)

-- 
Debian package checker


Reply to: