[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 08/37] tests/qtest: virtio_blk_fuzz: Avoid using hardcoded /tmp
From: |
Thomas Huth |
Subject: |
[PULL 08/37] tests/qtest: virtio_blk_fuzz: Avoid using hardcoded /tmp |
Date: |
Wed, 28 Sep 2022 09:18:14 +0200 |
From: Bin Meng <bin.meng@windriver.com>
This case was written to use hardcoded /tmp directory for temporary
files. Update to use g_file_open_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-12-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/qtest/fuzz/virtio_blk_fuzz.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/qtest/fuzz/virtio_blk_fuzz.c
b/tests/qtest/fuzz/virtio_blk_fuzz.c
index 236d078cc8..a9fb9ecf6c 100644
--- a/tests/qtest/fuzz/virtio_blk_fuzz.c
+++ b/tests/qtest/fuzz/virtio_blk_fuzz.c
@@ -181,10 +181,10 @@ static void drive_destroy(void *path)
static char *drive_create(void)
{
int fd, ret;
- char *t_path = g_strdup("/tmp/qtest.XXXXXX");
+ char *t_path;
/* Create a temporary raw image */
- fd = mkstemp(t_path);
+ fd = g_file_open_tmp("qtest.XXXXXX", &t_path, NULL);
g_assert_cmpint(fd, >=, 0);
ret = ftruncate(fd, TEST_IMAGE_SIZE);
g_assert_cmpint(ret, ==, 0);
--
2.31.1
- [PULL 33/37] tests/qtest: pflash-cfi02-test: Avoid using hardcoded /tmp, (continued)
- [PULL 33/37] tests/qtest: pflash-cfi02-test: Avoid using hardcoded /tmp, Thomas Huth, 2022/09/28
- [PULL 35/37] tests/qtest: vhost-user-test: Avoid using hardcoded /tmp, Thomas Huth, 2022/09/28
- [PULL 36/37] tests/qtest: boot-serial-test: Close the serial file before starting QEMU, Thomas Huth, 2022/09/28
- [PULL 09/37] tests/qtest: ide-test: Avoid using hardcoded /tmp, Thomas Huth, 2022/09/28
- [PULL 12/37] tests/qtest: virtio-scsi-test: Avoid using hardcoded /tmp, Thomas Huth, 2022/09/28
- [PULL 16/37] tests: vhost-user-bridge: Avoid using hardcoded /tmp, Thomas Huth, 2022/09/28
- [PULL 17/37] tests/qtest: Skip running virtio-net-test cases that require socketpair() for win32, Thomas Huth, 2022/09/28
- [PULL 23/37] tests/qtest: bios-tables-test: Adapt the case for win32, Thomas Huth, 2022/09/28
- [PULL 25/37] tests/qtest: ide-test: Open file in binary mode, Thomas Huth, 2022/09/28
- [PULL 29/37] tests/qtest: migration-test: Skip running some TLS cases for win32, Thomas Huth, 2022/09/28
- [PULL 08/37] tests/qtest: virtio_blk_fuzz: Avoid using hardcoded /tmp,
Thomas Huth <=
- [PULL 14/37] tests/unit: test-image-locking: Avoid using hardcoded /tmp, Thomas Huth, 2022/09/28
- [PULL 37/37] docs/devel: testing: Document writing portable test cases, Thomas Huth, 2022/09/28
- [PULL 18/37] tests/qtest: Build test-filter-{mirror, redirector} cases for posix only, Thomas Huth, 2022/09/28
- [PULL 19/37] tests/qtest: qmp-test: Skip running test_qmp_oob for win32, Thomas Huth, 2022/09/28
- [PULL 26/37] tests/qtest: virtio-net-failover: Disable migration tests for win32, Thomas Huth, 2022/09/28
- [PULL 31/37] tests/x86: Move common code to function in device-plug-test, Thomas Huth, 2022/09/28
- Re: [PULL 00/37] qtests fixes, Stefan Hajnoczi, 2022/09/29