diff options
-rw-r--r-- | plugins/generic/tests/test-service-generic.c | 16 |
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 37fb7cec..8c21cd05 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]); } /*****************************************************************************/ |