tests: Make the killing of processes less noisy

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
Stefan Berger 2018-08-02 21:23:56 -04:00
parent 313cf75c42
commit 47c7ea7783
43 changed files with 184 additions and 170 deletions

View File

@ -24,7 +24,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -f $keyfile $logfile
rm -rf $TPM_PATH
@ -43,7 +43,7 @@ run_swtpm ${SWTPM_INTERFACE} \
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
echo "TPM Logfile:"
@ -60,7 +60,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
echo "TPM Logfile:"
@ -146,7 +146,7 @@ run_swtpm ${SWTPM_INTERFACE} \
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error (2): ${SWTPM_INTERFACE} TPM did not start."
echo "TPM Logfile:"

View File

@ -19,7 +19,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
@ -33,7 +33,7 @@ rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null
run_swtpm ${SWTPM_INTERFACE}
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -47,7 +47,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1
@ -60,7 +60,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after getting capabilities."
exit 1

View File

@ -19,7 +19,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
@ -35,7 +35,7 @@ run_swtpm ${SWTPM_INTERFACE}
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -48,7 +48,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1

View File

@ -19,7 +19,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
@ -35,7 +35,7 @@ run_swtpm ${SWTPM_INTERFACE}
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -50,7 +50,7 @@ fi
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1

View File

@ -20,7 +20,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
@ -36,7 +36,7 @@ run_swtpm ${SWTPM_INTERFACE} --tpmstate dir=$TPM_PATH --pid file=$PID_FILE
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -62,7 +62,7 @@ fi
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1
@ -80,7 +80,7 @@ if [ "$(id -u)" != "0" ]; then
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after failed INIT."
exit 1
@ -96,7 +96,7 @@ if [ "$(id -u)" != "0" ]; then
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1

View File

@ -19,7 +19,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
@ -35,7 +35,7 @@ run_swtpm ${SWTPM_INTERFACE}
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -48,7 +48,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1

View File

@ -38,7 +38,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $migpwdfile $volatilestatefile $tpmstatedir
}
@ -56,7 +56,7 @@ run_swtpm ${SWTPM_INTERFACE} --migration-key pwdfile=$migpwdfile,remove=false
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -69,7 +69,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1
@ -157,7 +157,7 @@ run_swtpm ${SWTPM_INTERFACE} --migration-key pwdfile=$migpwdfile,remove=false
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -207,7 +207,7 @@ run_swtpm ${SWTPM_INTERFACE}
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -239,7 +239,7 @@ run_swtpm ${SWTPM_INTERFACE} --migration-key pwdfile=$migpwdfile,remove=true
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1

View File

@ -23,7 +23,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $tpmstatedir
}
@ -42,7 +42,7 @@ run_swtpm ${SWTPM_INTERFACE}
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -55,7 +55,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1
@ -98,7 +98,7 @@ run_swtpm ${SWTPM_INTERFACE} --key pwdfile=${TESTDIR}/data/tpmstate2/pwdfile.txt
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -111,7 +111,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1

View File

@ -26,7 +26,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -f $keyfile $logfile
rm -rf $TPM_PATH
@ -45,7 +45,7 @@ run_swtpm ${SWTPM_INTERFACE} \
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
echo "TPM Logfile:"
@ -62,7 +62,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
echo "TPM Logfile:"
@ -175,7 +175,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error (2): ${SWTPM_INTERFACE} TPM is not running anymore."
echo "TPM Logfile:"
@ -308,7 +308,7 @@ run_swtpm ${SWTPM_INTERFACE} \
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
echo "TPM Logfile:"
@ -325,7 +325,7 @@ if [ $? -eq 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after failed INIT."
echo "TPM Logfile:"

View File

@ -23,7 +23,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -f $logfile
rm -rf $TPM_PATH
@ -41,7 +41,7 @@ run_swtpm ${SWTPM_INTERFACE} \
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
echo "TPM Logfile:"
@ -58,7 +58,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
echo "TPM Logfile:"
@ -171,7 +171,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error (2): ${SWTPM_INTERFACE} TPM is not running anymore."
echo "TPM Logfile:"

View File

@ -20,7 +20,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
@ -34,7 +34,7 @@ rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null
run_swtpm ${SWTPM_INTERFACE}
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -81,7 +81,7 @@ if [ $? -eq 0 ]; then
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1

View File

@ -21,7 +21,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
@ -37,7 +37,7 @@ run_swtpm ${SWTPM_INTERFACE} --tpmstate dir=$TPM_PATH --pid file=$PID_FILE
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -63,7 +63,7 @@ fi
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1

View File

@ -24,7 +24,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -f $keyfile $logfile
rm -rf $TPM_PATH
@ -44,7 +44,7 @@ run_swtpm ${SWTPM_INTERFACE} \
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
echo "TPM Logfile:"
@ -61,7 +61,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
echo "TPM Logfile:"
@ -148,7 +148,7 @@ run_swtpm ${SWTPM_INTERFACE} \
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error (2): ${SWTPM_INTERFACE} TPM did not start."
echo "TPM Logfile:"
@ -248,7 +248,7 @@ fi
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -eq 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
echo "TPM Logfile:"

View File

@ -19,7 +19,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
@ -36,7 +36,7 @@ run_swtpm ${SWTPM_INTERFACE} --tpm2
ps aux | grep $SWTPM | grep -v grep
ls -l /dev/vtpm*
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -49,7 +49,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1
@ -61,7 +61,7 @@ if [ $? -ne 0 ]; then
echo "Error: Could not get the capability flags of the ${SWTPM_INTERFACE} TPM."
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after getting capabilities."
exit 1
@ -81,7 +81,7 @@ fi
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -eq 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
exit 1

View File

@ -20,7 +20,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
@ -36,7 +36,7 @@ run_swtpm ${SWTPM_INTERFACE} --tpm2
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -49,7 +49,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1
@ -169,7 +169,7 @@ fi
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -eq 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
exit 1

View File

@ -19,7 +19,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
@ -35,7 +35,7 @@ run_swtpm ${SWTPM_INTERFACE} --tpm2
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -48,7 +48,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1
@ -177,7 +177,7 @@ fi
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -eq 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
exit 1

View File

@ -19,7 +19,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
@ -35,7 +35,7 @@ run_swtpm ${SWTPM_INTERFACE} --tpm2
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -48,7 +48,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1

View File

@ -19,7 +19,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
@ -35,7 +35,7 @@ run_swtpm ${SWTPM_INTERFACE} --tpm2
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -48,7 +48,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1
@ -66,7 +66,7 @@ if [ "$(id -u)" != "0" ]; then
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after failed INIT."
exit 1
@ -82,7 +82,7 @@ if [ "$(id -u)" != "0" ]; then
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1
@ -98,7 +98,7 @@ fi
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -eq 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
exit 1

View File

@ -19,7 +19,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
@ -35,7 +35,7 @@ run_swtpm ${SWTPM_INTERFACE} --tpm2
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -48,7 +48,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1
@ -146,7 +146,7 @@ fi
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -eq 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
exit 1

View File

@ -16,7 +16,7 @@ function cleanup()
{
pid=$SWTPM_PID
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $migpwdfile $volatilestatefile $tpmstatedir $logfile
}
@ -59,7 +59,7 @@ run_swtpm ${SWTPM_INTERFACE} \
--tpm2 \
--migration-key pwdfile=$migpwdfile,remove=false
kill -0 $SWTPM_PID
kill_quiet -0 $SWTPM_PID
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -72,7 +72,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 $SWTPM_PID 2>/dev/null
kill_quiet -0 $SWTPM_PID 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1
@ -141,7 +141,7 @@ run_swtpm ${SWTPM_INTERFACE} \
ps aux | grep $SWTPM | grep -v grep
kill -0 $SWTPM_PID
kill_quiet -0 $SWTPM_PID
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -198,7 +198,7 @@ run_swtpm ${SWTPM_INTERFACE} \
ps aux | grep $SWTPM | grep -v grep
kill -0 $SWTPM_PID
kill_quiet -0 $SWTPM_PID
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -248,7 +248,7 @@ run_swtpm ${SWTPM_INTERFACE} \
ps aux | grep $SWTPM | grep -v grep
kill -0 $SWTPM_PID
kill_quiet -0 $SWTPM_PID
if [ $? -ne 0 ]; then
echo "Error: TPM did not start."
cat $logfile

View File

@ -19,7 +19,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
@ -35,7 +35,7 @@ run_swtpm ${SWTPM_INTERFACE} --tpm2
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1

View File

@ -23,7 +23,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $tpmstatedir
}
@ -42,7 +42,7 @@ run_swtpm ${SWTPM_INTERFACE} --tpm2
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: CUSE TPM did not start."
exit 1
@ -55,7 +55,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: CUSE TPM not running anymore after INIT."
exit 1
@ -100,7 +100,7 @@ run_swtpm ${SWTPM_INTERFACE} \
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: CUSE TPM did not start."
exit 1
@ -113,7 +113,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: CUSE TPM not running anymore after INIT."
exit 1

View File

@ -26,7 +26,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -f $keyfile $logfile
rm -rf $TPM_PATH
@ -46,7 +46,7 @@ run_swtpm ${SWTPM_INTERFACE} \
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
echo "TPM Logfile:"
@ -63,7 +63,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
echo "TPM Logfile:"
@ -141,7 +141,7 @@ rm -f $VOLATILE_STATE_FILE $STATE_FILE
exec 100>&-
run_swtpm_ioctl ${SWTPM_INTERFACE} --stop
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error (2): ${SWTPM_INTERFACE} TPM is not running anymore."
echo "TPM Logfile:"
@ -251,7 +251,7 @@ if [ $? -ne 0 ]; then
fi
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -eq 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
echo "TPM Logfile:"
@ -277,7 +277,7 @@ run_swtpm ${SWTPM_INTERFACE} \
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
echo "TPM Logfile:"
@ -294,7 +294,7 @@ if [ $? -eq 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after failed INIT."
echo "TPM Logfile:"
@ -325,7 +325,7 @@ if [ $? -ne 0 ]; then
fi
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -eq 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
echo "TPM Logfile:"

View File

@ -23,7 +23,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -f $logfile
rm -rf $TPM_PATH
@ -42,7 +42,7 @@ run_swtpm ${SWTPM_INTERFACE} \
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
echo "TPM Logfile:"
@ -59,7 +59,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
echo "TPM Logfile:"
@ -144,7 +144,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error (2): ${SWTPM_INTERFACE} TPM is not running anymore."
echo "TPM Logfile:"
@ -258,7 +258,7 @@ fi
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -eq 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
echo "TPM Logfile:"

View File

@ -24,7 +24,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -f $logfile
rm -rf $TPM_PATH
@ -43,7 +43,7 @@ run_swtpm ${SWTPM_INTERFACE} \
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
echo "TPM Logfile:"
@ -60,7 +60,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
echo "TPM Logfile:"
@ -221,7 +221,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error (2): ${SWTPM_INTERFACE} TPM is not running anymore."
echo "TPM Logfile:"
@ -312,7 +312,7 @@ fi
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -eq 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
echo "TPM Logfile:"

View File

@ -19,7 +19,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
@ -35,7 +35,7 @@ run_swtpm ${SWTPM_INTERFACE} --tpm2
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -48,7 +48,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1
@ -142,7 +142,7 @@ fi
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -eq 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
exit 1

View File

@ -20,7 +20,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
@ -34,7 +34,7 @@ rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null
run_swtpm ${SWTPM_INTERFACE} --tpm2
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -73,7 +73,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1
@ -116,7 +116,7 @@ fi
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -eq 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
exit 1

View File

@ -20,7 +20,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
@ -36,7 +36,7 @@ run_swtpm ${SWTPM_INTERFACE} --tpm2 --tpmstate dir=$TPM_PATH --pid file=$PID_FIL
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -62,7 +62,7 @@ fi
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1
@ -153,7 +153,7 @@ fi
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -eq 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
exit 1

View File

@ -19,7 +19,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
@ -35,7 +35,7 @@ run_swtpm ${SWTPM_INTERFACE} --tpm2
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -48,7 +48,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1
@ -118,7 +118,7 @@ run_swtpm ${SWTPM_INTERFACE} --tpm2
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -222,7 +222,7 @@ fi
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -eq 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
exit 1

View File

@ -19,7 +19,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
@ -35,7 +35,7 @@ run_swtpm ${SWTPM_INTERFACE} --tpm2
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -58,7 +58,7 @@ if [ $? -eq 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM must have crashed."
exit 1
@ -80,7 +80,7 @@ fi
exec 100>&-
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM must have crashed."
exit 1
@ -93,7 +93,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1
@ -107,7 +107,7 @@ fi
sleep 0.5
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -eq 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
exit 1

View File

@ -19,7 +19,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}

View File

@ -19,7 +19,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
@ -35,7 +35,7 @@ run_swtpm ${SWTPM_INTERFACE}
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -48,7 +48,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1
@ -117,7 +117,7 @@ run_swtpm ${SWTPM_INTERFACE}
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1

View File

@ -20,7 +20,7 @@ function cleanup()
{
pid=${SWTPM_PID}
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
@ -37,7 +37,7 @@ run_swtpm ${SWTPM_INTERFACE} --log file=$LOG_FILE,level=20
ps aux | grep $SWTPM | grep -v grep
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
exit 1
@ -60,7 +60,7 @@ if [ $? -eq 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM must have crashed."
exit 1
@ -80,7 +80,7 @@ fi
exec 100>&-
kill -0 ${SWTPM_PID}
kill_quiet -0 ${SWTPM_PID}
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM must have crashed."
exit 1
@ -93,7 +93,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
kill -0 ${SWTPM_PID} 2>/dev/null
kill_quiet -0 ${SWTPM_PID} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
exit 1

View File

@ -7,6 +7,18 @@ ECHO=$(type -P echo)
# Note: Do not use file descriptors above 127 due to OpenBSD.
# Kill a process quietly
# @1: signal, e.g. -9
# @2: pid
function kill_quiet()
{
local sig="$1"
local pid="$2"
bash -c "kill $sig $pid &>/dev/null"
return $?
}
# Wait for a regular file to appear
#
# @1: filename
@ -55,7 +67,7 @@ function wait_process_gone()
local loops=$((timeout * 10)) loop
for ((loop=0; loop<loops; loop++)); do
kill -0 ${pid} || return 1
kill_quiet -0 ${pid} || return 1
sleep 0.1
done
return 0

View File

@ -20,7 +20,7 @@ function cleanup()
{
rm -rf $TPMDIR
if [ -n "$PID" ]; then
kill -SIGTERM $PID 2>/dev/null
kill_quiet -SIGTERM $PID 2>/dev/null
fi
}
@ -77,7 +77,7 @@ PID=$!
wait_port_open $PORT $PID
kill -0 $PID
kill_quiet -0 $PID
if [ $? -ne 0 ]; then
echo "Test 1 failed: TPM process not running"
exit 1
@ -104,16 +104,16 @@ fi
check_logfile_patterns_level_20 $LOG_FILE
rm -f $LOG_FILE
kill -SIGTERM $PID &>/dev/null
kill_quiet -SIGTERM $PID &>/dev/null
sleep 1
exec 20<&1-; exec 21<&2-
kill -0 $PID &>/dev/null
kill_quiet -0 $PID &>/dev/null
RES=$?
exec 1<&20-; exec 2<&21-
if [ $RES -eq 0 ]; then
kill -SIGKILL $PID
kill_quiet -SIGKILL $PID
echo "Test 1 failed: TPM process did not terminate on SIGTERM"
exit 1
fi
@ -131,7 +131,7 @@ PID=$!
wait_port_open $PORT $PID
exec 20<&1-; exec 21<&2-
kill -0 $PID
kill_quiet -0 $PID
RES=$?
exec 1<&20-; exec 2<&21-
@ -153,12 +153,12 @@ wait_port_closed $PORT $PID
sleep 1
exec 20<&1-; exec 21<&2-
kill -0 $PID
kill_quiet -0 $PID
RES=$?
exec 1<&20-; exec 2<&21-
if [ $RES -eq 0 ]; then
kill -SIGKILL $PID
kill_quiet -SIGKILL $PID
echo "Test 2 failed: TPM process did not terminate on connection loss"
exit 1
fi

View File

@ -20,7 +20,7 @@ function cleanup()
{
rm -rf $TPMDIR
if [ -n "$PID" ]; then
kill -SIGTERM $PID 2>/dev/null
kill_quiet -SIGTERM $PID 2>/dev/null
fi
}

View File

@ -23,7 +23,7 @@ function cleanup()
{
rm -rf $TPMDIR
if [ -n "$PID" ]; then
kill -SIGTERM $PID 2>/dev/null
kill_quiet -SIGTERM $PID 2>/dev/null
fi
}

View File

@ -18,7 +18,7 @@ function cleanup()
{
rm -rf $TPMDIR
if [ -n "$PID" ]; then
kill -SIGTERM $PID 2>/dev/null
kill_quiet -SIGTERM $PID 2>/dev/null
fi
}

View File

@ -18,7 +18,7 @@ function cleanup()
{
rm -rf $TPMDIR
if [ -n "$PID" ]; then
kill -SIGTERM $PID 2>/dev/null
kill_quiet -SIGTERM $PID 2>/dev/null
fi
}

View File

@ -24,7 +24,7 @@ function cleanup()
{
rm -rf $TPMDIR
if [ -n "$PID" ]; then
kill -SIGTERM $PID 2>/dev/null
kill_quiet -SIGTERM $PID 2>/dev/null
fi
}
@ -107,7 +107,7 @@ if [ $? -ne 0 ]; then
fi
sleep 0.2
kill -0 $PID 2>/dev/null
kill_quiet -0 $PID 2>/dev/null
if [ $? -eq 0 ]; then
echo "Error: TPM should not be running anymore."
exit 1
@ -303,7 +303,7 @@ if [ $? -ne 0 ]; then
fi
sleep 0.2
kill -0 $PID 2>/dev/null
kill_quiet -0 $PID 2>/dev/null
if [ $? -eq 0 ]; then
echo "Error: Socket TPM should not be running anymore."
exit 1
@ -369,7 +369,7 @@ if [ $? -ne 0 ]; then
fi
sleep 0.2
kill -0 $PID 2>/dev/null
kill_quiet -0 $PID 2>/dev/null
if [ $? -eq 0 ]; then
echo "Error: Socket TPM should not be running anymore."
exit 1
@ -485,7 +485,7 @@ if [ $? -ne 0 ]; then
fi
sleep 0.2
kill -0 $PID 2>/dev/null
kill_quiet -0 $PID 2>/dev/null
if [ $? -eq 0 ]; then
echo "Error: Socket TPM should not be running anymore."
exit 1

View File

@ -48,7 +48,7 @@ function cleanup()
# remove files from tss tools
rm -f h01*.bin nvp*.bin
if [ -n "$PID" ]; then
kill -SIGTERM $PID 2>/dev/null
kill_quiet -SIGTERM $PID 2>/dev/null
fi
}

View File

@ -26,13 +26,14 @@ function cleanup()
{
pid=$(ps aux | grep $SWTPM | grep -E " file=${PID_FILE}\$" | gawk '{print $2}')
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
trap "cleanup" EXIT
source ${TESTDIR}/common
source ${TESTDIR}/load_vtpm_proxy
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null
@ -43,7 +44,7 @@ PID=$(ps aux | grep $SWTPM | grep -E " file=${PID_FILE}\$" | gawk '{print $2}')
ps aux | grep $SWTPM | grep -v grep
kill -0 $PID
kill_quiet -0 $PID
if [ $? -ne 0 ]; then
echo "Error: Chardev TPM did not start."
exit 1
@ -83,7 +84,7 @@ fi
exec 100>&-
kill -0 $PID
kill_quiet -0 $PID
if [ $? -ne 0 ]; then
echo "Error: Chardev TPM must have crashed."
exit 1
@ -109,7 +110,7 @@ if [ "$res" != "$exp" ]; then
fi
sleep 0.2
kill -0 $PID 2>/dev/null
kill_quiet -0 $PID 2>/dev/null
if [ $? -eq 0 ]; then
echo "Error: TPM should not be running anymore."
exit 1

View File

@ -26,13 +26,14 @@ function cleanup()
{
pid=$(ps aux | grep $SWTPM | grep -E " file=${PID_FILE}\$" | gawk '{print $2}')
if [ -n "$pid" ]; then
kill -9 $pid
kill_quiet -9 $pid
fi
rm -rf $TPM_PATH
}
trap "cleanup" EXIT
source ${TESTDIR}/common
source ${TESTDIR}/load_vtpm_proxy
rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null
@ -43,7 +44,7 @@ PID=$(ps aux | grep $SWTPM | grep -E " file=${PID_FILE}\$" | gawk '{print $2}')
ps aux | grep $SWTPM | grep -v grep
kill -0 $PID
kill_quiet -0 $PID
if [ $? -ne 0 ]; then
echo "Error: Chardev TPM did not start."
exit 1
@ -83,7 +84,7 @@ fi
exec 100>&-
kill -0 $PID
kill_quiet -0 $PID
if [ $? -ne 0 ]; then
echo "Error: Chardev TPM must have crashed."
exit 1