Source: glm
Severity: minor

Dear Maintainer,

As discussed in #827799, glm is missing a packaging testsuite.

Please find a patch attached to this bug report, which provides an initial
attempt. It builds and triggers the upstream testsuite against the
installed packages, thereby testing the integrity of the headers and the
CMake configuration files.

Best regards,
Ghis

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (900, 'testing'), (300, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.6.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
>From 6d4f77f8cdb47030897bbc8791403e1f03a800b0 Mon Sep 17 00:00:00 2001
From: Ghislain Antony Vaillant <[email protected]>
Date: Wed, 24 Aug 2016 18:41:37 +0100
Subject: [PATCH 3/4] Add packaging testsuite.

---
 debian/control         |  1 +
 debian/tests/control   |  2 ++
 debian/tests/glm-tests | 42 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+)
 create mode 100644 debian/tests/control
 create mode 100755 debian/tests/glm-tests

diff --git a/debian/control b/debian/control
index 5fe7daf..c04b135 100644
--- a/debian/control
+++ b/debian/control
@@ -4,6 +4,7 @@ Maintainer: Guus Sliepen <[email protected]>
 Build-Depends: debhelper (>= 7.0.50~), cmake
 Standards-Version: 3.9.8
 Section: libs
+Testsuite: autopkgtest
 Homepage: http://glm.g-truc.net/
 
 Package: libglm-dev
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..bb9e688
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,2 @@
+Tests: glm-tests
+Depends: cmake, g++ | c++-compiler, libglm-dev
diff --git a/debian/tests/glm-tests b/debian/tests/glm-tests
new file mode 100755
index 0000000..4d43ca8
--- /dev/null
+++ b/debian/tests/glm-tests
@@ -0,0 +1,42 @@
+#!/bin/sh
+# Copyright 2016 Ghislain Antony Vaillant
+#
+# This file is part of the packaging testsuite for glm.
+
+set -e
+
+# Copy the upstream testsuite.
+cp -a ./test/* "$AUTOPKGTEST_TMP"
+
+cd "$AUTOPKGTEST_TMP"
+
+# Create a standalone CMake project.
+rm CMakeLists.txt
+
+cat << EOF > CMakeLists.txt
+cmake_minimum_required(VERSION 3.0)
+project(glm-tests)
+
+enable_testing()
+
+find_package(glm REQUIRED)
+include_directories(SYSTEM \${glm_INCLUDE_DIRS})
+include_directories(external)
+
+function(glmCreateTestGTC NAME)
+  set(SAMPLE_NAME test-\${NAME})
+  add_executable(\${SAMPLE_NAME} \${NAME}.cpp)
+  add_test(NAME \${SAMPLE_NAME}
+           COMMAND \$<TARGET_FILE:\${SAMPLE_NAME}>)
+endfunction()
+
+add_subdirectory(bug)
+add_subdirectory(core)
+add_subdirectory(gtc)
+add_subdirectory(gtx)
+
+EOF
+
+# Configure, build and execute.
+mkdir build && cd build
+cmake .. 2>&1 && make 2>&1 && make test
-- 
2.9.3

Reply via email to