[med-svn] [Git][med-team/libsparsepp][master] More testing

Andreas Tille (@tille) gitlab at salsa.debian.org
Tue Oct 27 16:05:57 GMT 2026



Andreas Tille pushed to branch master at Debian Med / libsparsepp


Commits:
7dd490d0 by Andreas Tille at 2026-10-27T17:03:32+01:00
More testing

- - - - -


7 changed files:

- debian/README.test
- debian/control
- debian/libsparsepp-dev.examples
- + debian/patches/fix-cxx11-examples.patch
- + debian/patches/series
- debian/rules
- debian/tests/run-unit-test


Changes:

=====================================
debian/README.test
=====================================
@@ -6,3 +6,21 @@ This package can be tested by running the provided test:
     sh run-unit-test
 
 in order to confirm its integrity.
+
+The examples are installed below /usr/share/doc/libsparsepp-dev/examples
+keeping the directory names of the upstream sources, so that the provenance
+of each file stays visible:
+
+    *.cc+makefile	shipped by upstream as examples/*
+    tests/      	shipped by upstream as tests
+
+All the C++ sources are built and run at package build time and in the
+autopkgtest, with the exception of two upstream tests:
+
+    tests/spp_bitset_test.cc
+        Includes <sparsepp/spp_bitset.h>, a header that is not part of the
+        source release (and does not exist upstream either).
+
+    tests/perftest1.cc
+        A benchmark without any assertions that runs for about 70 seconds;
+        it is shipped but not run to keep build and test times reasonable.


=====================================
debian/control
=====================================
@@ -5,6 +5,7 @@ Uploaders:
  Andreas Tille <tille at debian.org>,
 Build-Depends:
  debhelper-compat (= 14),
+ dh-sequence-single-binary,
 Standards-Version: 4.7.4
 Vcs-Browser: https://salsa.debian.org/med-team/libsparsepp
 Vcs-Git: https://salsa.debian.org/med-team/libsparsepp.git


=====================================
debian/libsparsepp-dev.examples
=====================================
@@ -1,4 +1,3 @@
 examples/*.cc
 examples/makefile
-tests/spp_test.cc
-tests/spp_alloc_test.cc
+tests


=====================================
debian/patches/fix-cxx11-examples.patch
=====================================
@@ -0,0 +1,48 @@
+Description: Make the examples build with C++11, as the upstream makefile requests
+ insert_rvalue.cc defines its own make_unique unconditionally, which clashes
+ with std::make_unique from C++14 on.  test.cc uses a deduced return type and
+ structured bindings, which are only available with C++17.  Both files are
+ shipped to users and should build out of the box with the flags the upstream
+ makefiles use.
+Author: Andreas Tille <tille at debian.org>
+Forwarded: no
+Last-Update: 2026-10-27
+---
+--- a/examples/insert_rvalue.cc
++++ b/examples/insert_rvalue.cc
+@@ -4,11 +4,14 @@
+ 
+ using namespace std;
+ 
++#if __cplusplus < 201402L
++// std::make_unique is only available from C++14 on.
+ template<typename T, typename... Args>
+ std::unique_ptr<T> make_unique(Args&&... args)
+ {
+     return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
+ }
++#endif
+ 
+ int main()
+ {
+--- a/examples/test.cc
++++ b/examples/test.cc
+@@ -3,14 +3,15 @@
+ #include <iostream>
+ #include <string>
+ 
+-auto bar() {
++auto bar() -> std::tuple<int, double, const char*> {
+ 	return std::make_tuple(3, 4.5, "Some string");
+ }
+ 
+ int main()
+ {
+-	auto[c, d, e] = bar();
+-	std::cout << "c: " << c << ", d: " << d << ", e: " << e << "\n";
++	auto t = bar();
++	std::cout << "c: " << std::get<0>(t) << ", d: " << std::get<1>(t)
++	          << ", e: " << std::get<2>(t) << "\n";
+ 
+ 	spp::sparse_hash_set<int> test1;
+ 	spp::sparse_hash_set<int> test2 = std::move(test1);


=====================================
debian/patches/series
=====================================
@@ -0,0 +1 @@
+fix-cxx11-examples.patch


=====================================
debian/rules
=====================================
@@ -3,10 +3,32 @@
 %:
 	dh $@
 
-# Header-only library: there is no build system at the top level, so run the
-# upstream test suite explicitly instead of relying on dh_auto_test.
+# Header-only library: there is no build system at the top level, so build and
+# run every shipped example and test explicitly instead of relying on
+# dh_auto_test.  tests/perftest1.cc (a 70 second benchmark without assertions)
+# and tests/spp_bitset_test.cc (needs a header that upstream does not ship) are
+# left out; see debian/README.test.
 override_dh_auto_test:
-	for test in spp_test spp_alloc_test ; do \
-	    $(CXX) -O2 -std=c++11 -D_XOPEN_SOURCE=700 \
-	        -I. -o $$test tests/$$test.cc && ./$$test > /dev/null ; \
+	set -e ; top=$$(pwd) ; \
+	for src in examples/*.cc tests/spp_test.cc tests/spp_alloc_test.cc \
+	           tests/spp_relative_include_test.cc ; do \
+	    name=$$(basename $$src .cc) ; \
+	    rm -rf test/$$name ; mkdir -p test/$$name ; \
+	    cd test/$$name ; \
+	    case $$name in \
+	        spp_relative_include_test) \
+	            $(CXX) -O2 -std=c++11 -D_XOPEN_SOURCE=700 \
+	                -o $$name $$top/$$src ;; \
+	        *) \
+	            $(CXX) -O2 -std=c++11 -D_XOPEN_SOURCE=700 -I$$top \
+	                -o $$name $$top/$$src ;; \
+	    esac ; \
+	    ./$$name > /dev/null ; \
+	    cd $$top ; \
 	done
+	rm -rf test
+
+# dh_installexamples keeps the upstream directory names, and thus the
+# provenance of each file, only when it is given an exclude, so pass -X.
+override_dh_installexamples:
+	dh_installexamples -X spp_bitset_test -X vsprojects


=====================================
debian/tests/run-unit-test
=====================================
@@ -13,8 +13,18 @@ cp -a /usr/share/doc/${pkg}/examples/* "${AUTOPKGTEST_TMP}"
 
 cd "${AUTOPKGTEST_TMP}"
 
-# Build and run the upstream unit tests against the installed headers.
-for test in spp_test spp_alloc_test ; do
-    g++ -O2 -std=c++11 -D_XOPEN_SOURCE=700 -o "${test}" "${test}.cc"
-    "./${test}" > /dev/null
+# The examples shipped upstream in examples/ reside directly in this directory
+# while tests/ contains upstream tests.  Build and run all of them, each one in
+# its own directory because some of them write data files.  The symlink lets
+# tests/spp_relative_include_test.cc find "../sparsepp/spp.h" as it does in the
+# upstream tree.
+top="${AUTOPKGTEST_TMP}"
+ln -s /usr/include/sparsepp sparsepp
+for src in *.cc tests/spp_test.cc tests/spp_alloc_test.cc \
+           tests/spp_relative_include_test.cc ; do
+    name=$(basename "${src}" .cc)
+    mkdir -p "${top}/run/${name}"
+    ( cd "${top}/run/${name}" &&
+      g++ -O2 -std=c++11 -D_XOPEN_SOURCE=700 -o "${name}" "${top}/${src}" &&
+      "./${name}" > /dev/null )
 done



View it on GitLab: https://salsa.debian.org/med-team/libsparsepp/-/commit/7dd490d03a3eab9ee744990cf29bd9488bd2dd23

-- 
View it on GitLab: https://salsa.debian.org/med-team/libsparsepp/-/commit/7dd490d03a3eab9ee744990cf29bd9488bd2dd23
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


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


More information about the debian-med-commit mailing list