| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
exec 2>&1 |
| 4 |
set -eux |
| 5 |
|
| 6 |
if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then |
| 7 |
CROSS_COMPILE="$DEB_HOST_GNU_TYPE-" |
| 8 |
else |
| 9 |
CROSS_COMPILE= |
| 10 |
fi |
| 11 |
|
| 12 |
cd "${AUTOPKGTEST_TMP:-"${AUTOPKGTEST_TMP}"}" |
| 13 |
|
| 14 |
echo "1..2" |
| 15 |
|
| 16 |
cat > simple.c <<'EOF' |
| 17 |
#include <libinput.h> |
| 18 |
|
| 19 |
#include <fcntl.h> |
| 20 |
#include <stdio.h> |
| 21 |
#include <sys/stat.h> |
| 22 |
#include <sys/types.h> |
| 23 |
#include <unistd.h> |
| 24 |
|
| 25 |
static int |
| 26 |
my_open (const char *path, int flags, void *user_data) |
| 27 |
{ |
| 28 |
return open (path, flags); |
| 29 |
} |
| 30 |
|
| 31 |
static void |
| 32 |
my_close (int fd, void *user_data) |
| 33 |
{ |
| 34 |
close (fd); |
| 35 |
} |
| 36 |
|
| 37 |
static struct libinput_interface iface = { my_open, my_close }; |
| 38 |
|
| 39 |
int |
| 40 |
main (void) |
| 41 |
{ |
| 42 |
struct libinput *ctx; |
| 43 |
|
| 44 |
ctx = libinput_path_create_context (&iface, NULL); |
| 45 |
|
| 46 |
if (ctx) |
| 47 |
libinput_unref (ctx); |
| 48 |
|
| 49 |
return 0; |
| 50 |
} |
| 51 |
EOF |
| 52 |
|
| 53 |
${CROSS_COMPILE}gcc -o dynamic simple.c $(${CROSS_COMPILE}pkg-config --cflags --libs libinput) |
| 54 |
echo "ok 1 - compile dynamic executable" |
| 55 |
test -x dynamic |
| 56 |
./dynamic |
| 57 |
echo "ok 2 - run dynamic executable" |
| 58 |
|
| 59 |
# This should also be tested if linking statically to libinput is supported |
| 60 |
#gcc -static -o static simple.c $(pkg-config --static --cflags --libs libinput) |
| 61 |
#echo "ok 3 - compile static executable" |
| 62 |
#test -x static |
| 63 |
#./static |
| 64 |
#echo "ok 4 - run static executable" |
| 65 |
|
| 66 |
echo "# everything seems OK" |