[med-svn] [Git][med-team/ngs-sdk][master] 4 commits: Rewriting the autopkgtest to test the as-installed package

Pierre Gruet (@pgt) gitlab at salsa.debian.org
Tue May 3 20:56:57 BST 2022



Pierre Gruet pushed to branch master at Debian Med / ngs-sdk


Commits:
0b229e0b by Pierre Gruet at 2022-05-03T20:48:50+02:00
Rewriting the autopkgtest to test the as-installed package

Previously the autopkgtest rebuilt the libs in the source tree.

- - - - -
045a5e66 by Pierre Gruet at 2022-05-03T20:50:01+02:00
No need to limit architectures for the autopkgtest

- - - - -
f1a0c870 by Pierre Gruet at 2022-05-03T20:56:49+02:00
Updating changelog

- - - - -
841bbf02 by Pierre Gruet at 2022-05-03T21:56:24+02:00
Upload to unstable

- - - - -


3 changed files:

- debian/changelog
- debian/tests/control
- debian/tests/run-unit-test


Changes:

=====================================
debian/changelog
=====================================
@@ -1,11 +1,10 @@
-ngs-sdk (2.11.2-4) UNRELEASED; urgency=medium
+ngs-sdk (2.11.2-4) unstable; urgency=medium
 
   * Team upload
+  * Rewriting the autopkgtest to test the package as-installed
+    (Closes: #1006732)
 
-  [ Lance Lin ]
-  * Updated d/tests/control to only run on x86_64 (Closes: #1006732)
-
- -- Lance Lin <lqi254 at protonmail.com>  Wed, 27 Feb 2022 19:31:33 +0700
+ -- Pierre Gruet <pgt at debian.org>  Tue, 03 May 2022 21:17:32 +0200
 
 ngs-sdk (2.11.2-3) unstable; urgency=medium
 


=====================================
debian/tests/control
=====================================
@@ -1,4 +1,3 @@
 Tests: run-unit-test
 Depends: @, build-essential
 Restrictions: allow-stderr
-Architecture: x86_64


=====================================
debian/tests/run-unit-test
=====================================
@@ -1,18 +1,47 @@
 #!/bin/sh
 
 # Author: Lance Lin <LQi254 at protonmail.com>
+#         Pierre Gruet <pgt at debian.org>
 # Date: 18 February 2022
+#       3 May 2022
 # File: run-unit-test
 # Purpose: run a simple-unit test for the ngs-sdk package
 #
 # Details:
-# Run the built-in test (make test) for the ngs-sdk package
+# Run the tests after building them against the libs in the -dev package.
 
 set -e
 
-cd ngs-sdk
-echo "run-unit-test: running configure"
-./configure
-echo "run-unit-test: making test"
-make test
-echo "run-unit-test: done"
+pkg=ngs-sdk
+
+export LC_ALL=C.UTF-8
+if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
+  AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
+  trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
+fi
+
+cp -a ngs-sdk/test/ "${AUTOPKGTEST_TMP}"
+cd "${AUTOPKGTEST_TMP}/test"
+
+# Building the test-engine lib
+cd test_engine
+g++ -c -I/usr/include/ngs/unix/generic -Wall -fpic *.cpp
+g++ -shared -o libtest_engine.so *.o
+
+# Building the test file against the lib and the test-engine lib.
+cd ../ngs-test
+g++ -I../../ -I/usr/include/ngs/unix/generic -L../test_engine -Wall -o test main.cpp -ltest_engine -lngs-c++ -lngs-adapt-c++
+
+# Running the tests and collecting the results in outputTest
+LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:../test_engine" ./test > outputTest
+
+# Now outputTest should contain something like
+# "Test cases run: 107
+# Test cases passed: 107"
+# So we remove everything before the colons, remove duplicates and check there
+# remains only one line in the file (i.e. the count of passing tests is the
+# same as the count of tests).
+sed 's/.*: //' outputTest | uniq | wc -l | grep -q "1"
+if [ $? -eq 0 ]; then
+  echo "All tests PASSED"
+fi



View it on GitLab: https://salsa.debian.org/med-team/ngs-sdk/-/compare/89ffe3e7e222b9a4f3b2aee5ecdbd1b293aa8e39...841bbf027349fb37ce6c3cd3ccf57b38048af589

-- 
View it on GitLab: https://salsa.debian.org/med-team/ngs-sdk/-/compare/89ffe3e7e222b9a4f3b2aee5ecdbd1b293aa8e39...841bbf027349fb37ce6c3cd3ccf57b38048af589
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/20220503/f6350101/attachment-0001.htm>


More information about the debian-med-commit mailing list