mirror of
https://salsa.debian.org/ha-team/libqb
synced 2026-01-13 10:33:54 +00:00
* Tidy some scripts Errors reported by Centos covscan I changed %N to %s as BSD's date command doesn't support %N. Seconds + PID should be enough .... * Shrink the name of the dlock tests as they cause random failures When the PID numbers get big, the socket name overflows the allowed limit * Increase timeout of thread check. It's been seen to time out too early and fail the tests
51 lines
1.3 KiB
Bash
Executable File
51 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
RETURN=0
|
|
SOCKS_PER_PROCESS=3
|
|
|
|
IPC_NAME=`cat ipc-test-name 2>/dev/null`
|
|
for d in /dev/shm /var/run $SOCKETDIR; do
|
|
|
|
# Tidy up the deadlock checker sockets first
|
|
dlocks=$(find $d -name "qb-*-test_*dlock*${IPC_NAME}*" -size +0c 2>/dev/null)
|
|
if [ "`echo $dlocks|wc -w`" -eq $(($SOCKS_PER_PROCESS * 6)) ]; then
|
|
rm $dlocks
|
|
elif [ -n "${dlocks}" ]; then
|
|
echo
|
|
echo "Error: dlock shared memory segments not closed/unlinked"
|
|
echo
|
|
RETURN=1
|
|
fi
|
|
|
|
# Now look for other leftovers
|
|
leftovers=$(find $d -name "qb-*-test_*${IPC_NAME}*" -size +0c 2>/dev/null | wc -l)
|
|
if [ "${leftovers}" -gt 0 ]; then
|
|
echo
|
|
echo "Error: shared memory segments not closed/unlinked"
|
|
echo
|
|
RETURN=1
|
|
fi
|
|
leftovers="$(find $d -name "qb-*-test_*${IPC_NAME}*" -size 0c 2>/dev/null)"
|
|
if [ "$(printf '%s\n' "${leftovers}" | wc -l)" -eq $(($SOCKS_PER_PROCESS * 2)) ]; then
|
|
echo
|
|
echo "There were some empty leftovers (expected), removing them"
|
|
echo "${leftovers}" | tee /dev/stderr | xargs rm
|
|
echo
|
|
elif [ -n "${leftovers}" ]; then
|
|
echo
|
|
echo "Error: unexpected number of empty leftovers"
|
|
echo "${leftovers}"
|
|
echo
|
|
RETURN=1
|
|
fi
|
|
done
|
|
ps aux | grep -v grep | grep -E 'lt-.*\.test'
|
|
if [ $? -eq 0 ]; then
|
|
echo "test program frozen"
|
|
RETURN=1
|
|
fi
|
|
|
|
# Keep it tidy - distcheck checks we have not left a mess
|
|
rm -f ipc-test-name
|
|
rm -f crash_test_dummy.core
|
|
exit $RETURN
|