diff options
author | James Cowgill <james410@cowgill.org.uk> | 2016-01-09 22:34:35 +0000 |
---|---|---|
committer | James Cowgill <james410@cowgill.org.uk> | 2016-01-10 00:05:44 +0000 |
commit | 4506181d5c18cf3acb7643bd09c231dc1e174b0f (patch) | |
tree | 9bc183dbd91247fcbf188f6fd3e05a6ab9dbca62 /debian | |
parent | 39e76cc26c87785ff47b15875cd392aa993ebe3b (diff) |
Add an autopkgtest
Diffstat (limited to 'debian')
-rw-r--r-- | debian/control | 1 | ||||
-rw-r--r-- | debian/tests/build | 52 | ||||
-rw-r--r-- | debian/tests/control | 2 |
3 files changed, 55 insertions, 0 deletions
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 |