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

[SCM] Debian package checker branch, master, updated. 2.5.11-91-g4fab7f8



The following commit has been merged in the master branch:
commit 4fab7f84ba8d17f91f9e79a00a6b6e7272608e99
Author: Nicolas Boulenguez <nicolas@debian.org>
Date:   Tue Jan 22 11:59:21 2013 +0100

    c/testsuite{,.desc}: New check to test for autopkgtest mistakes
    
    [nthykier: add test cases for the check]
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/checks/testsuite b/checks/testsuite
new file mode 100644
index 0000000..db8ced2
--- /dev/null
+++ b/checks/testsuite
@@ -0,0 +1,54 @@
+# testsuite -- lintian check script -*- perl -*-
+
+# Copyright (C) 2013 Nicolas Boulenguez <nicolas@debian.org>
+
+# This file is part of lintian.
+
+# Lintian is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# Lintian is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with Lintian.  If not, see <http://www.gnu.org/licenses/>.
+
+package Lintian::testsuite;
+
+use strict;
+use warnings;
+
+use Lintian::Tags qw(tag);
+use Lintian::Util qw(file_is_encoded_in_non_utf8);
+
+sub run {
+    my ($pkg, $type, $info) = @_;
+
+    my $testsuite = $info->field ('testsuite');
+    my $control = $info->index ('debian/tests/control');
+
+    if (defined $testsuite xor defined $control) {
+        tag 'inconsistent-testsuite-field';
+    }
+    if (defined $testsuite and $testsuite ne 'autopkgtest') {
+        tag 'unknown-testsuite', $testsuite;
+    }
+    if (defined $control) {
+        if (not $control->is_regular_file) {
+            tag 'debian-tests-control-is-not-a-regular-file';
+        } else {
+            my $path = $info->unpacked ($control->name);
+
+            my $not_utf8_line = file_is_encoded_in_non_utf8 ($path, $type, $pkg);
+            if ($not_utf8_line) {
+                tag 'debian-tests-control-uses-national-encoding', "at line $not_utf8_line";
+            }
+        }
+    }
+}
+
+1;
diff --git a/checks/testsuite.desc b/checks/testsuite.desc
new file mode 100644
index 0000000..0210fae
--- /dev/null
+++ b/checks/testsuite.desc
@@ -0,0 +1,44 @@
+Check-Script: testsuite
+Author: Nicolas Boulenguez <nicolas@debian.org>
+Type: source
+Needs-Info: index, unpacked
+Info: This script checks the Testsuite field in package dsc files,
+ and debian/tests/control if any.
+
+Tag: debian-tests-control-is-not-a-regular-file
+Severity: wishlist
+Certainty: certain
+Info: In case the dsc file contains a Testsuite field, "debian/tests"
+ must be a directory and contain a "control" regular file.
+
+Tag: debian-tests-control-uses-national-encoding
+Severity: normal
+Certainty: certain
+Info: The debian/tests/control file should be valid UTF-8, an encoding
+ of the Unicode character set.
+ .
+ There are many ways to convert a file from an encoding like
+ ISO-8859-1; you may for example use "iconv" like:
+ .
+  $ iconv -f ISO-8859-1 -t UTF-8 file &gt; file.new
+  $ mv file.new file
+
+Tag: inconsistent-testsuite-field
+Severity: wishlist
+Certainty: certain
+Info: The package provides a debian/tests/control file but no
+ Testsuite field in the dsc file, or the field exists but not the
+ file.
+ .
+ For discoverability, packages shipping tests for the autopkgtest
+ testing framework should declare their presence in the package
+ dsc file by adding "XS-Testsuite: autopkgtest" to their debian/control.
+Ref: http://anonscm.debian.org/gitweb/?p=autopkgtest/autopkgtest.git;a=blob_plain;f=doc/README.package-tests;hb=HEAD
+
+Tag: unknown-testsuite
+Severity: normal
+Certainty: certain
+Info: The dsc file sets Testsuite to a value other than autopkgtest,
+ the only one allowed. This field is most probably copied by
+ dpkg-source from XS-Testsuite in debian/control.
+Ref: http://anonscm.debian.org/gitweb/?p=autopkgtest/autopkgtest.git;a=blob_plain;f=doc/README.package-tests;hb=HEAD
diff --git a/data/common/source-fields b/data/common/source-fields
index 17ed60c..334a1be 100644
--- a/data/common/source-fields
+++ b/data/common/source-fields
@@ -23,6 +23,7 @@ python-version
 ruby-versions
 source
 standards-version
+testsuite
 uploaders
 vcs-arch
 vcs-browser
diff --git a/debian/changelog b/debian/changelog
index 71013c2..a6fcd83 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,14 +4,18 @@ lintian (2.5.12) UNRELEASED; urgency=low
     + Added:
       - ambiguous-paragraph-in-dep5-copyright
       - binary-file-built-without-LFS-support
+      - debian-tests-control-is-not-a-regular-file
+      - debian-tests-control-uses-national-encoding
       - debug-file-with-no-debug-symbols
       - desktop-entry-lacks-keywords-entry
       - dir-or-file-in-build-tree
       - dir-or-file-in-etc-opt
       - dir-or-file-in-home
+      - inconsistent-testsuite-field
       - license-problem-gfdl-invariants
       - menu-icon-uses-relative-path
       - package-contains-broken-symlink-wildcard
+      - unknown-testsuite
       - vcs-field-bitrotted
       - vcs-git-uses-invalid-user-uri
     + Removed:
@@ -76,6 +80,9 @@ lintian (2.5.12) UNRELEASED; urgency=low
       in their target.  This is usually a sign that a wildcard did
       not properly expand.  Thanks to Bernd Zeimetz for the report.
       (Closes: #683737)
+  * checks/testsuite{,.desc}:
+    + [NT] New check written by Nicolas Boulenguez to catch some
+      mistakes with the new autopkgtest tests.
 
   * collection/hardening-info{,-helper,.desc}:
     + [NT] Whitelist "memset" and "memmove" as "always safe"
diff --git a/profiles/debian/main.profile b/profiles/debian/main.profile
index c49a0c5..5b6d67f 100644
--- a/profiles/debian/main.profile
+++ b/profiles/debian/main.profile
@@ -7,6 +7,6 @@ Enable-Tags-From-Check: binaries, changelog-file, changes-file, conffiles, contr
  filename-length, files, group-checks, huge-usr-share, infofiles, init.d, java,
  lintian, manpages, md5sums, menu-format, menus, nmu, ocaml, patch-systems,
  po-debconf, rules, scripts, shared-libs, source-copyright, standards-version,
- symlinks, version-substvars, watch-file
+ symlinks, testsuite, version-substvars, watch-file
 Disable-Tags: hardening-no-stackprotector
 
diff --git a/t/tests/testsuite-control-not-file/debian/debian/control.in b/t/tests/testsuite-control-not-file/debian/debian/control.in
new file mode 100644
index 0000000..a7b9673
--- /dev/null
+++ b/t/tests/testsuite-control-not-file/debian/debian/control.in
@@ -0,0 +1,16 @@
+Source: {$srcpkg}
+Priority: extra
+Section: {$section}
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: debhelper (>= 9)
+XS-Testsuite: autopkgtest
+
+Package: {$srcpkg}
+Architecture: {$architecture}
+Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
+Description: {$description}
+ This is a test package designed to exercise some feature or tag of
+ Lintian.  It is part of the Lintian test suite and may do very odd
+ things.  It should not be installed like a regular package.  It may
+ be an empty package.
diff --git a/t/tests/testsuite-control-not-file/desc b/t/tests/testsuite-control-not-file/desc
new file mode 100644
index 0000000..f6ed2dd
--- /dev/null
+++ b/t/tests/testsuite-control-not-file/desc
@@ -0,0 +1,5 @@
+Testname: testsuite-control-not-file
+Sequence: 6000
+Version: 1.0
+Description: Tests for the autopkgtest control being non-file
+Test-For: debian-tests-control-is-not-a-regular-file
diff --git a/t/tests/testsuite-control-not-file/pre_build b/t/tests/testsuite-control-not-file/pre_build
new file mode 100755
index 0000000..274cfa8
--- /dev/null
+++ b/t/tests/testsuite-control-not-file/pre_build
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+set -e
+
+DIR="$1"
+mkdir -p "$DIR/debian/tests"
+mkfifo "$DIR/debian/tests/control"
diff --git a/t/tests/testsuite-control-not-file/tags b/t/tests/testsuite-control-not-file/tags
new file mode 100644
index 0000000..4cc5e56
--- /dev/null
+++ b/t/tests/testsuite-control-not-file/tags
@@ -0,0 +1 @@
+I: testsuite-control-not-file source: debian-tests-control-is-not-a-regular-file
diff --git a/t/tests/testsuite-general/debian/debian/tests/control b/t/tests/testsuite-general/debian/debian/tests/control
new file mode 100644
index 0000000..a44615a
--- /dev/null
+++ b/t/tests/testsuite-general/debian/debian/tests/control
@@ -0,0 +1,2 @@
+Tests: test-1
+Comment: Test-1 is �o good.
diff --git a/t/tests/testsuite-general/debian/debian/tests/test-1 b/t/tests/testsuite-general/debian/debian/tests/test-1
new file mode 100644
index 0000000..039e4d0
--- /dev/null
+++ b/t/tests/testsuite-general/debian/debian/tests/test-1
@@ -0,0 +1,2 @@
+#!/bin/sh
+exit 0
diff --git a/t/tests/testsuite-general/desc b/t/tests/testsuite-general/desc
new file mode 100644
index 0000000..2dceaf6
--- /dev/null
+++ b/t/tests/testsuite-general/desc
@@ -0,0 +1,7 @@
+Testname: testsuite-general
+Sequence: 6000
+Version: 1.0
+Description: General tests of the autopkgtest control file
+Test-For:
+ debian-tests-control-uses-national-encoding
+ inconsistent-testsuite-field
diff --git a/t/tests/testsuite-general/tags b/t/tests/testsuite-general/tags
new file mode 100644
index 0000000..3ac42a4
--- /dev/null
+++ b/t/tests/testsuite-general/tags
@@ -0,0 +1,2 @@
+I: testsuite-general source: inconsistent-testsuite-field
+W: testsuite-general source: debian-tests-control-uses-national-encoding at line 2
diff --git a/t/tests/testsuite-unknown-suite/debian/debian/control.in b/t/tests/testsuite-unknown-suite/debian/debian/control.in
new file mode 100644
index 0000000..5179aac
--- /dev/null
+++ b/t/tests/testsuite-unknown-suite/debian/debian/control.in
@@ -0,0 +1,16 @@
+Source: {$srcpkg}
+Priority: extra
+Section: {$section}
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: debhelper (>= 9)
+XS-Testsuite: autopkgtset
+
+Package: {$srcpkg}
+Architecture: {$architecture}
+Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
+Description: {$description}
+ This is a test package designed to exercise some feature or tag of
+ Lintian.  It is part of the Lintian test suite and may do very odd
+ things.  It should not be installed like a regular package.  It may
+ be an empty package.
diff --git a/t/tests/testsuite-unknown-suite/debian/debian/tests/control b/t/tests/testsuite-unknown-suite/debian/debian/tests/control
new file mode 100644
index 0000000..19e2aee
--- /dev/null
+++ b/t/tests/testsuite-unknown-suite/debian/debian/tests/control
@@ -0,0 +1 @@
+Tests: test-1
diff --git a/t/tests/testsuite-unknown-suite/debian/debian/tests/test-1 b/t/tests/testsuite-unknown-suite/debian/debian/tests/test-1
new file mode 100644
index 0000000..039e4d0
--- /dev/null
+++ b/t/tests/testsuite-unknown-suite/debian/debian/tests/test-1
@@ -0,0 +1,2 @@
+#!/bin/sh
+exit 0
diff --git a/t/tests/testsuite-unknown-suite/desc b/t/tests/testsuite-unknown-suite/desc
new file mode 100644
index 0000000..1c35c5c
--- /dev/null
+++ b/t/tests/testsuite-unknown-suite/desc
@@ -0,0 +1,5 @@
+Testname: testsuite-unknown-suite
+Sequence: 6000
+Version: 1.0
+Description: Tests for unknown suite in the control being non-file
+Test-For: unknown-testsuite
diff --git a/t/tests/testsuite-unknown-suite/tags b/t/tests/testsuite-unknown-suite/tags
new file mode 100644
index 0000000..ff98228
--- /dev/null
+++ b/t/tests/testsuite-unknown-suite/tags
@@ -0,0 +1 @@
+W: testsuite-unknown-suite source: unknown-testsuite autopkgtset

-- 
Debian package checker


Reply to: