Andreas Tille pushed to branch master at Debian Med / lsd2


Commits:
98d507c6 by Andreas Tille at 2026-09-15T11:02:23+02:00
Add autopkgtest

- - - - -


7 changed files:

- + debian/README.test
- debian/changelog
- debian/lsd2.docs
- + debian/lsd2.examples
- + debian/tests/control
- + debian/tests/run-unit-test
- + debian/tests/test.cpp


Changes:

=====================================
debian/README.test
=====================================
@@ -0,0 +1,8 @@
+Notes on how this package can be tested.
+────────────────────────────────────────
+
+This package can be tested by running the provided test:
+
+    sh run-unit-test
+
+in order to confirm its integrity.


=====================================
debian/changelog
=====================================
@@ -1,6 +1,7 @@
 lsd2 (1.9.9+dfsg-2) UNRELEASED; urgency=medium
 
   * Create library packages
+  * Add autopkgtest
 
  -- Andreas Tille <[email protected]>  Tue, 15 Sep 2026 09:11:35 +0200
 


=====================================
debian/lsd2.docs
=====================================
@@ -1 +1,3 @@
 README*
+debian/README.test
+debian/tests/run-unit-test


=====================================
debian/lsd2.examples
=====================================
@@ -0,0 +1,2 @@
+examples/*
+debian/tests/test.cpp


=====================================
debian/tests/control
=====================================
@@ -0,0 +1,2 @@
+Tests: run-unit-test
+Depends: @, g++


=====================================
debian/tests/run-unit-test
=====================================
@@ -0,0 +1,43 @@
+#!/bin/bash
+set -e
+
+pkg=lsd2
+
+export LC_ALL=C.UTF-8
+if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
+  AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
+  # shellcheck disable=SC2064
+  trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
+fi
+
+cp -a /usr/share/doc/${pkg}/examples/unrooted_tree_without_outgroups/* 
"${AUTOPKGTEST_TMP}"
+
+cd "${AUTOPKGTEST_TMP}"
+
+echo "== running lsd2 on unrooted-tree example, estimating the root =="
+lsd2 -i Dengue.phy_phyml_tree.txt -d Dengue.date -r a -s 1000
+
+for suffix in result result.date.nexus result.nwk; do
+    test -s "Dengue.phy_phyml_tree.txt.$suffix"
+done
+
+echo "-- result file --"
+cat Dengue.phy_phyml_tree.txt.result
+
+grep -q 'rate' Dengue.phy_phyml_tree.txt.result
+grep -q 'tMRCA' Dengue.phy_phyml_tree.txt.result
+
+echo "OK: lsd2 produced dating results"
+
+
+cp -a /usr/share/doc/${pkg}/examples/test.cpp .
+
+echo "== compiling and linking against the shared library =="
+g++ test.cpp -o test_shared -llsd2
+./test_shared -h | grep -m1 -oE 'v\.[0-9]+(\.[0-9]+)+'
+
+echo "== compiling and linking against the static library =="
+g++ test.cpp -o test_static -Wl,-Bstatic -llsd2 -Wl,-Bdynamic
+./test_static -h | grep -m1 -oE 'v\.[0-9]+(\.[0-9]+)+'
+
+echo "OK: liblsd2-dev headers/shared/static libs all usable"


=====================================
debian/tests/test.cpp
=====================================
@@ -0,0 +1,15 @@
+/* <iostream>/<string> and "using namespace std" have to come before
+ * <lsd2/lsd.h> -- that header uses istream/ostream/string
+ * unqualified, relying on the includer having already brought them
+ * in (the same way lsd2's own main.cpp does it).
+ */
+#include <iostream>
+#include <string>
+using namespace std;
+
+#include <lsd.h>
+
+int main(int argc, char** argv) {
+    return lsd::buildTimeTree(argc, argv);
+}
+



View it on GitLab: 
https://salsa.debian.org/med-team/lsd2/-/commit/98d507c61185dbbc0087ed9f1164813ef3a59ac1

-- 
View it on GitLab: 
https://salsa.debian.org/med-team/lsd2/-/commit/98d507c61185dbbc0087ed9f1164813ef3a59ac1
You're receiving this email because of your account on salsa.debian.org. Manage 
all notifications: https://salsa.debian.org/-/profile/notifications | Help: 
https://salsa.debian.org/help


_______________________________________________
debian-med-commit mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/debian-med-commit

Reply via email to