diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000000000000000000000000000000000000..bb7544f170938511b5c8076632f51f19f74440e9 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,4 @@ +Tests: smoke +Depends: + build-essential, + libcapsule-dev, diff --git a/debian/tests/smoke b/debian/tests/smoke new file mode 100755 index 0000000000000000000000000000000000000000..2c3e5d8be547b948187a86fb6abdc2eed4bde51c --- /dev/null +++ b/debian/tests/smoke @@ -0,0 +1,54 @@ +#!/bin/bash + +# Copyright © 2017 Collabora Ltd. +# +# This library is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 of the +# License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library. If not, see <http://www.gnu.org/licenses/>. + +set -eu -o pipefail + +exec 3>&1 +BASH_XTRACEFD=3 +PS4='# execute: ' +set -x + +scratch="$(mktemp -d)" +cd "$scratch" +trap 'cd /; rm -fr $scratch' EXIT + +echo "1..5" + +cat > trivial.c <<'EOF' +#define _GNU_SOURCE + +#include <stdio.h> + +#include <capsule.h> + +int +main (void) +{ + capsule_init(); + printf( "ok 4 - capsule_init() didn't crash\n" ); + return 0; +} +EOF + +gcc -c -o trivial.o trivial.c $(pkg-config --cflags capsule) +echo "ok 1 - compiled" +gcc -o trivial trivial.o $(pkg-config --libs capsule) +echo "ok 2 - linked" +test -x trivial +echo "ok 3 - result is executable" +./trivial +echo "ok 5 - exited successfully"