[libcsfml] 04/04: Add an autopkgtest

James Cowgill jcowgill-guest at moszumanska.debian.org
Sun Jan 10 00:16:22 UTC 2016


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

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

commit 909bb3385726a9bd357d682db5f124f468e5416b
Author: James Cowgill <james410 at cowgill.org.uk>
Date:   Sun Jan 10 00:04:03 2016 +0000

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

diff --git a/debian/control b/debian/control
index 311dc44..0a4c3d0 100644
--- a/debian/control
+++ b/debian/control
@@ -12,6 +12,7 @@ Build-Depends: debhelper (>= 9),
  libsfml-dev (>= 2.3)
 Standards-Version: 3.9.6
 Homepage: http://www.sfml-dev.org
+Testsuite: autopkgtest
 
 Package: libcsfml-dev
 Section: libdevel
diff --git a/debian/tests/build b/debian/tests/build
new file mode 100644
index 0000000..7190d7c
--- /dev/null
+++ b/debian/tests/build
@@ -0,0 +1,52 @@
+#!/bin/sh
+# autopkgtest check: Build and run a simple program against CSFML
+
+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 > csfml_test.c
+#include <stdio.h>
+#include <SFML/Audio.h>
+#include <SFML/Graphics.h>
+#include <SFML/Network.h>
+#include <SFML/OpenGL.h>
+#include <SFML/System.h>
+#include <SFML/Window.h>
+
+int main(void)
+{
+    // The build test doesn't check any graphics since that would require a
+    // display server. We just test some basic Network / System functionality.
+    // However when building we can still include the other headers to ensure
+    // they compile.
+
+    char buf[16];
+    sfIpAddress local_addr;
+
+    // Print local IP
+    local_addr = sfIpAddress_getLocalAddress();
+    sfIpAddress_toString(local_addr, buf);
+    printf("Local IP = %s\n", buf);
+
+    // Call some time functions from sfml-system
+    if (sfTime_asMilliseconds(sfSeconds(5)) != 5000)
+        return 1;
+
+    return 0;
+}
+EOF
+
+# Build program
+gcc -Wall -Werror -o csfml_test csfml_test.c -lcsfml-graphics -lcsfml-window -lcsfml-audio -lcsfml-network -lcsfml-system
+echo "build: OK"
+
+# Run it
+./csfml_test
+echo "run: OK"
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..7fd98ae
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,2 @@
+Tests: build
+Depends: gcc, libc-dev, libcsfml-dev

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



More information about the Pkg-games-commits mailing list