[libsfml] 04/04: Add an autopkgtest
James Cowgill
jcowgill-guest at moszumanska.debian.org
Sun Jan 10 00:17:11 UTC 2016
This is an automated email from the git hooks/post-receive script.
jcowgill-guest pushed a commit to branch master
in repository libsfml.
commit 4506181d5c18cf3acb7643bd09c231dc1e174b0f
Author: James Cowgill <james410 at cowgill.org.uk>
Date: Sat Jan 9 22:34:35 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 8297165..cf8643e 100644
--- a/debian/control
+++ b/debian/control
@@ -26,6 +26,7 @@ Build-Depends: debhelper (>= 9),
pkg-kde-tools,
Standards-Version: 3.9.6
Homepage: http://www.sfml-dev.org/
+Testsuite: autopkgtest
Package: libsfml-dev
Section: libdevel
diff --git a/debian/tests/build b/debian/tests/build
new file mode 100644
index 0000000..9f2f9f6
--- /dev/null
+++ b/debian/tests/build
@@ -0,0 +1,52 @@
+#!/bin/sh
+# autopkgtest check: Build and run a simple program against SFML
+
+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 > sfml_test.cpp
+#include <iostream>
+#include <SFML/Audio.hpp>
+#include <SFML/Graphics.hpp>
+#include <SFML/Network.hpp>
+#include <SFML/OpenGL.hpp>
+#include <SFML/System.hpp>
+#include <SFML/Window.hpp>
+
+int main()
+{
+ // 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.
+
+ // Print local IP
+ std::cout << "Local IP = " << sf::IpAddress::getLocalAddress().toString()
+ << std::endl;
+
+ // Call some time functions from sfml-system
+ if ((sf::seconds(5) + sf::milliseconds(1234)).asMilliseconds() != 6234)
+ return 1;
+
+ return 0;
+}
+EOF
+
+# Build programs - once with raw libraries and once with pkg-config
+g++ -Wall -Werror -o sfml_test1 sfml_test.cpp -lsfml-network -lsfml-system
+echo "build1: OK"
+g++ -Wall -Werror -o sfml_test2 sfml_test.cpp $(pkg-config --cflags --libs sfml-all)
+echo "build2: OK"
+
+# Run them
+./sfml_test1
+echo "run1: OK"
+./sfml_test2
+echo "run2: OK"
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..4f7c886
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,2 @@
+Tests: build
+Depends: g++, libsfml-dev
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/libsfml.git
More information about the Pkg-games-commits
mailing list