]> git.proxmox.com Git - swtpm.git/commitdiff
tests: Convert 2 test cases to use --daemon option
authorStefan Berger <stefanb@linux.ibm.com>
Wed, 27 Oct 2021 01:38:45 +0000 (21:38 -0400)
committerStefan Berger <stefanb@us.ibm.com>
Wed, 27 Oct 2021 22:58:25 +0000 (18:58 -0400)
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
tests/test_ctrlchannel
tests/test_ctrlchannel2

index f843f4808d3110d36cef8507e51884aa40b43992..4ed20068bb90feeca72dbab0ddecfdd855251127 100755 (executable)
@@ -83,17 +83,18 @@ $SWTPM_EXE socket \
        --ctrl type=unixio,path=$SWTPM_CTRL_UNIX_PATH,mode=${FILEMODE}${FOWNER} \
        --log file=$LOG_FILE,level=20 \
        $RUNAS \
-       ${SWTPM_TEST_SECCOMP_OPT} &
-PID=$!
+       --daemon \
+       ${SWTPM_TEST_SECCOMP_OPT}
 exec 100>&-
 exec 101>&-
 
-if wait_for_file $PID_FILE 3; then
+
+if [ ! -f $PID_FILE ]; then
        echo "Error: Socket TPM did not write pidfile."
        exit 1
 fi
 
-validate_pidfile $PID $PID_FILE
+PID=$(cat "$PID_FILE")
 
 # Get the capability bits: CMD_GET_CAPABILITY = 0x00 00 00 01
 res="$(swtpm_ctrl_tx ${SWTPM_INTERFACE} '\x00\x00\x00\x01')"
index cbd98aaeed7fc356e9c266ca761a3c94858c7c23..0236d30c8b3bfab73119da0fae381ce1ac0f18a6 100755 (executable)
@@ -38,15 +38,15 @@ $SWTPM_EXE chardev \
        --tpmstate dir=$TPMDIR \
        --pid file=$PID_FILE \
        --ctrl type=unixio,path=$SOCK_PATH \
-       ${SWTPM_TEST_SECCOMP_OPT} &
-PID=$!
+       --daemon \
+       ${SWTPM_TEST_SECCOMP_OPT}
 
-if wait_for_file $PID_FILE 3; then
+if  [ ! -f $PID_FILE ]; then
        echo "Error: Chardev TPM did not write pidfile."
        exit 1
 fi
 
-validate_pidfile $PID $PID_FILE
+PID=$(cat "$PID_FILE")
 
 # Get the capability bits: CMD_GET_CAPABILITY = 0x00 00 00 01
 act=$($SWTPM_IOCTL --unix $SOCK_PATH -c 2>&1)