1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#!/bin/sh -ex
DEB_HOST_GNU_TYPE=$(dpkg-architecture -q DEB_HOST_GNU_TYPE)
CC=$DEB_HOST_GNU_TYPE-gcc
PKGCONF=$DEB_HOST_GNU_TYPE-pkgconf
cd examples
# the os_base.h in-tree header includes inttypes.h for the examples
ln -sf /usr/include/inttypes.h os_base.h # -f to enable repeated runs
$CC $($PKGCONF --cflags libqb) \
-o ipcserver ipcserver.c \
$($PKGCONF --libs libqb)
$CC $($PKGCONF --cflags libqb) \
-o ipcclient ipcclient.c \
$($PKGCONF --libs libqb)
OUT="${AUTOPKGTEST_ARTIFACTS:-.}/out.txt"
ERR="${AUTOPKGTEST_ARTIFACTS:-.}/err.txt"
./ipcserver >"$OUT" 2>"$ERR" &
pid="$!"
sleep 1 # give ipcserver ample chance to start up fully
( echo this is a test; echo q ) | ./ipcclient
sleep 1 # give ipcserver ample chance to clean up fully
kill "$pid"
cat "$ERR"
fgrep 'this is a test' "$ERR"
|