aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/test
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/test')
-rw-r--r--xorg-server/test/Makefile.am2
-rw-r--r--xorg-server/test/os.c36
2 files changed, 36 insertions, 2 deletions
diff --git a/xorg-server/test/Makefile.am b/xorg-server/test/Makefile.am
index aa018c962..34f53fc1e 100644
--- a/xorg-server/test/Makefile.am
+++ b/xorg-server/test/Makefile.am
@@ -23,11 +23,9 @@ INCLUDES += -I$(top_srcdir)/hw/xfree86/parser \
endif
TEST_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
-if XORG
if SPECIAL_DTRACE_OBJECTS
TEST_LDADD += $(OS_LIB) $(DIX_LIB)
endif
-endif
xkb_LDADD=$(TEST_LDADD)
input_LDADD=$(TEST_LDADD)
diff --git a/xorg-server/test/os.c b/xorg-server/test/os.c
index 1460a34d6..8f1107ded 100644
--- a/xorg-server/test/os.c
+++ b/xorg-server/test/os.c
@@ -28,6 +28,21 @@
#include <signal.h>
#include "os.h"
+static int last_signal = 0;
+static int expect_signal = 0;
+
+static void sighandler(int signal)
+{
+ assert(expect_signal);
+ expect_signal = 0;
+ if (!last_signal)
+ raise(signal);
+ OsBlockSignals();
+ OsReleaseSignals();
+ last_signal = 1;
+ expect_signal = 1;
+}
+
static int
sig_is_blocked(int sig)
{
@@ -118,7 +133,27 @@ static void block_sigio_test(void)
assert(sig_is_blocked(SIGIO));
OsReleaseSignals();
assert(!sig_is_blocked(SIGIO));
+#endif
+}
+static void block_sigio_test_nested(void)
+{
+#ifdef SIG_BLOCK
+ /* Check for bug releasing SIGIO during SIGIO signal handling.
+ test case:
+ raise signal
+ → in signal handler:
+ raise signal
+ OsBlockSignals()
+ OsReleaseSignals()
+ tail guard
+ tail guard must be hit.
+ */
+ sighandler_t old_handler;
+ old_handler = signal(SIGIO, sighandler);
+ expect_signal = 1;
+ assert(raise(SIGIO) == 0);
+ assert(signal(SIGIO, old_handler) == sighandler);
#endif
}
@@ -126,5 +161,6 @@ int
main(int argc, char **argv)
{
block_sigio_test();
+ block_sigio_test_nested();
return 0;
}