[glfw3] 02/02: Add an autopkgtest

James Cowgill jcowgill-guest at moszumanska.debian.org
Sun Jan 10 18:36:46 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 e3a72f13eea2c97d0441b757ecd7a70574ecfa7b
Author: James Cowgill <james410 at cowgill.org.uk>
Date:   Sun Jan 10 18:36:20 2016 +0000

    Add an autopkgtest
---
 debian/control       |  1 +
 debian/tests/build   | 45 +++++++++++++++++++++++++++++++++++++++++++++
 debian/tests/control |  2 ++
 3 files changed, 48 insertions(+)

diff --git a/debian/control b/debian/control
index e4bb3c2..79e4b8d 100644
--- a/debian/control
+++ b/debian/control
@@ -22,6 +22,7 @@ Standards-Version: 3.9.6
 Homepage: http://www.glfw.org/
 Vcs-Git: git://anonscm.debian.org/pkg-games/glfw3.git
 Vcs-Browser: http://anonscm.debian.org/cgit/pkg-games/glfw3.git
+Testsuite: autopkgtest
 
 Package: libglfw3
 Architecture: any
diff --git a/debian/tests/build b/debian/tests/build
new file mode 100644
index 0000000..4fb85a1
--- /dev/null
+++ b/debian/tests/build
@@ -0,0 +1,45 @@
+#!/bin/sh
+# autopkgtest check: Build and run a simple program 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
+
+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
+echo "build1: OK"
+gcc -Wall -Werror -o glfw3_test2 glfw3_test.c $(pkg-config --cflags --libs glfw3)
+echo "build2: OK"
+
+# Run them - ensure the correct version is reported
+GLFW_VERSION=$(dpkg-query -f '${Version}\n' -W libglfw3-dev | sed 's/[^.0-9].*//')
+
+TEST1_RESULT=$(./glfw3_test1)
+echo $TEST1_RESULT
+[ $(echo $TEST1_RESULT | cut -f 1 -d' ') = $GLFW_VERSION ]
+echo "run1: OK"
+
+TEST2_RESULT=$(./glfw3_test2)
+echo $TEST2_RESULT
+[ $(echo $TEST2_RESULT | cut -f 1 -d' ') = $GLFW_VERSION ]
+echo "run2: OK"
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..8f1f6b2
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,2 @@
+Tests: build
+Depends: gcc, libc-dev, libglfw3-dev

-- 
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