diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2017-02-02 00:17:19 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2017-02-02 00:18:49 +0100 |
commit | b0c82b68b888ef7ded4e104a68fbb1db12953439 (patch) | |
tree | 43142d42b9e872ef966067329af33bbbeba08cbc | |
parent | bfaf09a2fdff45b7740743b19d7a6c4db561999f (diff) | |
download | external_libqmi-b0c82b68b888ef7ded4e104a68fbb1db12953439.zip external_libqmi-b0c82b68b888ef7ded4e104a68fbb1db12953439.tar.gz external_libqmi-b0c82b68b888ef7ded4e104a68fbb1db12953439.tar.bz2 |
libqmi-glib,test: use pid in virtual port names
So that running the same test at the same time in the same machine
(e.g. during the jenkins jobs...) doesn't crash.
-rw-r--r-- | src/libqmi-glib/test/test-fixture.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libqmi-glib/test/test-fixture.c b/src/libqmi-glib/test/test-fixture.c index 376707f..d759c61 100644 --- a/src/libqmi-glib/test/test-fixture.c +++ b/src/libqmi-glib/test/test-fixture.c @@ -13,7 +13,10 @@ * Copyright (C) 2014 Aleksander Morgado <aleksander@aleksander.es> */ +#include <sys/types.h> +#include <unistd.h> #include <string.h> + #include "test-fixture.h" #define VIRTUAL_SOCKET_PATH "virtual-socket-path" @@ -83,7 +86,9 @@ test_fixture_setup (TestFixture *fixture) qmi_utils_set_traces_enabled (TRUE); - fixture->path = g_strdup_printf ("/dev/virtual/qmi%04u", num++); + /* Create port name, and add process ID so that multiple runs of this test + * in the same system don't clash with each other */ + fixture->path = g_strdup_printf ("/dev/qmi%08lu%04u", (gulong) getpid (), num++); fixture->service_info[QMI_SERVICE_CTL].transaction_id = 0x0001; fixture->ctx = test_port_context_new (fixture->path); test_port_context_start (fixture->ctx); |