diff options
author | Thomas Huth <thuth@redhat.com> | 2022-10-12 10:43:34 +0200 |
---|---|---|
committer | Thomas Huth <thuth@redhat.com> | 2022-10-28 09:39:21 +0200 |
commit | daa8bb57dba5add4929dea6919858a2062101b26 (patch) | |
tree | a3ff707a26dca277177dea25550ab5b1fdeb309a /tests/qtest/tpm-util.c | |
parent | 9d711f19c5608910cdefdad24e23a2e695b312bb (diff) | |
download | qemu-daa8bb57dba5add4929dea6919858a2062101b26.zip qemu-daa8bb57dba5add4929dea6919858a2062101b26.tar.gz qemu-daa8bb57dba5add4929dea6919858a2062101b26.tar.bz2 |
tests/qtest/tpm: Clean up remainders of swtpm
After running "make check", there are remainders of the tpm
tests left in the /tmp directory, slowly filling it up.
Seems like "swtpm" leaves a ".lock" and a "tpm2-00.permall"
file behind, so that the g_rmdir() calls on the temporary
directories fail. Introduce a helper function to remove those
leftovers before doing the g_rmdir().
Message-Id: <20221012084334.794253-1-thuth@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/qtest/tpm-util.c')
-rw-r--r-- | tests/qtest/tpm-util.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/qtest/tpm-util.c b/tests/qtest/tpm-util.c index e0dc5da..a7efe2d 100644 --- a/tests/qtest/tpm-util.c +++ b/tests/qtest/tpm-util.c @@ -13,6 +13,7 @@ */ #include "qemu/osdep.h" +#include <glib/gstdio.h> #include "hw/acpi/tpm.h" #include "libqtest.h" @@ -292,3 +293,21 @@ void tpm_util_migration_start_qemu(QTestState **src_qemu, g_free(src_qemu_args); g_free(dst_qemu_args); } + +/* Remove directory with remainders of swtpm */ +void tpm_util_rmdir(const char *path) +{ + char *filename; + int ret; + + filename = g_strdup_printf("%s/tpm2-00.permall", path); + g_unlink(filename); + g_free(filename); + + filename = g_strdup_printf("%s/.lock", path); + g_unlink(filename); + g_free(filename); + + ret = g_rmdir(path); + g_assert(!ret); +} |