[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 4/8] tests/unit/test-util-sockets: Use g_file_open_tmp() to create
|
From: |
Thomas Huth |
|
Subject: |
[PULL 4/8] tests/unit/test-util-sockets: Use g_file_open_tmp() to create temp file |
|
Date: |
Wed, 5 Jan 2022 13:36:08 +0100 |
From: Philippe Mathieu-Daudé <philmd@redhat.com>
Similarly to commit e63ed64c6d1 ("tests/qtest/virtio-net-failover:
Use g_file_open_tmp() to create temporary file"), avoid calling
g_test_rand_int() before g_test_init(): use g_file_open_tmp().
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211224234504.3413370-1-philmd@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/unit/test-util-sockets.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tests/unit/test-util-sockets.c b/tests/unit/test-util-sockets.c
index 72b9246529..896247e3ed 100644
--- a/tests/unit/test-util-sockets.c
+++ b/tests/unit/test-util-sockets.c
@@ -305,9 +305,11 @@ static void test_socket_unix_abstract(void)
};
int i;
+ i = g_file_open_tmp("unix-XXXXXX", &addr.u.q_unix.path, NULL);
+ g_assert_true(i >= 0);
+ close(i);
+
addr.type = SOCKET_ADDRESS_TYPE_UNIX;
- addr.u.q_unix.path = g_strdup_printf("unix-%d-%u",
- getpid(), g_random_int());
addr.u.q_unix.has_abstract = true;
addr.u.q_unix.abstract = true;
addr.u.q_unix.has_tight = false;
--
2.27.0
- [PULL 0/8] Misc patches (tests, docs, compat machines), Thomas Huth, 2022/01/05
- [PULL 1/8] hw: Add compat machines for 7.0, Thomas Huth, 2022/01/05
- [PULL 2/8] tests/qtest/test-x86-cpuid-compat: Check for machines before using them, Thomas Huth, 2022/01/05
- [PULL 3/8] tests/qtest/hd-geo-test: Check for the lsi53c895a controller before using it, Thomas Huth, 2022/01/05
- [PULL 4/8] tests/unit/test-util-sockets: Use g_file_open_tmp() to create temp file,
Thomas Huth <=
- [PULL 5/8] qemu-options: Remove the deprecated -no-quit option, Thomas Huth, 2022/01/05
- [PULL 7/8] gitlab-ci: Enable docs in the centos job, Thomas Huth, 2022/01/05
- [PULL 6/8] docs/sphinx: fix compatibility with sphinx < 1.8, Thomas Huth, 2022/01/05
- [PULL 8/8] docs/tools/qemu-trace-stap.rst: Do not hard-code the QEMU binary name, Thomas Huth, 2022/01/05
- Re: [PULL 0/8] Misc patches (tests, docs, compat machines), Richard Henderson, 2022/01/05