| 1 |
#!/bin/sh |
| 2 |
# autopkgtest check: Build and run a program against libdatrie, to verify that |
| 3 |
# the 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 |
|
| 11 |
if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then |
| 12 |
CROSS_COMPILE="$DEB_HOST_GNU_TYPE-" |
| 13 |
else |
| 14 |
CROSS_COMPILE= |
| 15 |
fi |
| 16 |
|
| 17 |
cat <<EOF > libdatrietest.c |
| 18 |
#include <datrie/trie.h> |
| 19 |
#include <assert.h> |
| 20 |
|
| 21 |
int main (int argc, char *argv[]) |
| 22 |
{ |
| 23 |
AlphaMap* m = alpha_map_new(); |
| 24 |
assert (m != 0); |
| 25 |
assert (alpha_map_add_range (m, 0x0061, 0x007a) == 0); |
| 26 |
|
| 27 |
Trie* t = trie_new (m); |
| 28 |
assert (t != 0); |
| 29 |
|
| 30 |
alpha_map_free (m); |
| 31 |
trie_free (t); |
| 32 |
|
| 33 |
return 0; |
| 34 |
} |
| 35 |
EOF |
| 36 |
|
| 37 |
${CROSS_COMPILE}gcc -o libdatrietest libdatrietest.c \ |
| 38 |
$(${CROSS_COMPILE}pkg-config --cflags --libs datrie-0.2) |
| 39 |
echo "build: OK" |
| 40 |
[ -x libdatrietest ] |
| 41 |
./libdatrietest |
| 42 |
echo "run: OK" |