[med-svn] [Git][med-team/libgoby-java][master] 2 commits: Adding autopkgtests

Pierre Gruet (@pgt) gitlab at salsa.debian.org
Mon Aug 9 21:10:50 BST 2021



Pierre Gruet pushed to branch master at Debian Med / libgoby-java


Commits:
229021b1 by Pierre Gruet at 2021-08-09T22:09:44+02:00
Adding autopkgtests

- - - - -
01e94515 by Pierre Gruet at 2021-08-09T22:10:34+02:00
Adding the ITP bug number in the changelog

- - - - -


4 changed files:

- debian/changelog
- + debian/tests/control
- + debian/tests/test-BZip2ChunkCodec
- + debian/tests/test-fasta-to-compact


Changes:

=====================================
debian/changelog
=====================================
@@ -1,13 +1,5 @@
-libgoby-java (3.3.1+dfsg-1) UNRELEASED; urgency=medium
+libgoby-java (3.3.1+dfsg1-1) UNRELEASED; urgency=medium
 
-  * Initial release (Closes: #<bug>)
-  TODO:
-    - Packaging variationanalysis by Campagnelab, needed by goby.
-    - Go on investigating non-passing tests
-      (begun in debian/patches/exclude_not_runnable_tests.patch)
-    - I have put some dependencies in debian/maven.ignoreRules but it may be
-      wrong.
-    - See also https://lists.debian.org/debian-med/2013/02/msg00152.html,
-      although written for a previous upstream version of goby.
+  * Initial release (Closes: #992044)
 
- -- Pierre Gruet <pgt at debian.org>  Fri, 30 Jul 2021 11:48:56 +0200
+ -- Pierre Gruet <pgt at debian.org>  Mon, 09 Aug 2021 22:10:04 +0200


=====================================
debian/tests/control
=====================================
@@ -0,0 +1,7 @@
+Tests: test-fasta-to-compact
+Depends: goby-java
+Restrictions: allow-stderr
+
+Tests: test-BZip2ChunkCodec
+Depends: libgoby-io-java
+Restrictions: allow-stderr


=====================================
debian/tests/test-BZip2ChunkCodec
=====================================
@@ -0,0 +1,58 @@
+#!/bin/sh
+# autopkgtest check: This runs one specific unit test needing only the goby-io
+# jar, and also in order to check the patch about Bzip2 is correct.
+# (C) 2021 Pierre Gruet.
+# Author: Pierre Gruet <pgt at debian.org>
+set -e
+
+pkg=libgoby-java
+
+export LC_ALL=C.UTF-8
+if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
+  AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
+  # Double quote below to expand the temporary directory variable now versus
+  # later is on purpose.
+  # shellcheck disable=SC2064
+  trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
+fi
+
+# We copy the class of the test inside the temp directory.
+mkdir -p "${AUTOPKGTEST_TMP}/org/campagnelab/goby/compression/"
+cp goby-distribution/src/test/java/org/campagnelab/goby/compression/TestBZip2ChunkCodec.java ${AUTOPKGTEST_TMP}/org/campagnelab/goby/compression/
+
+cd "${AUTOPKGTEST_TMP}"
+
+# Creating the launcher.
+cat <<EOF > Test.java
+import org.campagnelab.goby.compression.TestBZip2ChunkCodec;
+import java.io.IOException;
+
+public class Test {
+    public static void main(String[] args) {
+        try {
+            TestBZip2ChunkCodec t = new TestBZip2ChunkCodec();
+            t.roundTrip();
+        } catch (IOException e) {
+            System.out.println(e.getMessage());
+            System.exit(1);
+        }
+    }
+}
+EOF
+
+# Removing the junit stuff in the class of the test.
+sed -i 's/^import org\.junit\.Test;$//' org/campagnelab/goby/compression/TestBZip2ChunkCodec.java
+sed -i 's/^import static junit\.framework\.Assert\.assertNotNull;$//' org/campagnelab/goby/compression/TestBZip2ChunkCodec.java
+sed -i 's/@Test//' org/campagnelab/goby/compression/TestBZip2ChunkCodec.java
+sed -i 's/assertNotNull(decoded);/if (decoded == null) { System.exit(1); }/' org/campagnelab/goby/compression/TestBZip2ChunkCodec.java
+
+# Building and running.
+javac -cp .:/usr/share/java/goby-io.jar:/usr/share/java/protobuf.jar Test.java org/campagnelab/goby/compression/TestBZip2ChunkCodec.java
+java -cp .:/usr/share/java/goby-io.jar:/usr/share/java/protobuf.jar Test
+
+if [ $? -eq 0 ]; then
+  echo "Test ran successfully"
+else
+  echo "Test failed to run"
+  exit 1
+fi


=====================================
debian/tests/test-fasta-to-compact
=====================================
@@ -0,0 +1,43 @@
+#!/bin/sh
+# autopkgtest check: Run goby in fasta-to-compact mode, first with a java call,
+# then through the goby shell wrapper. 
+# (C) 2021 Pierre Gruet.
+# Author: Pierre Gruet <pgt at debian.org>
+set -e
+
+pkg=libgoby-java
+
+export LC_ALL=C.UTF-8
+if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
+  AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
+  # Double quote below to expand the temporary directory variable now versus
+  # later is on purpose.
+  # shellcheck disable=SC2064
+  trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
+fi
+
+cp -a test-data/ "${AUTOPKGTEST_TMP}"
+
+cd "${AUTOPKGTEST_TMP}/test-data/seq-var-test"
+
+# We launch a command in fasta-to-compact mode without the wrapper.
+java -Xmx100m -jar /usr/share/java/goby.jar -m fasta-to-compact -d -o small-synth.compact-reads small-synth.fa | grep "Total logical entries written: 1"
+
+if [ $? -eq 0 ]; then
+  echo "Result file correctly outputted by the java invocation"
+else
+  echo "Failed to generate output"
+  exit 1
+fi
+
+# Now we delete the output and try to launch a command in fasta-to-compact mode
+# by invoking the shell launcher.
+rm small-synth.compact-reads
+goby 100m fasta-to-compact -d -o small-synth.compact-reads small-synth.fa | grep "Total logical entries written: 1"
+
+if [ $? -eq 0 ]; then
+  echo "Result file correctly outputted by the goby call"
+else
+  echo "Failed to generate output"
+  exit 1
+fi



View it on GitLab: https://salsa.debian.org/med-team/libgoby-java/-/compare/94cb53edc0174d900c2c90aef495ad4209cf37a8...01e9451542b3935c60e20e314dd161e8187214c5

-- 
View it on GitLab: https://salsa.debian.org/med-team/libgoby-java/-/compare/94cb53edc0174d900c2c90aef495ad4209cf37a8...01e9451542b3935c60e20e314dd161e8187214c5
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20210809/4640c418/attachment-0001.htm>


More information about the debian-med-commit mailing list