summaryrefslogtreecommitdiffstats
path: root/tests/client-server.c
diff options
context:
space:
mode:
authorGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2021-07-02 16:33:26 +0300
committerGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2021-07-28 13:19:02 +0300
commit90ac6734fc164efb3f25e7cd1fdcf91502edbd2d (patch)
tree7fca9903d394c4b430e6d78eb24832532549ea37 /tests/client-server.c
parentfb530b4f92126cbf1802fb711f945c3f34c11fbb (diff)
tests: create wpipc tests sockets also in /tmp with a random name
See #39, #16 Signed-off-by: George Kiagiadakis <george.kiagiadakis@collabora.com>
Diffstat (limited to 'tests/client-server.c')
-rw-r--r--tests/client-server.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/client-server.c b/tests/client-server.c
index 24f8cc1..da42aaf 100644
--- a/tests/client-server.c
+++ b/tests/client-server.c
@@ -10,8 +10,7 @@
#include <spa/pod/builder.h>
#include <spa/pod/parser.h>
#include <icipc/icipc.h>
-
-#define TEST_ADDRESS "icipc-client-server"
+#include <unistd.h>
static bool
increment_request_handler (struct icipc_server *self, int client_fd,
@@ -70,9 +69,11 @@ reply_handler (struct icipc_sender *self, const uint8_t *buffer, size_t size, vo
static void
test_icipc_server_client ()
{
- struct icipc_server *s = icipc_server_new (TEST_ADDRESS, true);
+ g_autofree gchar *address = g_strdup_printf ("%s/icipc-test-%d-%d",
+ g_get_tmp_dir(), getpid(), g_random_int ());
+ struct icipc_server *s = icipc_server_new (address, true);
g_assert_nonnull (s);
- struct icipc_client *c = icipc_client_new (TEST_ADDRESS, true);
+ struct icipc_client *c = icipc_client_new (address, true);
g_assert_nonnull (c);
struct reply_data data;
g_mutex_init (&data.mutex);