[med-svn] [paleomix] 04/04: Add autopkgtest

Andreas Tille tille at debian.org
Wed Feb 22 16:02:33 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository paleomix.

commit 64e1fa34683e9e94320362ee97ad4b4af8a5db50
Author: Andreas Tille <tille at debian.org>
Date:   Wed Feb 22 17:01:57 2017 +0100

    Add autopkgtest
---
 debian/README.test                     |  8 ++++++++
 debian/control                         |  7 +++++--
 debian/docs                            |  3 +++
 debian/patches/fix_makefile_test.patch |  9 ++++++++-
 debian/patches/series                  |  2 +-
 debian/rules                           | 19 +++++++++++++++++++
 debian/tests/control                   |  3 +++
 debian/tests/run-unit-test             | 23 +++++++++++++++++++++++
 8 files changed, 70 insertions(+), 4 deletions(-)

diff --git a/debian/README.test b/debian/README.test
new file mode 100644
index 0000000..ef34ccc
--- /dev/null
+++ b/debian/README.test
@@ -0,0 +1,8 @@
+Notes on how this package can be tested.
+────────────────────────────────────────
+
+To run the unit tests provided by the package you can do
+
+   sh run-unit-test
+
+in this directory.
diff --git a/debian/control b/debian/control
index 51d4371..5d11341 100644
--- a/debian/control
+++ b/debian/control
@@ -13,7 +13,8 @@ Build-Depends: debhelper (>= 10),
                python-pysam,
                python-setproctitle,
                default-jre-headless,
-               bowtie2
+               bowtie2,
+               rsync
 Standards-Version: 3.9.8
 Vcs-Browser: https://anonscm.debian.org/cgit/debian-med/paleomix.git
 Vcs-Git: https://anonscm.debian.org/git/debian-med/paleomix.git
@@ -36,7 +37,9 @@ Depends: ${misc:Depends},
          r-base-core,
          radiant,
          raxml,
-         samtools
+         samtools,
+         python-coverage,
+         python-flexmock
 Description: pipelines and tools for the processing of ancient and modern HTS data
  The PALEOMIX pipelines are a set of pipelines and tools designed to aid
  the rapid processing of High-Throughput Sequencing (HTS) data: The BAM
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..960011c
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1,3 @@
+tests
+debian/README.test
+debian/tests/run-unit-test
diff --git a/debian/patches/fix_makefile_test.patch b/debian/patches/fix_makefile_test.patch
index c2302b4..5e58f37 100644
--- a/debian/patches/fix_makefile_test.patch
+++ b/debian/patches/fix_makefile_test.patch
@@ -1,6 +1,13 @@
 Author: Andreas Tille <tille at debian.org>
 Last-Update: Tue, 14 Feb 2017 12:04:19 +0100
-Description: Avoid test failure
+Description: That's really strange:  At package build time this patch
+ seems to be really needed to prevent the faulure below.  However, when running
+ the test on the installed package it fails with this change.  So it is not
+ applied as quilt patch but rather using sed in d/rules to enable proper build
+ while not affecting other testing.  I suspect that has something to do with
+ improperly set time zone in pbuilder.
+ .
+ .
  ======================================================================
  FAIL: common_tests.makefile_test.test_read_makefile__missing_simple_file
  ----------------------------------------------------------------------
diff --git a/debian/patches/series b/debian/patches/series
index 19b90b2..7d0c691 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,4 @@
 avoid_downloading_prerequisites.patch
-fix_makefile_test.patch
+## fix_makefile_test.patch ## rather use sed in d/rules (see patch description)
 work_around_os.getlogin.patch
 avoid_privacy_breach.patch
diff --git a/debian/rules b/debian/rules
index 87a0e18..37e9252 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,5 +1,7 @@
 #!/usr/bin/make -f
 
+DEBPKGNAME     := $(shell dpkg-parsechangelog | awk '/^Source:/ {print $$2}')
+
 # DH_VERBOSE := 1
 export LC_ALL=C.UTF-8
 
@@ -7,7 +9,11 @@ export LC_ALL=C.UTF-8
 	dh $@ --with python2 --buildsystem=pybuild
 
 override_dh_auto_test:
+	# apply fix that seems to be needed due to improperly set
+	# time zone in pbuilder
+	sed -i~ 's/"MTime": "2005-07-07 08:50:00"/"MTime": "2005-07-07 06:50:00"/' tests/common_tests/makefile_test.py
 	PATH=$(CURDIR)/bin/:$(PATH) dh_auto_test
+	mv tests/common_tests/makefile_test.py~ tests/common_tests/makefile_test.py
 
 override_dh_install:
 	dh_install
@@ -22,3 +28,16 @@ override_dh_fixperms:
 	        chmod -x $$rs ; \
 	    fi ; \
 	done
+
+override_dh_installdocs:
+	dh_installdocs
+	# since tests dir contains empty files which are used afterwards for
+	# testing and dh_installdocs is ignoring empty files we need to make
+	# sure all files are really copied
+	rsync -a -v tests debian/$(DEBPKGNAME)/usr/share/doc/$(DEBPKGNAME)
+	# test runner is seeking for paleomix modules in source - we use inside the installed package
+	sed -i 's:(find paleomix -mindepth 1:(find /usr/lib/python2.7/dist-packages/paleomix -mindepth 1:' debian/*/usr/share/doc/*/tests/run
+	#echo "======  Also empty files belong to the docs ======"
+	#find debian -name "empty_file*"
+	#find debian -name "timestamp_*"
+	#echo "======  Hope something was printed between these lines ===="
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..d2aa55a
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,3 @@
+Tests: run-unit-test
+Depends: @
+Restrictions: allow-stderr
diff --git a/debian/tests/run-unit-test b/debian/tests/run-unit-test
new file mode 100644
index 0000000..2173e0f
--- /dev/null
+++ b/debian/tests/run-unit-test
@@ -0,0 +1,23 @@
+#!/bin/bash
+set -e
+
+pkg="paleomix"
+
+if [ "$ADTTMP" = "" ] ; then
+  ADTTMP=`mktemp -d /tmp/${pkg}-test.XXXXXX`
+#  trap "rm -rf $ADTTMP" 0 INT QUIT ABRT PIPE TERM
+fi
+
+cp -a /usr/share/doc/${pkg}/tests $ADTTMP
+
+cd $ADTTMP
+
+for gz in `find . -name "*.gz"` ; do
+    # fasta_file.fasta.gz needs to stay compressed for testing
+    if ! echo $gz | grep fasta_file.fasta.gz ; then
+        gunzip $gz
+    fi
+done
+
+chmod +x tests/run
+tests/run

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/paleomix.git



More information about the debian-med-commit mailing list