From 78712a842adb59db1b4c3c9a94015619a4282382 Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Sun, 4 Feb 2024 18:10:09 +0900 Subject: [PATCH] QemuHCK: Ensure to kill swtpm Signed-off-by: Akihiko Odaki --- lib/setupmanagers/qemuhck/devices/tpm-tis.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/setupmanagers/qemuhck/devices/tpm-tis.json b/lib/setupmanagers/qemuhck/devices/tpm-tis.json index dcd43388..83d06372 100644 --- a/lib/setupmanagers/qemuhck/devices/tpm-tis.json +++ b/lib/setupmanagers/qemuhck/devices/tpm-tis.json @@ -6,6 +6,7 @@ "-device tpm-tis,tpmdev=tpm0" ], "define_variables": { + "@tpm_pid@": "@workspace@/swtpm_@run_id@_@client_id@.pid", "@tpm_state_dir@": "@workspace@/swtpm_state_@run_id@_@client_id@", "@tpm_socket@": "/tmp/swtpm_@run_id@_@client_id@_sock" }, @@ -15,6 +16,9 @@ ], "pre_start_commands": [ "rm -f @tpm_socket@", - "swtpm socket --daemon --tpm2 --tpmstate dir=@tpm_state_dir@ --ctrl type=unixio,path=@tpm_socket@ --log file=@tpm_state_dir@/swtpm.log,level=20" + "swtpm socket --daemon --pid file=@tpm_pid@ --tpm2 --tpmstate dir=@tpm_state_dir@ --ctrl type=unixio,path=@tpm_socket@ --log file=@tpm_state_dir@/swtpm.log,level=20" + ], + "post_stop_commands": [ + "kill $(cat @tpm_pid@) || true" ] }