[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/37] tests/qtest: aspeed_smc-test: Avoid using hardcoded /tmp
From: |
Thomas Huth |
Subject: |
[PULL 03/37] tests/qtest: aspeed_smc-test: Avoid using hardcoded /tmp |
Date: |
Wed, 28 Sep 2022 09:18:09 +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: Thomas Huth <thuth@redhat.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20220925113032.1949844-7-bmeng.cn@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/qtest/aspeed_smc-test.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/tests/qtest/aspeed_smc-test.c b/tests/qtest/aspeed_smc-test.c
index 05ce941566..c713a3700b 100644
--- a/tests/qtest/aspeed_smc-test.c
+++ b/tests/qtest/aspeed_smc-test.c
@@ -608,16 +608,15 @@ static void test_write_block_protect_bottom_bit(void)
flash_reset();
}
-static char tmp_path[] = "/tmp/qtest.m25p80.XXXXXX";
-
int main(int argc, char **argv)
{
+ g_autofree char *tmp_path = NULL;
int ret;
int fd;
g_test_init(&argc, &argv, NULL);
- fd = mkstemp(tmp_path);
+ fd = g_file_open_tmp("qtest.m25p80.XXXXXX", &tmp_path, NULL);
g_assert(fd >= 0);
ret = ftruncate(fd, FLASH_SIZE);
g_assert(ret == 0);
--
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 <=
- [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, 2022/09/28
- [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