qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 5/6] tests/qtest: Reorganize common code in ivshmem-test


From: Thomas Huth
Subject: Re: [PATCH v2 5/6] tests/qtest: Reorganize common code in ivshmem-test
Date: Mon, 19 Feb 2024 14:54:59 +0100
User-agent: Mozilla Thunderbird

On 16/02/2024 15.44, Philippe Mathieu-Daudé wrote:
From: Gustavo Romero <gustavo.romero@linaro.org>

This commit reorganizes the ivshmem-test qtest by moving common structs,
functions, and code that can be utilized by other ivshmem qtests into
two new files: ivshmem-utils.h and ivshmem-utils.c.

Enum Reg, struct ServerThread, and mktempshm() have been relocated to
these new files. Two new functions have been introduced to handle the
ivshmem server start/stop: test_ivshmem_server_{start,stop}.

To accommodate the new way for starting/stopping the ivshmem server,
struct ServerThread now includes two new members: 'server', previously
present but not a member of any struct; and 'status', a new member of a
new type, ServerStartStatus, used to track and handle service
termination properly.

Additionally, a new function, mktempsocket(), has been added to help
create a unix socket filename, similar to what mktempshm() does for the
creation of a shm file.

Finally, the ivshmem-test qtest has been adapted to use the new ivhsmem
utils. Adjustments in that sense have also been made to meson.build;
also 'rt' have been removed as a lib dependency for ivhsmem-test.c.

Two lines unrelated to these changes have had their line indentation
also fixed in meson.build.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
Message-ID: <20231127052024.435743-3-gustavo.romero@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
...
diff --git a/tests/qtest/ivshmem-utils.c b/tests/qtest/ivshmem-utils.c
new file mode 100644
index 0000000000..b9578ab554
--- /dev/null
+++ b/tests/qtest/ivshmem-utils.c
@@ -0,0 +1,155 @@
...
+gchar *mktempsocket(void)
+{
+    gchar *server_socket_path;
+
+    server_socket_path = g_strdup_printf("/tmp/ivshmem_socket_qtest-%u-%u",

Can we please avoid hard-coding "/tmp" in new code? Please use g_get_tmp_dir() instead.

+                                         getpid(), g_test_rand_int());
+    return server_socket_path;
+}

 Thomas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]