mirror of
https://github.com/stefanberger/swtpm.git
synced 2026-08-09 05:53:54 +00:00
tests: delay reading of pidfile if found empty
Delay the reading of the PID file if it is found to be empty. This can happend if swtpm is run by valgrind. Also, use the passed parameters rather than the global ones to check the PID file contents against the expected pid. So far this worked because PID and PID_FILE were variables used by every caller. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
parent
41cae9e1bd
commit
996ad55fbc
@ -735,8 +735,14 @@ function validate_pidfile()
|
||||
{
|
||||
local pid="$1"
|
||||
local pidfile="$2"
|
||||
local rpid="$(cat $pidfile)"
|
||||
|
||||
if [ "$PID" != "$(cat $PID_FILE)" ]; then
|
||||
if [ -z "$rpid" ]; then
|
||||
sleep 0.1
|
||||
rpid="$(cat $pidfile)"
|
||||
fi
|
||||
|
||||
if [ "$pid" != "$rpid" ]; then
|
||||
echo "Error: pid file contains unexpected PID value."
|
||||
echo "expected: $pid"
|
||||
echo "actual : $(cat $pidfile)"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user