]> git.proxmox.com Git - swtpm.git/commitdiff
tests: Use SOCK_STREAM for CMD_SET_DATAFD socketpair
authorStefan Berger <stefanb@linux.ibm.com>
Thu, 22 Sep 2022 14:28:21 +0000 (10:28 -0400)
committerStefan Berger <stefanb@us.ibm.com>
Thu, 22 Sep 2022 17:27:38 +0000 (13:27 -0400)
Switch to SOCK_STREAM for the CMD_SET_DATAFD socketpair where the one
end is passed to swtpm to test that this type of socket will cause
automatic termination of swtpm when the connection is lost. This is also
the socket type that QEMU uses.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
tests/test_ctrlchannel3
tests/test_setdatafd.py

index 15c7a85b6eea3b5b4fbc6f693d61ee4269c1eb03..5140d474f0cc8ce6ecc0fc32acc15525252121b0 100755 (executable)
@@ -55,6 +55,11 @@ if [ $res -ne 0 ]; then
        exit 1
 fi
 
+if wait_process_gone ${PID} 4; then
+       echo "Error: TPM should not be running anymore."
+       exit 1
+fi
+
 echo "OK"
 
 exit 0
index 36fbfa47d2ca538de11ca81152589a15e1017970..6fcfb6e759a0e8b146c19a03e92f4f3ae1e5b175 100755 (executable)
@@ -42,7 +42,7 @@ def test_ReadPCR10(fd):
 
 
 def test_SetDatafd():
-    fd, _fd = socket.socketpair(socket.AF_UNIX, socket.SOCK_DGRAM)
+    fd, _fd = socket.socketpair(socket.AF_UNIX, socket.SOCK_STREAM)
     sock_path = os.getenv('SOCK_PATH')
     cmd_set_data_fd = bytearray([0x00, 0x00, 0x00, 0x10])
     expected_res = bytearray([0x00, 0x00, 0x00, 0x00])