rsyslog/tests/omprog-cleanup.sh
Rainer Gerhards 58fcfc4909 testbench: work-around racy tests
some omprog tests are racy as they depend on sleep calls to "synchoronize".
We have mostly been able to change this to more reliable synchronization.
A small window of raciness remains for some tests, but this seem to be
inevitable. Tests on fully loaded systems seem to incidate that we have
solved the issue sufficiently.

If that doesn't solve the sporadic failures, we need to further think about
how to handle this.

see also https://github.com/rsyslog/rsyslog/issues/2403
2018-01-17 15:53:49 +01:00

33 lines
894 B
Bash
Executable File

#!/bin/bash
# added 2016-09-09 by singh.janmejay
# This file is part of the rsyslog project, released under ASL 2.0
. $srcdir/diag.sh init
. $srcdir/diag.sh check-command-available lsof
. $srcdir/diag.sh startup omprog-cleanup.conf
. $srcdir/diag.sh wait-startup
. $srcdir/diag.sh injectmsg 0 5
. $srcdir/diag.sh wait-queueempty
. $srcdir/diag.sh content-check "msgnum:00000000:"
. $srcdir/diag.sh getpid
old_fd_count=$(lsof -p $pid | wc -l)
for i in $(seq 5 10); do
pkill -USR1 omprog-test-bin
sleep .1
. $srcdir/diag.sh injectmsg $i 1
sleep .1
done
. $srcdir/diag.sh wait-queueempty
. $srcdir/diag.sh content-check "msgnum:00000009:"
new_fd_count=$(lsof -p $pid | wc -l)
echo OLD: $old_fd_count NEW: $new_fd_count
. $srcdir/diag.sh assert-equal $old_fd_count $new_fd_count 2
. $srcdir/diag.sh shutdown-when-empty
. $srcdir/diag.sh wait-shutdown
. $srcdir/diag.sh exit