[glfw3] 02/03: Added an autopkgtest for building with cmake

James Cowgill jcowgill-guest at moszumanska.debian.org
Wed Jan 27 14:58:45 UTC 2016


This is an automated email from the git hooks/post-receive script.

jcowgill-guest pushed a commit to branch master
in repository glfw3.

commit 18a41b01df6bd8e7c4a8e2758992fce741146d80
Author: James Cowgill <james410 at cowgill.org.uk>
Date:   Wed Jan 27 14:17:39 2016 +0000

    Added an autopkgtest for building with cmake
---
 debian/tests/CMakeLists.txt | 12 ++++++++++++
 debian/tests/build          | 15 ++-------------
 debian/tests/cmake          | 28 ++++++++++++++++++++++++++++
 debian/tests/control        |  5 ++++-
 debian/tests/glfw3_test.c   | 11 +++++++++++
 5 files changed, 57 insertions(+), 14 deletions(-)

diff --git a/debian/tests/CMakeLists.txt b/debian/tests/CMakeLists.txt
new file mode 100644
index 0000000..27a3382
--- /dev/null
+++ b/debian/tests/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Test CMake project to ensure the cmake config files work properly
+
+cmake_minimum_required(VERSION 2.8)
+project(Glfw3Test C)
+
+# Try to find glfw3
+find_package(glfw3 REQUIRED CONFIG)
+
+# Build the exexutable
+include_directories(${GLFW3_INCLUDE_DIRS})
+add_executable(glfw3_test glfw3_test.c)
+target_link_libraries (glfw3_test ${GLFW3_LIBRARY})
diff --git a/debian/tests/build b/debian/tests/build
index 4fb85a1..8526017 100644
--- a/debian/tests/build
+++ b/debian/tests/build
@@ -10,20 +10,9 @@ then
 	exit 1
 fi
 
+# Copy test program to ADTTMP and cd there
+cp debian/tests/glfw3_test.c "$ADTTMP"
 cd "$ADTTMP"
-cat <<EOF > glfw3_test.c
-#include <stdio.h>
-#include <GLFW/glfw3.h>
-
-int main(void)
-{
-    // The build test doesn't check any graphics since that would require a
-    // display server. We just call the version function.
-
-    puts(glfwGetVersionString());
-    return 0;
-}
-EOF
 
 # Build programs - once with raw libraries and once with pkg-config
 gcc -Wall -Werror -o glfw3_test1 glfw3_test.c -lglfw
diff --git a/debian/tests/cmake b/debian/tests/cmake
new file mode 100644
index 0000000..390cfd7
--- /dev/null
+++ b/debian/tests/cmake
@@ -0,0 +1,28 @@
+#!/bin/sh
+# autopkgtest check: Configure, build and run a CMake project against GLFW 3
+
+set -e
+
+# Require $ADTTMP for temporary build files
+if [ -z "$ADTTMP" ]
+then
+	echo "Required envvar \"$ADTTMP\"is not set" >&2
+	exit 1
+fi
+
+# Copy test program to ADTTMP and cd there
+cp debian/tests/CMakeLists.txt debian/tests/glfw3_test.c "$ADTTMP"
+cd "$ADTTMP"
+
+# Run CMake and build program
+CFLAGS='-Wall -Werror' cmake .
+make
+echo "build: OK"
+
+# Run it - ensure the correct version is reported
+GLFW_VERSION=$(dpkg-query -f '${Version}\n' -W libglfw3-dev | sed 's/[^.0-9].*//')
+
+TEST_RESULT=$(./glfw3_test)
+echo $TEST_RESULT
+[ $(echo $TEST_RESULT | cut -f 1 -d' ') = $GLFW_VERSION ]
+echo "run: OK"
diff --git a/debian/tests/control b/debian/tests/control
index 8f1f6b2..2855200 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,2 +1,5 @@
 Tests: build
-Depends: gcc, libc-dev, libglfw3-dev
+Depends: gcc, libc-dev, libglfw3-dev, pkg-config
+
+Tests: cmake
+Depends: cmake, gcc, libc-dev, libglfw3-dev
diff --git a/debian/tests/glfw3_test.c b/debian/tests/glfw3_test.c
new file mode 100644
index 0000000..db22a64
--- /dev/null
+++ b/debian/tests/glfw3_test.c
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include <GLFW/glfw3.h>
+
+int main(void)
+{
+    // The build test doesn't check any graphics since that would require a
+    // display server. We just call the version function.
+
+    puts(glfwGetVersionString());
+    return 0;
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/glfw3.git



More information about the Pkg-games-commits mailing list