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
This commit is contained in:
@@ -10,10 +10,12 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details:
|
* 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 <unistd.h>
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
@@ -31,10 +33,12 @@ test_enable_disable (TestFixture *fixture)
|
|||||||
MMObject *obj;
|
MMObject *obj;
|
||||||
MMModem *modem;
|
MMModem *modem;
|
||||||
TestPortContext *port0;
|
TestPortContext *port0;
|
||||||
const gchar *ports [] = {
|
gchar *ports [] = { NULL, NULL };
|
||||||
"abstract:port0",
|
|
||||||
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 */
|
/* Setup new port context */
|
||||||
port0 = test_port_context_new (ports[0]);
|
port0 = test_port_context_new (ports[0]);
|
||||||
@@ -69,6 +73,8 @@ test_enable_disable (TestFixture *fixture)
|
|||||||
/* Stop port context */
|
/* Stop port context */
|
||||||
test_port_context_stop (port0);
|
test_port_context_stop (port0);
|
||||||
test_port_context_free (port0);
|
test_port_context_free (port0);
|
||||||
|
|
||||||
|
g_free (ports[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
Reference in New Issue
Block a user