[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/37] tests/qtest: cxl-test: Avoid using hardcoded /tmp
From: |
Thomas Huth |
Subject: |
[PULL 05/37] tests/qtest: cxl-test: Avoid using hardcoded /tmp |
Date: |
Wed, 28 Sep 2022 09:18:11 +0200 |
From: Bin Meng <bin.meng@windriver.com>
This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_dir_make_tmp() for a portable implementation.
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220925113032.1949844-9-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/qtest/cxl-test.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/tests/qtest/cxl-test.c b/tests/qtest/cxl-test.c
index 2e14da7dee..cbe0fb549b 100644
--- a/tests/qtest/cxl-test.c
+++ b/tests/qtest/cxl-test.c
@@ -93,10 +93,9 @@ static void cxl_2root_port(void)
static void cxl_t3d(void)
{
g_autoptr(GString) cmdline = g_string_new(NULL);
- char template[] = "/tmp/cxl-test-XXXXXX";
- const char *tmpfs;
+ g_autofree const char *tmpfs = NULL;
- tmpfs = g_mkdtemp(template);
+ tmpfs = g_dir_make_tmp("cxl-test-XXXXXX", NULL);
g_string_printf(cmdline, QEMU_PXB_CMD QEMU_RP QEMU_T3D, tmpfs, tmpfs);
@@ -107,10 +106,9 @@ static void cxl_t3d(void)
static void cxl_1pxb_2rp_2t3d(void)
{
g_autoptr(GString) cmdline = g_string_new(NULL);
- char template[] = "/tmp/cxl-test-XXXXXX";
- const char *tmpfs;
+ g_autofree const char *tmpfs = NULL;
- tmpfs = g_mkdtemp(template);
+ tmpfs = g_dir_make_tmp("cxl-test-XXXXXX", NULL);
g_string_printf(cmdline, QEMU_PXB_CMD QEMU_2RP QEMU_2T3D,
tmpfs, tmpfs, tmpfs, tmpfs);
@@ -122,10 +120,9 @@ static void cxl_1pxb_2rp_2t3d(void)
static void cxl_2pxb_4rp_4t3d(void)
{
g_autoptr(GString) cmdline = g_string_new(NULL);
- char template[] = "/tmp/cxl-test-XXXXXX";
- const char *tmpfs;
+ g_autofree const char *tmpfs = NULL;
- tmpfs = g_mkdtemp(template);
+ tmpfs = g_dir_make_tmp("cxl-test-XXXXXX", NULL);
g_string_printf(cmdline, QEMU_2PXB_CMD QEMU_4RP QEMU_4T3D,
tmpfs, tmpfs, tmpfs, tmpfs, tmpfs, tmpfs,
--
2.31.1
- [PULL 00/37] qtests fixes, Thomas Huth, 2022/09/28
- [PULL 02/37] tests/qtest: ahci-test: Avoid using hardcoded /tmp, Thomas Huth, 2022/09/28
- [PULL 03/37] tests/qtest: aspeed_smc-test: Avoid using hardcoded /tmp, Thomas Huth, 2022/09/28
- [PULL 01/37] tests/qtest: i440fx-test: Rewrite create_blob_file() to be portable, Thomas Huth, 2022/09/28
- [PULL 06/37] tests/qtest: fdc-test: Avoid using hardcoded /tmp, Thomas Huth, 2022/09/28
- [PULL 04/37] tests/qtest: boot-serial-test: Avoid using hardcoded /tmp, Thomas Huth, 2022/09/28
- [PULL 07/37] tests/qtest: generic_fuzz: Avoid using hardcoded /tmp, Thomas Huth, 2022/09/28
- [PULL 15/37] tests/unit: test-qga: Avoid using hardcoded /tmp, Thomas Huth, 2022/09/28
- [PULL 13/37] tests/qtest: libqtest: Avoid using hardcoded /tmp, Thomas Huth, 2022/09/28
- [PULL 05/37] tests/qtest: cxl-test: Avoid using hardcoded /tmp,
Thomas Huth <=
- [PULL 10/37] tests/qtest: vhost-user-blk-test: Avoid using hardcoded /tmp, Thomas Huth, 2022/09/28
- [PULL 21/37] tests/qtest: libqtest: Exclude the *_fds APIs for win32, Thomas Huth, 2022/09/28
- [PULL 22/37] tests/qtest: {ahci, ide}-test: Use relative path for temporary files for win32, Thomas Huth, 2022/09/28
- [PULL 11/37] tests/qtest: virtio-blk-test: Avoid using hardcoded /tmp, Thomas Huth, 2022/09/28
- [PULL 20/37] tests/qtest: libqtest: Adapt global_qtest declaration for win32, Thomas Huth, 2022/09/28
- [PULL 24/37] tests/qtest: migration-test: Disable IO redirection for win32, Thomas Huth, 2022/09/28
- [PULL 27/37] tests/qtest: microbit-test: Fix socket access for win32, Thomas Huth, 2022/09/28
- [PULL 28/37] tests/qtest: libqtest: Replace the call to close a socket with closesocket(), Thomas Huth, 2022/09/28
- [PULL 30/37] .gitlab-ci.d/windows.yml: Display meson test logs, Thomas Huth, 2022/09/28
- [PULL 32/37] tests/qtest: hd-geo-test: Avoid using hardcoded /tmp, Thomas Huth, 2022/09/28