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

Re: [PATCH 2/3] autodetect Perl packages



Hey Antonio,

thanks! I rebased it on top of the modified Ruby patch, with similar
changes (attached). Once this is finished, I'll also merge the
documentation patch (but as part of the ruby and perl ones).

I ran this for two random Perl packages. The runtime-deps (not doing
that much) and the heavy-deps (not doing anything) ones passed, but
the buildtime-deps one failed similarly for both:

| ./run-from-checkout libperl-metrics-simple-perl --- schroot sid
| t/0901_pod.t ...........
| 1..1
| not ok 1 - POD test for lib
| 
| #   Failed test 'POD test for lib'
| #   at /usr/share/perl5/Test/Pod.pm line 186.
| # lib does not exist
| # Looks like you failed 1 test of 1.
| Dubious, test returned 1 (wstat 256, 0x100)
| Failed 1/1 subtests 


| ./run-from-checkout libperl-version-perl --- schroot sid
| t/pod.t ................ 
| 1..1
| not ok 1 - POD test for lib
| 
| #   Failed test 'POD test for lib'
| #   at /usr/share/perl5/Test/Pod.pm line 186.
| # lib does not exist
| # Looks like you failed 1 test of 1.
| Dubious, test returned 1 (wstat 256, 0x100)
| Failed 1/1 subtests 

This might be a missing test dependency which needs to be added to the
Tests() instantiation?

CC'ing pkg-perl@ for their input, too.

Thanks,

Martin
-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
From 622dd43cb6af01a5e1f521222c1840758240d8db Mon Sep 17 00:00:00 2001
From: Antonio Terceiro <terceiro@debian.org>
Date: Mon, 8 Sep 2014 11:41:06 +0200
Subject: [PATCH 2/2] Synthesize Perl test control

If there is no Debian test control file, synthesize one for Perl packages,
using pkg-perl-autopkgtest.
---
 debian/changelog |  5 +++--
 lib/testdesc.py  | 32 ++++++++++++++++++++++++++++++++
 tests/testdesc   | 23 +++++++++++++++++++++++
 3 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 6d84a2f..ce843cb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,8 +6,9 @@ autopkgtest (3.5) UNRELEASED; urgency=medium
   * Support tests that want to reboot the testbed (for runners which support
     rebooting). Document this in doc/README.package-tests.rst.
   * tests/testdesc: Add test case for Debian packages without a test control.
-  * If there is no Debian test control file, synthesize one for Ruby packages,
-    using gem2deb-test-runner. Thanks to Antonio Terceiro!
+  * If there is no Debian test control file, synthesize one for Ruby and Perl
+    packages, using gem2deb-test-runner and pkg-perl-autopkgtest. Thanks to
+    Antonio Terceiro!
 
   Bug fixes:
   * qemu: Reconfigure tzdata after copying /etc/timezone, to make that change
diff --git a/lib/testdesc.py b/lib/testdesc.py
index 5a1a4f5..fd3092b 100644
--- a/lib/testdesc.py
+++ b/lib/testdesc.py
@@ -308,6 +308,37 @@ def _auto_debian_control_ruby(srcdir, tests):
                           depends, []))
 
 
+def _auto_debian_control_perl(srcdir, tests):
+    '''Add automatic test for Perl packages'''
+
+    if (os.path.exists(os.path.join(srcdir, 't')) and
+            (os.path.exists(os.path.join(srcdir, 'Makefile.PL')) or
+             os.path.exists(os.path.join(srcdir, 'Build.PL')))):
+
+        adtlog.info('Perl package detected')
+
+        command = '/usr/share/pkg-perl-autopkgtest/runner build-deps'
+        depends = _parse_debian_depends(command,
+                                        '@, @builddeps@, pkg-perl-autopkgtest',
+                                        srcdir)
+        tests.append(Test('auto-build-deps', None, command, [], [],
+                          depends, []))
+
+        command = '/usr/share/pkg-perl-autopkgtest/runner runtime-deps'
+        depends = _parse_debian_depends(command,
+                                        '@, pkg-perl-autopkgtest',
+                                        srcdir)
+        tests.append(Test('auto-runtime-deps', None, command, [], [],
+                          depends, []))
+
+        command = '/usr/share/pkg-perl-autopkgtest/runner heavy-deps'
+        depends = _parse_debian_depends(command,
+                                        '@, pkg-perl-autopkgtest-heavy',
+                                        srcdir)
+        tests.append(Test('auto-heavy-deps', None, command, [], [],
+                          depends, []))
+
+
 def _auto_debian_control(srcdir):
     '''Infer tests if there is no Debian test control file'''
 
@@ -315,6 +346,7 @@ def _auto_debian_control(srcdir):
     some_skipped = False
 
     _auto_debian_control_ruby(srcdir, tests)
+    _auto_debian_control_perl(srcdir, tests)
 
     return (tests, some_skipped)
 
diff --git a/tests/testdesc b/tests/testdesc
index 117ed28..bedec6b 100755
--- a/tests/testdesc
+++ b/tests/testdesc
@@ -425,6 +425,29 @@ class Debian(unittest.TestCase):
         self.assertIn('gem2deb-test-runner', ts[0].depends)
         self.assertIn('ruby-foo', ts[0].depends)
 
+    def test_auto_control_perl(self):
+        '''automatic tests for Perl packages'''
+
+        with open(os.path.join(self.pkgdir, 'Makefile.PL'), 'w') as f:
+            f.write('use ExtUtils::MakeMaker;\n')
+        os.makedirs(os.path.join(self.pkgdir, 't'))
+        (ts, skipped) = self.call_parse(None, 'Source: libfoo-perl\n\n'
+                                        'Package: libfoo-perl\nArchitecture: all')
+
+        self.assertEqual(len(ts), 3)
+
+        self.assertRegex(ts[0].command, 'pkg-perl-autopkgtest.*build-deps')
+        self.assertIn('pkg-perl-autopkgtest', ts[0].depends)
+        self.assertIn('libfoo-perl', ts[0].depends)
+
+        self.assertRegex(ts[1].command, 'pkg-perl-autopkgtest.*runtime-deps')
+        self.assertIn('pkg-perl-autopkgtest', ts[1].depends)
+        self.assertIn('libfoo-perl', ts[1].depends)
+
+        self.assertRegex(ts[2].command, 'pkg-perl-autopkgtest.*heavy-deps')
+        self.assertIn('pkg-perl-autopkgtest-heavy', ts[2].depends)
+        self.assertIn('libfoo-perl', ts[2].depends)
+
 
 class Click(unittest.TestCase):
     @classmethod
-- 
2.1.0

Attachment: signature.asc
Description: Digital signature


Reply to: