[PATCH 2/2] Use unique display name for each xi2 test program

Alan Coopersmith alan.coopersmith at oracle.com
Tue Sep 23 23:19:59 PDT 2014


make -j 8 check was sporadically failing in different xi2 tests.
After adding the asserts in the previous commit to catch xkb failure
it became easier to catch the failures and see that multiple tests
were running at once trying to write to /tmp/server-(null).xkm and
then delete it, and interfering with each other.

Putting a unique string into the display variable let them each write
to their own file and not interfere with others.

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 configure.ac               |    4 +++-
 include/dix-config.h.in    |    7 +++++++
 test/xi2/protocol-common.c |   11 +++++++++++
 3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index be8bff6..04b0b4a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -217,10 +217,12 @@ AC_SUBST(DLOPEN_LIBS)
 
 dnl Checks for library functions.
 AC_CHECK_FUNCS([backtrace ffs geteuid getuid issetugid getresuid \
-	getdtablesize getifaddrs getpeereid getpeerucred getzoneid \
+	getdtablesize getifaddrs getpeereid getpeerucred getprogname getzoneid \
 	mmap seteuid shmctl64 strncasecmp vasprintf vsnprintf walkcontext])
 AC_REPLACE_FUNCS([strcasecmp strcasestr strlcat strlcpy strndup])
 
+AC_CHECK_DECLS([program_invocation_name], [], [], [[#include <errno.h>]])
+
 dnl Find the math libary, then check for cbrt function in it.
 AC_CHECK_LIB(m, sqrt)
 AC_CHECK_FUNCS([cbrt])
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 4268b8f..ac68ad6 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -72,6 +72,10 @@
 /* Define to 1 if you have the <dbm.h> header file. */
 #undef HAVE_DBM_H
 
+/* Define to 1 if you have the declaration of `program_invocation_name', and
+   to 0 if you don't. */
+#undef HAVE_DECL_PROGRAM_INVOCATION_NAME
+
 /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
    */
 #undef HAVE_DIRENT_H
@@ -100,6 +104,9 @@
 /* Define to 1 if you have the `getpeerucred' function. */
 #undef HAVE_GETPEERUCRED
 
+/* Define to 1 if you have the `getprogname' function. */
+#undef HAVE_GETPROGNAME
+
 /* Define to 1 if you have the `getzoneid' function. */
 #undef HAVE_GETZONEID
 
diff --git a/test/xi2/protocol-common.c b/test/xi2/protocol-common.c
index 64a5777..3a53050 100644
--- a/test/xi2/protocol-common.c
+++ b/test/xi2/protocol-common.c
@@ -139,6 +139,17 @@ init_devices(void)
     struct devices local_devices;
     int ret;
 
+    /*
+     * Put a unique name in display pointer so that when tests are run in
+     * parallel, their xkbcomp outputs to /tmp/server-<display>.xkm don't
+     * stomp on each other.
+     */
+#ifdef HAVE_GETPROGNAME
+    display = getprogname();
+#elif HAVE_DECL_PROGRAM_INVOCATION_NAME
+    display = program_invocation_name;
+#endif
+
     client = init_client(0, NULL);
 
     AllocDevicePair(&client, "Virtual core", &local_devices.vcp, &local_devices.vck,
-- 
1.7.9.2



More information about the xorg-devel mailing list