summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 13c715e)
raw | patch | inline | side by side (parent: 13c715e)
author | Sebastian Harl <sh@tokkee.org> | |
Fri, 2 May 2014 15:36:08 +0000 (17:36 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Fri, 2 May 2014 16:41:50 +0000 (18:41 +0200) |
This way, we actually get the right PID outside of the wrapper function and
test_lib can make sure the process is terminated on EXIT.
test_lib can make sure the process is terminated on EXIT.
t/integration/simple_config.sh | patch | blob | history | |
t/integration/simple_query.sh | patch | blob | history | |
t/integration/test_lib.sh | patch | blob | history |
index 177d934c1d83735ba8fa256fae20d29cc20c5af2..2fb1423ff5a75e20f91f0e35a802ced13e3a2995 100755 (executable)
Listen "invalid://address"
EOF
-if run_sysdbd -D -C "$SYSDBD_CONF"; then
+if run_sysdbd_foreground -D -C "$SYSDBD_CONF"; then
echo 'SysDBd accepted invalid listen address; expected: failure' >&2
exit 1
fi
Listen "$SOCKET_FILE"
EOF
-run_sysdbd -D -C "$SYSDBD_CONF" &
-sysdbd_pid=$!
+run_sysdbd -D -C "$SYSDBD_CONF"
wait_for_sysdbd
-kill $sysdbd_pid
-wait $sysdbd_pid
+stop_sysdbd
index 3be00655392eae11d377cf25acd0172d617dd480..972d246065e2b598972848a11d00d5209f4ce9b1 100755 (executable)
</Backend>
EOF
-run_sysdbd -D -C "$SYSDBD_CONF" &
-sysdbd_pid=$!
+run_sysdbd -D -C "$SYSDBD_CONF"
wait_for_sysdbd
sleep 3
-c "LOOKUP hosts WHERE attribute.invalid = 'none'" )"
echo $output | grep -E '^\[\]$'
-kill $sysdbd_pid
-wait $sysdbd_pid
+stop_sysdbd
index 7bba1515361f804e8444ed717485e87a210841b3..604d2dffb02553a5cc66a09cf8a740f724ee032c 100644 (file)
TOP_SRCDIR="$( readlink -f "$( dirname "$0" )/../.." )"
TESTDIR="$( mktemp -d )"
-trap "rm -rf '$TESTDIR'" EXIT
+trap "rm -rf '$TESTDIR'; test -z \$SYSDBD_PID || kill \$SYSDBD_PID" EXIT
mkdir "$TESTDIR/backend"
cp "$TOP_SRCDIR/t/integration/.libs/mock_plugin.so" "$TESTDIR/backend"
}
function run_sysdbd() {
+ LD_PRELOAD=$TESTDIR/libsysdb.so $MEMCHECK "$TESTDIR/sysdbd" "$@" &
+ SYSDBD_PID=$!
+}
+
+function run_sysdbd_foreground() {
LD_PRELOAD=$TESTDIR/libsysdb.so $MEMCHECK "$TESTDIR/sysdbd" "$@"
}
+function stop_sysdbd() {
+ if test -z $SYSDBD_PID; then
+ echo "Cannot stop sysdbd; PID unknown" >&2
+ exit 1
+ fi
+ kill $SYSDBD_PID
+ wait $SYSDBD_PID
+ SYSDBD_PID=''
+}
+
function wait_for_sysdbd() {
local i
for (( i=0; i<10; i++ )); do