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

Bug#859467: lintian: check if a package contains a functional testsuite using autopkgtest



Package: lintian
Version: 2.5.50.1
Severity: wishlist
Tags: patch

Dear Maintainer,

I wish lintian could notify packages maintainers about the absence of a
functional testsuite using autopkgtest, just as a reminder. It is
important for quality assurance have these kind of tests in all
packages, and I talked about it with some others DDs and some of them do
not have any idea what I was saying. Nowadays, Debian CI covers almost
20% of the source packages in archive, the idea here is to increase this
number.

I attached a patch which I am verifying if the 'Testsuite' is in debian/control
and if this field contains the string 'autopkgtest'. Now we have just
autopkgtest* (with some teams wrappers) available, because of this I am trying
to find this specific string.

The other 2 patches attached try to fix the broken tests after this
modification, the templates used did not have the 'Testsuite' field.

I hope you consider the patches.

Cheers.


-- System Information:
Debian Release: 9.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages lintian depends on:
ii  binutils                          2.28-2
ii  bzip2                             1.0.6-8.1
ii  diffstat                          1.61-1+b1
ii  file                              1:5.29-3
ii  gettext                           0.19.8.1-2
ii  intltool-debian                   0.35.0+20060710.4
ii  libapt-pkg-perl                   0.1.32
ii  libarchive-zip-perl               1.59-1
ii  libclass-accessor-perl            0.34-1
ii  libclone-perl                     0.38-2+b1
ii  libdpkg-perl                      1.18.23
ii  libemail-valid-perl               1.202-1
ii  libfile-basedir-perl              0.07-1
ii  libipc-run-perl                   0.94-1
ii  liblist-moreutils-perl            0.416-1+b1
ii  libparse-debianchangelog-perl     1.2.0-12
ii  libperl5.24 [libdigest-sha-perl]  5.24.1-2
ii  libtext-levenshtein-perl          0.13-1
ii  libtimedate-perl                  2.3000-2
ii  liburi-perl                       1.71-1
ii  libyaml-libyaml-perl              0.63-2
ii  man-db                            2.7.6.1-2
ii  patchutils                        0.3.4-2
ii  perl                              5.24.1-2
ii  t1utils                           1.39-2
ii  xz-utils                          5.2.2-1.2+b1

Versions of packages lintian recommends:
ii  dpkg                                 1.18.23
ii  libperlio-gzip-perl                  0.19-1+b2
ii  perl                                 5.24.1-2
ii  perl-modules-5.24 [libautodie-perl]  5.24.1-2

Versions of packages lintian suggests:
pn  binutils-multiarch     <none>
ii  dpkg-dev               1.18.23
ii  libhtml-parser-perl    3.72-3
ii  libtext-template-perl  1.46-1

-- no debconf information
>From 7571fdf6dccff02733c5b620e8cb85aabb85004f Mon Sep 17 00:00:00 2001
From: Lucas Kanashiro <kanashiro@debian.org>
Date: Mon, 3 Apr 2017 17:21:03 -0300
Subject: [PATCH 2/3] add functional testsuite in tests templates

---
 t/runtests                                      | 2 +-
 t/templates/tests/pedantic/debian/tests/control | 1 +
 t/templates/tests/pedantic/debian/tests/test    | 2 ++
 t/templates/tests/skel/debian/tests/control     | 1 +
 t/templates/tests/skel/debian/tests/test        | 2 ++
 5 files changed, 7 insertions(+), 1 deletion(-)
 create mode 100644 t/templates/tests/pedantic/debian/tests/control
 create mode 100755 t/templates/tests/pedantic/debian/tests/test
 create mode 100644 t/templates/tests/skel/debian/tests/control
 create mode 100755 t/templates/tests/skel/debian/tests/test

diff --git a/t/runtests b/t/runtests
index 020f3f8dc..dd4da7ed2 100755
--- a/t/runtests
+++ b/t/runtests
@@ -113,7 +113,7 @@ my $RUNNER_TS = (stat($0))[9];
 chomp $ARCHITECTURE;
 
 our %TEMPLATES = (
-    'tests'  => ['debian/changelog', 'debian/control', 'debian/compat'],
+    'tests'  => ['debian/changelog', 'debian/control', 'debian/compat', 'debian/tests'],
     'debs'   => ['changelog', 'control', 'Makefile'],
     'source' => ['changelog', 'control', 'dsc.in'],
 );
diff --git a/t/templates/tests/pedantic/debian/tests/control b/t/templates/tests/pedantic/debian/tests/control
new file mode 100644
index 000000000..b8562954d
--- /dev/null
+++ b/t/templates/tests/pedantic/debian/tests/control
@@ -0,0 +1 @@
+Tests: test 
diff --git a/t/templates/tests/pedantic/debian/tests/test b/t/templates/tests/pedantic/debian/tests/test
new file mode 100755
index 000000000..039e4d006
--- /dev/null
+++ b/t/templates/tests/pedantic/debian/tests/test
@@ -0,0 +1,2 @@
+#!/bin/sh
+exit 0
diff --git a/t/templates/tests/skel/debian/tests/control b/t/templates/tests/skel/debian/tests/control
new file mode 100644
index 000000000..b8562954d
--- /dev/null
+++ b/t/templates/tests/skel/debian/tests/control
@@ -0,0 +1 @@
+Tests: test 
diff --git a/t/templates/tests/skel/debian/tests/test b/t/templates/tests/skel/debian/tests/test
new file mode 100755
index 000000000..039e4d006
--- /dev/null
+++ b/t/templates/tests/skel/debian/tests/test
@@ -0,0 +1,2 @@
+#!/bin/sh
+exit 0
-- 
2.11.0

>From 15f4d425368ba4612e3e0ff9cd8796f66e5bcff9 Mon Sep 17 00:00:00 2001
From: Lucas Kanashiro <kanashiro@debian.org>
Date: Mon, 3 Apr 2017 17:23:32 -0300
Subject: [PATCH 3/3] add functional testsuite in source tests

---
 t/runtests                                                 | 2 +-
 t/source/changelog-file-symlink/Makefile                   | 1 +
 t/source/changelog-file-symlink/dsc.in.in                  | 1 +
 t/source/control-field-traversal-2/Makefile                | 1 +
 t/source/control-field-traversal-2/dsc.in.in               | 1 +
 t/source/control-file-duplicate-field/Makefile             | 1 +
 t/source/control-file-duplicate-field/dsc.in.in            | 1 +
 t/source/control-file-missing-separator/Makefile           | 1 +
 t/source/control-file-missing-separator/dsc.in.in          | 1 +
 t/source/control-file-syntax-error/Makefile                | 1 +
 t/source/control-file-syntax-error/dsc.in.in               | 1 +
 t/source/cruft-ancient-file/Makefile                       | 1 +
 t/source/debconf-traversal/Makefile                        | 1 +
 t/source/debconf-traversal/dsc.in.in                       | 1 +
 t/source/debian-source-dir-traversal-1/Makefile            | 1 +
 t/source/debian-source-dir-traversal-1/dsc.in.in           | 1 +
 t/source/debian-source-dir-traversal-2/Makefile            | 1 +
 t/source/debian-source-dir-traversal-2/dsc.in.in           | 1 +
 t/source/debian-source-dir-unknown-source-format/Makefile  | 1 +
 t/source/debian-source-dir-unknown-source-format/dsc.in.in | 1 +
 t/source/debian-symlink/Makefile                           | 1 +
 t/source/debian-symlink/dsc.in.in                          | 1 +
 t/source/fields-src-bad-version/Makefile                   | 1 +
 t/source/fields-src-bad-version/dsc.in.in                  | 1 +
 t/source/fields-src-fields-filename/Makefile               | 1 +
 t/source/fields-src-fields-filename/dsc.in.in              | 1 +
 t/source/magic-architecture-srcpkg-ok/Makefile             | 1 +
 t/source/magic-architecture-srcpkg-wrong/Makefile          | 1 +
 t/source/no-sha256-checksum/Makefile                       | 1 +
 t/source/no-sha256-checksum/dsc.in.in                      | 1 +
 t/source/package-version-0/Makefile                        | 1 +
 t/source/testsuite-inconsistent-field/Makefile             | 4 +---
 t/source/testsuite-inconsistent-field/tags                 | 1 +
 t/source/unpack-srcpkg-dot-dir/Makefile                    | 1 +
 t/source/unpack-srcpkg-dot-subdir/Makefile                 | 1 +
 t/source/unpack-srcpkg-no-subdir/Makefile                  | 1 +
 t/source/unpack-srcpkg-xz/Makefile                         | 1 +
 t/templates/source/skel/tests/control                      | 1 +
 t/templates/source/skel/tests/test                         | 2 ++
 39 files changed, 40 insertions(+), 4 deletions(-)
 create mode 100644 t/templates/source/skel/tests/control
 create mode 100755 t/templates/source/skel/tests/test

diff --git a/t/runtests b/t/runtests
index dd4da7ed2..0599692dc 100755
--- a/t/runtests
+++ b/t/runtests
@@ -115,7 +115,7 @@ chomp $ARCHITECTURE;
 our %TEMPLATES = (
     'tests'  => ['debian/changelog', 'debian/control', 'debian/compat', 'debian/tests'],
     'debs'   => ['changelog', 'control', 'Makefile'],
-    'source' => ['changelog', 'control', 'dsc.in'],
+    'source' => ['changelog', 'control', 'dsc.in', 'tests/control', 'tests/test'],
 );
 my $DATE = safe_qx(qw(date -R));
 chomp $DATE;
diff --git a/t/source/changelog-file-symlink/Makefile b/t/source/changelog-file-symlink/Makefile
index 931b1df7a..5c83bc8d4 100644
--- a/t/source/changelog-file-symlink/Makefile
+++ b/t/source/changelog-file-symlink/Makefile
@@ -5,6 +5,7 @@ all:
 	mkdir $(dir)
 	mkdir $(dir)/debian
 	cp changelog copyright control rules $(dir)/debian/
+	cp -R tests/ $(dir)/debian/
 	mv $(dir)/debian/changelog $(dir)/debian/changelog.old
 	ln -s changelog.old $(dir)/debian/changelog
 	echo $(DEFAULT_DH_COMPAT) > $(dir)/debian/compat
diff --git a/t/source/changelog-file-symlink/dsc.in.in b/t/source/changelog-file-symlink/dsc.in.in
index 98528217d..8166eb684 100644
--- a/t/source/changelog-file-symlink/dsc.in.in
+++ b/t/source/changelog-file-symlink/dsc.in.in
@@ -6,6 +6,7 @@ Version: 1
 Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
 Standards-Version: {$standards_version}
 Build-Depends: debhelper (>= 9)
+Testsuite: autopkgtest
 Checksums-Sha1:
  @SHA1@ @SIZE@ changelog-file-symlink_1.tar.gz
 Checksums-Sha256:
diff --git a/t/source/control-field-traversal-2/Makefile b/t/source/control-field-traversal-2/Makefile
index b2062fce0..5d7b9ef64 100644
--- a/t/source/control-field-traversal-2/Makefile
+++ b/t/source/control-field-traversal-2/Makefile
@@ -5,6 +5,7 @@ all:
 	mkdir $(dir)
 	mkdir $(dir)/debian
 	cp changelog copyright control rules $(dir)/debian/
+	cp -R tests/ $(dir)/debian/
 	echo $(DEFAULT_DH_COMPAT) > $(dir)/debian/compat
 	mkdir $(dir)/debian/source
 	echo 1.0 > $(dir)/debian/source/format
diff --git a/t/source/control-field-traversal-2/dsc.in.in b/t/source/control-field-traversal-2/dsc.in.in
index 6d0587138..004ae8f17 100644
--- a/t/source/control-field-traversal-2/dsc.in.in
+++ b/t/source/control-field-traversal-2/dsc.in.in
@@ -6,6 +6,7 @@ Version: 1
 Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
 Standards-Version: {$standards_version}
 Build-Depends: debhelper (>= 7)
+Testsuite: autopkgtest
 Checksums-Sha1:
  @SHA1@ @SIZE@ control-field-traversal-2_1.tar.gz
 Checksums-Sha256:
diff --git a/t/source/control-file-duplicate-field/Makefile b/t/source/control-file-duplicate-field/Makefile
index f9b5b8f1f..69bf91552 100644
--- a/t/source/control-file-duplicate-field/Makefile
+++ b/t/source/control-file-duplicate-field/Makefile
@@ -5,6 +5,7 @@ all:
 	mkdir $(dir)
 	mkdir $(dir)/debian
 	cp changelog copyright control rules $(dir)/debian/
+	cp -R tests/ $(dir)/debian/
 	echo $(DEFAULT_DH_COMPAT) > $(dir)/debian/compat
 	mkdir $(dir)/debian/source
 	echo 1.0 > $(dir)/debian/source/format
diff --git a/t/source/control-file-duplicate-field/dsc.in.in b/t/source/control-file-duplicate-field/dsc.in.in
index e7bd2d1f2..2fe5c66d6 100644
--- a/t/source/control-file-duplicate-field/dsc.in.in
+++ b/t/source/control-file-duplicate-field/dsc.in.in
@@ -6,6 +6,7 @@ Version: 1
 Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
 Standards-Version: {$standards_version}
 Build-Depends: debhelper (>= 7)
+Testsuite: autopkgtest
 Checksums-Sha1:
  @SHA1@ @SIZE@ control-file-duplicate-field_1.tar.gz
 Checksums-Sha256:
diff --git a/t/source/control-file-missing-separator/Makefile b/t/source/control-file-missing-separator/Makefile
index 2fd3dfe50..f5c854f47 100644
--- a/t/source/control-file-missing-separator/Makefile
+++ b/t/source/control-file-missing-separator/Makefile
@@ -5,6 +5,7 @@ all:
 	mkdir $(dir)
 	mkdir $(dir)/debian
 	cp changelog copyright control rules $(dir)/debian/
+	cp -R tests/ $(dir)/debian/
 	echo $(DEFAULT_DH_COMPAT) > $(dir)/debian/compat
 	mkdir $(dir)/debian/source
 	echo 1.0 > $(dir)/debian/source/format
diff --git a/t/source/control-file-missing-separator/dsc.in.in b/t/source/control-file-missing-separator/dsc.in.in
index e66300ecd..fefc14f7d 100644
--- a/t/source/control-file-missing-separator/dsc.in.in
+++ b/t/source/control-file-missing-separator/dsc.in.in
@@ -6,6 +6,7 @@ Version: 1
 Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
 Standards-Version: {$standards_version}
 Build-Depends: debhelper (>= 7), fiddle [amd64 powerpc mips mipsel hppa s390], faddle (>> 2) [sparc i386 amd64]
+Testsuite: autopkgtest
 Checksums-Sha1:
  @SHA1@ @SIZE@ control-file-missing-separator_1.tar.gz
 Checksums-Sha256:
diff --git a/t/source/control-file-syntax-error/Makefile b/t/source/control-file-syntax-error/Makefile
index 3e08ee003..f133ce1de 100644
--- a/t/source/control-file-syntax-error/Makefile
+++ b/t/source/control-file-syntax-error/Makefile
@@ -5,6 +5,7 @@ all:
 	mkdir $(dir)
 	mkdir $(dir)/debian
 	cp changelog copyright control rules $(dir)/debian/
+	cp -R tests/ $(dir)/debian/
 	echo $(DEFAULT_DH_COMPAT) > $(dir)/debian/compat
 	mkdir $(dir)/debian/source
 	echo 1.0 > $(dir)/debian/source/format
diff --git a/t/source/control-file-syntax-error/dsc.in.in b/t/source/control-file-syntax-error/dsc.in.in
index 8a918f4b9..5894165a8 100644
--- a/t/source/control-file-syntax-error/dsc.in.in
+++ b/t/source/control-file-syntax-error/dsc.in.in
@@ -6,6 +6,7 @@ Version: 1
 Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
 Standards-Version: {$standards_version}
 Build-Depends: debhelper (>= 7)
+Testsuite: autopkgtest
 Checksums-Sha1:
  @SHA1@ @SIZE@ control-file-syntax-error_1.tar.gz
 Checksums-Sha256:
diff --git a/t/source/cruft-ancient-file/Makefile b/t/source/cruft-ancient-file/Makefile
index 584a18f8b..2ce82d725 100644
--- a/t/source/cruft-ancient-file/Makefile
+++ b/t/source/cruft-ancient-file/Makefile
@@ -8,6 +8,7 @@ all:
 	tar -c -f $(name)_1.0.orig.tar.gz -z $(dir)
 	mkdir $(dir)/debian
 	cp changelog copyright control rules $(dir)/debian/
+	cp -R tests/ $(dir)/debian/
 	echo $(DEFAULT_DH_COMPAT) > $(dir)/debian/compat
 	echo '# foo' > $(dir)/debian/watch
 	mkdir $(dir)/debian/source
diff --git a/t/source/debconf-traversal/Makefile b/t/source/debconf-traversal/Makefile
index 91c800a75..e66a1f829 100644
--- a/t/source/debconf-traversal/Makefile
+++ b/t/source/debconf-traversal/Makefile
@@ -5,6 +5,7 @@ all:
 	mkdir $(dir)
 	mkdir $(dir)/debian
 	cp changelog copyright control rules $(dir)/debian/
+	cp -R tests/ $(dir)/debian/
 	echo $(DEFAULT_DH_COMPAT) > $(dir)/debian/compat
 	mkdir $(dir)/debian/source
 	echo 1.0 > $(dir)/debian/source/format
diff --git a/t/source/debconf-traversal/dsc.in.in b/t/source/debconf-traversal/dsc.in.in
index 7ba83e73c..c3da5ab5b 100644
--- a/t/source/debconf-traversal/dsc.in.in
+++ b/t/source/debconf-traversal/dsc.in.in
@@ -6,6 +6,7 @@ Version: 1
 Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
 Standards-Version: {$standards_version}
 Build-Depends: debhelper (>= 7)
+Testsuite: autopkgtest
 Checksums-Sha1:
  @SHA1@ @SIZE@ debconf-traversal_1.tar.gz
 Checksums-Sha256:
diff --git a/t/source/debian-source-dir-traversal-1/Makefile b/t/source/debian-source-dir-traversal-1/Makefile
index e8ffe1ee9..d49661c5e 100644
--- a/t/source/debian-source-dir-traversal-1/Makefile
+++ b/t/source/debian-source-dir-traversal-1/Makefile
@@ -5,6 +5,7 @@ all:
 	mkdir $(dir)
 	mkdir $(dir)/debian
 	cp changelog copyright control rules $(dir)/debian/
+	cp -R tests/ $(dir)/debian/
 	# prevent patch-system-but-no-source-readme
 	echo "Hallo World" > $(dir)/debian/README.source
 	echo $(DEFAULT_DH_COMPAT) > $(dir)/debian/compat
diff --git a/t/source/debian-source-dir-traversal-1/dsc.in.in b/t/source/debian-source-dir-traversal-1/dsc.in.in
index 910e5b13d..98183c179 100644
--- a/t/source/debian-source-dir-traversal-1/dsc.in.in
+++ b/t/source/debian-source-dir-traversal-1/dsc.in.in
@@ -6,6 +6,7 @@ Version: 1
 Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
 Standards-Version: {$standards_version}
 Build-Depends: debhelper (>= 7), quilt
+Testsuite: autopkgtest
 Checksums-Sha1:
  @SHA1@ @SIZE@ debian-source-dir-traversal-1_1.tar.gz
 Checksums-Sha256:
diff --git a/t/source/debian-source-dir-traversal-2/Makefile b/t/source/debian-source-dir-traversal-2/Makefile
index fc318d71f..caa3e5e94 100644
--- a/t/source/debian-source-dir-traversal-2/Makefile
+++ b/t/source/debian-source-dir-traversal-2/Makefile
@@ -5,6 +5,7 @@ all:
 	mkdir $(dir)
 	mkdir $(dir)/debian
 	cp changelog copyright control rules $(dir)/debian/
+	cp -R tests/ $(dir)/debian/
 	# Link to the lab entry - should trigger a myriad of
 	# "unknown-file-in-debian-source" tags, if lintian is vulnerable
 	ln -s ../../ $(dir)/debian/source
diff --git a/t/source/debian-source-dir-traversal-2/dsc.in.in b/t/source/debian-source-dir-traversal-2/dsc.in.in
index 8bcf0e881..320d127ab 100644
--- a/t/source/debian-source-dir-traversal-2/dsc.in.in
+++ b/t/source/debian-source-dir-traversal-2/dsc.in.in
@@ -6,6 +6,7 @@ Version: 1
 Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
 Standards-Version: {$standards_version}
 Build-Depends: debhelper (>= 7)
+Testsuite: autopkgtest
 Checksums-Sha1:
  @SHA1@ @SIZE@ debian-source-dir-traversal-2_1.tar.gz
 Checksums-Sha256:
diff --git a/t/source/debian-source-dir-unknown-source-format/Makefile b/t/source/debian-source-dir-unknown-source-format/Makefile
index 4b20c5c78..b9db9d197 100644
--- a/t/source/debian-source-dir-unknown-source-format/Makefile
+++ b/t/source/debian-source-dir-unknown-source-format/Makefile
@@ -5,6 +5,7 @@ all:
 	mkdir $(dir)
 	mkdir $(dir)/debian
 	cp changelog copyright control rules $(dir)/debian/
+	cp -R tests/ $(dir)/debian/
 	echo $(DEFAULT_DH_COMPAT) > $(dir)/debian/compat
 	mkdir $(dir)/debian/source
 	echo "3.0 (unknown-format)" > $(dir)/debian/source/format
diff --git a/t/source/debian-source-dir-unknown-source-format/dsc.in.in b/t/source/debian-source-dir-unknown-source-format/dsc.in.in
index b62c59165..0df0980c7 100644
--- a/t/source/debian-source-dir-unknown-source-format/dsc.in.in
+++ b/t/source/debian-source-dir-unknown-source-format/dsc.in.in
@@ -6,6 +6,7 @@ Version: 1
 Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
 Standards-Version: {$standards_version}
 Build-Depends: debhelper (>= 7)
+Testsuite: autopkgtest
 Checksums-Sha1:
  @SHA1@ @SIZE@ debian-source-dir-unknown-source-format_1.tar.gz
 Checksums-Sha256:
diff --git a/t/source/debian-symlink/Makefile b/t/source/debian-symlink/Makefile
index ffa2799ca..c1ebc6600 100644
--- a/t/source/debian-symlink/Makefile
+++ b/t/source/debian-symlink/Makefile
@@ -5,6 +5,7 @@ all:
 	mkdir $(dir)
 	ln -s . $(dir)/debian
 	cp changelog copyright control rules $(dir)/debian/
+	cp -R tests/ $(dir)/debian/
 	echo $(DEFAULT_DH_COMPAT) > $(dir)/debian/compat
 	mkdir $(dir)/debian/source
 	echo 1.0 > $(dir)/debian/source/format
diff --git a/t/source/debian-symlink/dsc.in.in b/t/source/debian-symlink/dsc.in.in
index 05c2fd56a..47d41188c 100644
--- a/t/source/debian-symlink/dsc.in.in
+++ b/t/source/debian-symlink/dsc.in.in
@@ -6,6 +6,7 @@ Version: 1
 Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
 Standards-Version: {$standards_version}
 Build-Depends: debhelper (>= 7)
+Testsuite: autopkgtest
 Checksums-Sha1:
  @SHA1@ @SIZE@ debian-symlink_1.tar.gz
 Checksums-Sha256:
diff --git a/t/source/fields-src-bad-version/Makefile b/t/source/fields-src-bad-version/Makefile
index 3e08ee003..f133ce1de 100644
--- a/t/source/fields-src-bad-version/Makefile
+++ b/t/source/fields-src-bad-version/Makefile
@@ -5,6 +5,7 @@ all:
 	mkdir $(dir)
 	mkdir $(dir)/debian
 	cp changelog copyright control rules $(dir)/debian/
+	cp -R tests/ $(dir)/debian/
 	echo $(DEFAULT_DH_COMPAT) > $(dir)/debian/compat
 	mkdir $(dir)/debian/source
 	echo 1.0 > $(dir)/debian/source/format
diff --git a/t/source/fields-src-bad-version/dsc.in.in b/t/source/fields-src-bad-version/dsc.in.in
index 2269f2a1f..af8225078 100644
--- a/t/source/fields-src-bad-version/dsc.in.in
+++ b/t/source/fields-src-bad-version/dsc.in.in
@@ -6,6 +6,7 @@ Version: 1
 Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
 Standards-Version: {$standards_version}
 Build-Depends: debhelper (>= 7), g++ (>= s4.0), gcc ((>= 4)
+Testsuite: autopkgtest
 Checksums-Sha1:
  @SHA1@ @SIZE@ control-file-syntax-error_1.tar.gz
 Checksums-Sha256:
diff --git a/t/source/fields-src-fields-filename/Makefile b/t/source/fields-src-fields-filename/Makefile
index 7fff7999a..0a4e36ecf 100644
--- a/t/source/fields-src-fields-filename/Makefile
+++ b/t/source/fields-src-fields-filename/Makefile
@@ -9,6 +9,7 @@ all:
 	echo "1.0" > $(dir)/debian/source/format
 	echo $(DEFAULT_DH_COMPAT) > $(dir)/debian/compat
 	cp changelog copyright control rules $(dir)/debian/
+	cp -R tests/ $(dir)/debian/
 	tar cfz $(dsc)_1.tar.gz $(dir)
 	subst-dsc $(dsc)_1.tar.gz < dsc.in > $(dsc)_1.dsc
 	mv $(dsc)_1.dsc $(name)_1.dsc
diff --git a/t/source/fields-src-fields-filename/dsc.in.in b/t/source/fields-src-fields-filename/dsc.in.in
index c256315a9..bcb4f9410 100644
--- a/t/source/fields-src-fields-filename/dsc.in.in
+++ b/t/source/fields-src-fields-filename/dsc.in.in
@@ -6,6 +6,7 @@ Version: 1
 Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
 Standards-Version: {$standards_version}
 Build-Depends: debhelper (>= 7)
+Testsuite: autopkgtest
 Checksums-Sha1:
  @SHA1@ @SIZE@ some-other-name_1.tar.gz
 Checksums-Sha256:
diff --git a/t/source/magic-architecture-srcpkg-ok/Makefile b/t/source/magic-architecture-srcpkg-ok/Makefile
index 90330cdaa..a04ec3ff3 100644
--- a/t/source/magic-architecture-srcpkg-ok/Makefile
+++ b/t/source/magic-architecture-srcpkg-ok/Makefile
@@ -7,6 +7,7 @@ all:
 	tar -c -f $(name)_1.0.orig.tar.gz -z $(dir)
 	mkdir $(dir)/debian
 	cp changelog copyright control rules $(dir)/debian/
+	cp -R tests/ $(dir)/debian/
 	echo $(DEFAULT_DH_COMPAT) > $(dir)/debian/compat
 	echo '# foo' > $(dir)/debian/watch
 	mkdir $(dir)/debian/source
diff --git a/t/source/magic-architecture-srcpkg-wrong/Makefile b/t/source/magic-architecture-srcpkg-wrong/Makefile
index d680a0c56..93f3a4c84 100644
--- a/t/source/magic-architecture-srcpkg-wrong/Makefile
+++ b/t/source/magic-architecture-srcpkg-wrong/Makefile
@@ -7,6 +7,7 @@ all:
 	tar -c -f $(name)_1.0.orig.tar.gz -z $(dir)
 	mkdir $(dir)/debian
 	cp changelog copyright control rules $(dir)/debian/
+	cp -R tests/ $(dir)/debian/
 	echo $(DEFAULT_DH_COMPAT) > $(dir)/debian/compat
 	echo '# foo' > $(dir)/debian/watch
 	mkdir $(dir)/debian/source
diff --git a/t/source/no-sha256-checksum/Makefile b/t/source/no-sha256-checksum/Makefile
index 4e6543b59..bb8c912bf 100644
--- a/t/source/no-sha256-checksum/Makefile
+++ b/t/source/no-sha256-checksum/Makefile
@@ -4,6 +4,7 @@ dir  = $(name)-1
 all:
 	mkdir -p $(dir)/debian/source
 	cp changelog copyright control rules $(dir)/debian/
+	cp -R tests/ $(dir)/debian/
 	echo 9 > $(dir)/debian/compat
 	echo "3.0 (native)" > $(dir)/debian/source/format
 	tar cfz $(name)_1.tar.gz $(dir)
diff --git a/t/source/no-sha256-checksum/dsc.in.in b/t/source/no-sha256-checksum/dsc.in.in
index e169c45e8..ed0edadc0 100644
--- a/t/source/no-sha256-checksum/dsc.in.in
+++ b/t/source/no-sha256-checksum/dsc.in.in
@@ -6,6 +6,7 @@ Version: 1
 Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
 Standards-Version: {$standards_version}
 Build-Depends: debhelper (>= 9)
+Testsuite: autopkgtest
 Checksums-Sha1:
  @SHA1@ @SIZE@ no-sha256-checksum_1.tar.gz
 Files:
diff --git a/t/source/package-version-0/Makefile b/t/source/package-version-0/Makefile
index f909603dd..fa70616a6 100644
--- a/t/source/package-version-0/Makefile
+++ b/t/source/package-version-0/Makefile
@@ -5,6 +5,7 @@ all:
 	mkdir $(dir)
 	mkdir $(dir)/debian
 	cp changelog copyright control rules $(dir)/debian/
+	cp -R tests/ $(dir)/debian/
 	echo $(DEFAULT_DH_COMPAT) > $(dir)/debian/compat
 	mkdir $(dir)/debian/source
 	echo 1.0 > $(dir)/debian/source/format
diff --git a/t/source/testsuite-inconsistent-field/Makefile b/t/source/testsuite-inconsistent-field/Makefile
index 17e2ca9de..005058f3e 100644
--- a/t/source/testsuite-inconsistent-field/Makefile
+++ b/t/source/testsuite-inconsistent-field/Makefile
@@ -5,12 +5,10 @@ all:
 	mkdir $(dir)
 	mkdir $(dir)/debian
 	cp changelog copyright control rules $(dir)/debian/
+	cp -R tests/ $(dir)/debian/
 	echo $(DEFAULT_DH_COMPAT) > $(dir)/debian/compat
 	mkdir $(dir)/debian/source
 	echo 1.0 > $(dir)/debian/source/format
-	mkdir $(dir)/debian/tests
-	echo 'Tests: test.sh' > $(dir)/debian/tests/control
-	echo '#!/bin/sh' > $(dir)/debian/tests/test.sh
 	dpkg-source -sn -b $(dir)
 	sed -i '/^Testsuite: /d' *.dsc
 
diff --git a/t/source/testsuite-inconsistent-field/tags b/t/source/testsuite-inconsistent-field/tags
index e9d98ef58..7104ab2b7 100644
--- a/t/source/testsuite-inconsistent-field/tags
+++ b/t/source/testsuite-inconsistent-field/tags
@@ -1 +1,2 @@
 I: testsuite-inconsistent-field source: inconsistent-testsuite-field
+I: testsuite-inconsistent-field source: testsuite-autopkgtest-missing
diff --git a/t/source/unpack-srcpkg-dot-dir/Makefile b/t/source/unpack-srcpkg-dot-dir/Makefile
index a7b81b202..87fdeae4b 100644
--- a/t/source/unpack-srcpkg-dot-dir/Makefile
+++ b/t/source/unpack-srcpkg-dot-dir/Makefile
@@ -9,6 +9,7 @@ all:
 	mkdir -p $(dir)/debian
 	cp README foo.c foo.h $(dir)
 	cp changelog copyright control rules $(dir)/debian/
+	cp -R tests/ $(dir)/debian/
 	echo $(DEFAULT_DH_COMPAT) > $(dir)/debian/compat
 	echo > $(dir)/debian/watch
 	mkdir $(dir)/debian/source
diff --git a/t/source/unpack-srcpkg-dot-subdir/Makefile b/t/source/unpack-srcpkg-dot-subdir/Makefile
index ccbef43ee..01d2f6e9b 100644
--- a/t/source/unpack-srcpkg-dot-subdir/Makefile
+++ b/t/source/unpack-srcpkg-dot-subdir/Makefile
@@ -8,6 +8,7 @@ all:
 	tar -c -z -f $(name)_1.0.orig.tar.gz ./$(name)
 	mkdir -p $(name)/debian
 	cp changelog copyright control rules $(name)/debian/
+	cp -R tests/ $(name)/debian/
 	echo $(DEFAULT_DH_COMPAT) > $(name)/debian/compat
 	echo > $(name)/debian/watch
 	mkdir $(name)/debian/source
diff --git a/t/source/unpack-srcpkg-no-subdir/Makefile b/t/source/unpack-srcpkg-no-subdir/Makefile
index c8da8dde3..02e044b8e 100644
--- a/t/source/unpack-srcpkg-no-subdir/Makefile
+++ b/t/source/unpack-srcpkg-no-subdir/Makefile
@@ -9,6 +9,7 @@ all:
 	mkdir -p $(dir)/debian
 	cp README foo.c foo.h $(dir)
 	cp changelog copyright control rules $(dir)/debian/
+	cp -R tests/ $(dir)/debian/
 	echo $(DEFAULT_DH_COMPAT) > $(dir)/debian/compat
 	echo > $(dir)/debian/watch
 	mkdir $(dir)/debian/source
diff --git a/t/source/unpack-srcpkg-xz/Makefile b/t/source/unpack-srcpkg-xz/Makefile
index f11b81982..b69b1a4dd 100644
--- a/t/source/unpack-srcpkg-xz/Makefile
+++ b/t/source/unpack-srcpkg-xz/Makefile
@@ -7,6 +7,7 @@ all:
 	tar -c -f $(name)_1.0.orig.tar.xz --xz $(dir)
 	mkdir $(dir)/debian
 	cp changelog copyright control rules $(dir)/debian/
+	cp -R tests/ $(dir)/debian/
 	echo $(DEFAULT_DH_COMPAT) > $(dir)/debian/compat
 	touch $(dir)/debian/watch
 	mkdir $(dir)/debian/source
diff --git a/t/templates/source/skel/tests/control b/t/templates/source/skel/tests/control
new file mode 100644
index 000000000..b8562954d
--- /dev/null
+++ b/t/templates/source/skel/tests/control
@@ -0,0 +1 @@
+Tests: test 
diff --git a/t/templates/source/skel/tests/test b/t/templates/source/skel/tests/test
new file mode 100755
index 000000000..039e4d006
--- /dev/null
+++ b/t/templates/source/skel/tests/test
@@ -0,0 +1,2 @@
+#!/bin/sh
+exit 0
-- 
2.11.0

>From b0455eb89bef1a2b5a0ef421ca02b834c0b0e229 Mon Sep 17 00:00:00 2001
From: Lucas Kanashiro <kanashiro@debian.org>
Date: Mon, 3 Apr 2017 17:18:11 -0300
Subject: [PATCH 1/3] check if source package contains functional testsuite

---
 checks/testsuite.desc                                  | 18 ++++++++++++++++++
 checks/testsuite.pm                                    |  2 ++
 .../debian/debian/control.in                           | 15 +++++++++++++++
 t/tests/testsuite-autopkgtest-missing/desc             |  5 +++++
 t/tests/testsuite-autopkgtest-missing/pre_build        |  2 ++
 t/tests/testsuite-autopkgtest-missing/tags             |  1 +
 6 files changed, 43 insertions(+)
 create mode 100644 t/tests/testsuite-autopkgtest-missing/debian/debian/control.in
 create mode 100644 t/tests/testsuite-autopkgtest-missing/desc
 create mode 100755 t/tests/testsuite-autopkgtest-missing/pre_build
 create mode 100644 t/tests/testsuite-autopkgtest-missing/tags

diff --git a/checks/testsuite.desc b/checks/testsuite.desc
index 4a5327839..febc25083 100644
--- a/checks/testsuite.desc
+++ b/checks/testsuite.desc
@@ -128,3 +128,21 @@ Info: Lintian cannot parse the Depends field for the given autopkgtest.
  If Lintian complains about a new special "@"-dependency, please file
  a bug against Lintian and have it added to the whitelist.
 Ref: https://anonscm.debian.org/git/autopkgtest/autopkgtest.git/tree/doc/README.package-tests.rst
+
+Tag: testsuite-autopkgtest-missing
+Severity: wishlist
+Certainty: certain
+Info: This package does not declare a test suite. Having a test suite helps with
+ automated QA in response to changes in the archive. For example, if your
+ package has a test suite, it is possible to re-execute that test suite when
+ any of the package dependencies has a new version and check whether that
+ update caused problems for your package.
+ .
+ To declare a test suite in your package, you need to add a `Testsuite` field to
+ the source part of debian/control. This field will usually have a value of
+ `autopkgtest`, i.e.:
+ .
+	Testsuite: autopkgtest
+ .
+ For more information on how to add functional tests to your package, browse to
+ https://ci.debian.net/doc/.
diff --git a/checks/testsuite.pm b/checks/testsuite.pm
index 3839c39f0..60495da0a 100644
--- a/checks/testsuite.pm
+++ b/checks/testsuite.pm
@@ -78,6 +78,8 @@ sub run {
     my $control = $info->index('debian/tests/control');
     my $needs_control = 0;
 
+    tag 'testsuite-autopkgtest-missing' if ($testsuites !~ /autopkgtest/);
+
     for my $testsuite (split(m/\s*,\s*/o, $testsuites)) {
         if (not exists($KNOWN_TESTSUITES{$testsuite})) {
             tag 'unknown-testsuite', $testsuite;
diff --git a/t/tests/testsuite-autopkgtest-missing/debian/debian/control.in b/t/tests/testsuite-autopkgtest-missing/debian/debian/control.in
new file mode 100644
index 000000000..842d74276
--- /dev/null
+++ b/t/tests/testsuite-autopkgtest-missing/debian/debian/control.in
@@ -0,0 +1,15 @@
+Source: {$source}
+Priority: extra
+Section: devel
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: {$build_depends}
+
+Package: {$source}
+Architecture: all
+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-autopkgtest-missing/desc b/t/tests/testsuite-autopkgtest-missing/desc
new file mode 100644
index 000000000..ec5862e95
--- /dev/null
+++ b/t/tests/testsuite-autopkgtest-missing/desc
@@ -0,0 +1,5 @@
+Testname: testsuite-autopkgtest-missing
+Version: 1.0
+Description: Verify if Testsuite field and autopkgtest are used
+Test-For:
+  testsuite-autopkgtest-missing
diff --git a/t/tests/testsuite-autopkgtest-missing/pre_build b/t/tests/testsuite-autopkgtest-missing/pre_build
new file mode 100755
index 000000000..5d971921c
--- /dev/null
+++ b/t/tests/testsuite-autopkgtest-missing/pre_build
@@ -0,0 +1,2 @@
+#!/bin/bash
+rm -f "$1/debian/tests/control"
diff --git a/t/tests/testsuite-autopkgtest-missing/tags b/t/tests/testsuite-autopkgtest-missing/tags
new file mode 100644
index 000000000..cb51a6662
--- /dev/null
+++ b/t/tests/testsuite-autopkgtest-missing/tags
@@ -0,0 +1 @@
+I: testsuite-autopkgtest-missing source: testsuite-autopkgtest-missing
-- 
2.11.0


Reply to: