| 1 |
#!/bin/sh |
| 2 |
# autopkgtest check: Build and run a program against BoxFort, to verify that the |
| 3 |
# headers and pkg-config file are installed correctly. |
| 4 |
|
| 5 |
set -e |
| 6 |
|
| 7 |
WORKDIR=$(mktemp -d) |
| 8 |
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM |
| 9 |
cd $WORKDIR |
| 10 |
cat <<EOF > boxforttest.c |
| 11 |
#include <stdlib.h> |
| 12 |
#include "boxfort.h" |
| 13 |
|
| 14 |
#define _assert(Cond) do { if (!(Cond)) abort(); } while (0) |
| 15 |
|
| 16 |
int main() |
| 17 |
{ |
| 18 |
bxf_context ctx; |
| 19 |
_assert(!bxf_context_init(&ctx)); |
| 20 |
|
| 21 |
_assert(!bxf_context_term(ctx)); |
| 22 |
return 0; |
| 23 |
} |
| 24 |
EOF |
| 25 |
|
| 26 |
gcc -o boxforttest boxforttest.c `pkg-config --cflags --libs boxfort` |
| 27 |
echo "build: OK" |
| 28 |
[ -x boxforttest ] |
| 29 |
./boxforttest |
| 30 |
echo "run: OK" |