xserver: Branch 'master' - 2 commits

Keith Packard keithp at kemper.freedesktop.org
Thu Oct 9 05:18:21 PDT 2014


 configure.ac               |    4 +++-
 include/dix-config.h.in    |    7 +++++++
 test/xi2/protocol-common.c |   26 ++++++++++++++++++++++----
 3 files changed, 32 insertions(+), 5 deletions(-)

New commits:
commit da887726eeaece0396962dd3912578d3372881b1
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sun Sep 21 09:49:06 2014 -0700

    Use unique display name for each xi2 test program [v3]
    
    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.
    
    v2: Fix Linux bits:
    
      Add #include <errno.h> to get a declaration of
      program_invocation_name on Linux.
    
      Use only the last portion of the pathname so that the resulting
      display name doesn't contain any slashes.
    
    v3: use program_invocation_short_name on Linux
    
      This is the same as program_invocation_name, except is has
      stripped off any path prefix.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index 30c0c5c..c697188 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_short_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 f170c1c..1aa77a5 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_short_name', and
+   to 0 if you don't. */
+#undef HAVE_DECL_PROGRAM_INVOCATION_SHORT_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..9265ba3 100644
--- a/test/xi2/protocol-common.c
+++ b/test/xi2/protocol-common.c
@@ -25,6 +25,7 @@
 #include <dix-config.h>
 #endif
 
+#include <errno.h>
 #include <stdint.h>
 #include "extinit.h"            /* for XInputExtensionInit */
 #include "exglobals.h"
@@ -139,6 +140,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_SHORT_NAME
+    display = program_invocation_short_name;
+#endif
+
     client = init_client(0, NULL);
 
     AllocDevicePair(&client, "Virtual core", &local_devices.vcp, &local_devices.vck,
commit cccba52d152a7d233c0b762a54844ecef831483e
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sun Sep 21 09:49:05 2014 -0700

    Abort xi2 tests if ActivateDevice() fails
    
    I was getting segfaults in xi2 tests from trying to copy XKB keyboard
    state to NULL pointers with a stack of:
        key=key at entry=0) at xkbActions.c:1189
        sendevent=sendevent at entry=0 '\000') at devices.c:420
        at protocol-xiquerydevice.c:338
    
    which turned out to be due to xkbcomp failure, which was logged in the
    test logs as:
    XKB: Failed to compile keymap
    Keyboard initialization failed. This could be a missing or incorrect setup of xkeyboard-config.
    
    but which was overlooked because the ActivateDevice() return code wasn't
    checked and the tests went forward assuming the structures were all
    correctly initialized.   This catches the failure closer to the point of
    failure, to save debugging time.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/test/xi2/protocol-common.c b/test/xi2/protocol-common.c
index 9a429e4..64a5777 100644
--- a/test/xi2/protocol-common.c
+++ b/test/xi2/protocol-common.c
@@ -137,6 +137,7 @@ init_devices(void)
 {
     ClientRec client;
     struct devices local_devices;
+    int ret;
 
     client = init_client(0, NULL);
 
@@ -145,15 +146,20 @@ init_devices(void)
     inputInfo.pointer = local_devices.vcp;
 
     inputInfo.keyboard = local_devices.vck;
-    ActivateDevice(local_devices.vcp, FALSE);
-    ActivateDevice(local_devices.vck, FALSE);
+    ret = ActivateDevice(local_devices.vcp, FALSE);
+    assert(ret == Success);
+    /* This may fail if xkbcomp fails or xkb-config is not found. */
+    ret = ActivateDevice(local_devices.vck, FALSE);
+    assert(ret == Success);
     EnableDevice(local_devices.vcp, FALSE);
     EnableDevice(local_devices.vck, FALSE);
 
     AllocDevicePair(&client, "", &local_devices.mouse, &local_devices.kbd,
                     TestPointerProc, CoreKeyboardProc, FALSE);
-    ActivateDevice(local_devices.mouse, FALSE);
-    ActivateDevice(local_devices.kbd, FALSE);
+    ret = ActivateDevice(local_devices.mouse, FALSE);
+    assert(ret == Success);
+    ret = ActivateDevice(local_devices.kbd, FALSE);
+    assert(ret == Success);
     EnableDevice(local_devices.mouse, FALSE);
     EnableDevice(local_devices.kbd, FALSE);
 


More information about the xorg-commit mailing list