summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2016-11-23 10:53:56 +0100
committerAleksander Morgado <aleksander@aleksander.es>2016-11-23 11:14:52 +0100
commit531f77f70ef69abb410e288f075d10eb3609f90a (patch)
tree96f90287a0e26bcca377aba1d012e5aaf1b906cc
parent6ed6d13f00ed22e3458d2fa64064a5f9b0f23605 (diff)
downloadModemManager-531f77f70ef69abb410e288f075d10eb3609f90a.tar.gz
tests,dbus: append pid to abstract socket name
So that different concurrent runs of this same test don't clash with each other: TEST: test-service-generic... (pid=11124) /MM/Service/Generic/enable-disable: Activating service name='org.freedesktop.ModemManager1' Successfully activated service 'org.freedesktop.ModemManager1' ** (plugins/.libs/lt-test-service-generic>:11124): ERROR **: Cannot bind socket: Error binding to address: Address already in use cleaning up pid 11144 FAIL (cherry picked from commit 944e34ecdb9028b68b2144dd2c6d698d508f1808)
-rw-r--r--plugins/generic/tests/test-service-generic.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/plugins/generic/tests/test-service-generic.c b/plugins/generic/tests/test-service-generic.c
index 37fb7cec5..8c21cd05d 100644
--- a/plugins/generic/tests/test-service-generic.c
+++ b/plugins/generic/tests/test-service-generic.c
@@ -10,10 +10,12 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
*
- * Copyright (C) 2013 Aleksander Morgado <aleksander@gnu.org>
+ * Copyright (C) 2016 Aleksander Morgado <aleksander@gnu.org>
*/
+#include <sys/types.h>
#include <unistd.h>
+
#include <glib.h>
#include <glib-object.h>
@@ -31,10 +33,12 @@ test_enable_disable (TestFixture *fixture)
MMObject *obj;
MMModem *modem;
TestPortContext *port0;
- const gchar *ports [] = {
- "abstract:port0",
- NULL
- };
+ gchar *ports [] = { NULL, NULL };
+
+ /* Create port name, and add process ID so that multiple runs of this test
+ * in the same system don't clash with each other */
+ ports[0] = g_strdup_printf ("abstract:port0:%ld", (glong) getpid ());
+ g_debug ("test service generic: using abstract port at '%s'", ports[0]);
/* Setup new port context */
port0 = test_port_context_new (ports[0]);
@@ -69,6 +73,8 @@ test_enable_disable (TestFixture *fixture)
/* Stop port context */
test_port_context_stop (port0);
test_port_context_free (port0);
+
+ g_free (ports[0]);
}
/*****************************************************************************/