summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/.gitignore12
-rw-r--r--test/Makefile.am53
-rw-r--r--test/fixes.c4
-rw-r--r--test/hashtabletest.c4
-rw-r--r--test/input.c4
-rw-r--r--test/list.c4
-rw-r--r--test/misc.c4
-rw-r--r--test/signal-logging.c4
-rw-r--r--test/string.c3
-rw-r--r--test/test_xkb.c4
-rw-r--r--test/tests-common.h2
-rw-r--r--test/tests.c25
-rw-r--r--test/tests.h12
-rw-r--r--test/touch.c6
-rw-r--r--test/xfree86.c4
-rw-r--r--test/xtest.c4
16 files changed, 100 insertions, 49 deletions
diff --git a/test/.gitignore b/test/.gitignore
index 47f766c5f..5fd66e3f4 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -1,16 +1,6 @@
-fixes
-hashtabletest
-input
-list
-misc
+tests
os
sdksyms.c
-string
-touch
-xfree86
-xkb
-xtest
-signal-logging
piglit-results
simple-xinit
*.log
diff --git a/test/Makefile.am b/test/Makefile.am
index bbf66913a..d51d8624e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,21 +1,20 @@
if ENABLE_UNIT_TESTS
SUBDIRS= .
-TEST_PROGS = list string
+AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
+AM_CPPFLAGS = $(XORG_INCS)
+
if XORG
# Tests that require at least some DDX functions in order to fully link
# For now, requires xf86 ddx, could be adjusted to use another
SUBDIRS += xi1 xi2
-TEST_PROGS += xkb input xtest misc fixes xfree86 signal-logging touch
if RES
-TEST_PROGS += hashtabletest
+RES_SRCS = hashtabletest.c
+AM_CPPFLAGS += -DRES_TESTS
endif
endif
check_LTLIBRARIES = libxservertest.la
-noinst_PROGRAMS = \
- simple-xinit \
- $(TEST_PROGS) \
- $(NULL)
+noinst_PROGRAMS = simple-xinit tests
if XVFB
XVFB_TESTS = scripts/xvfb-piglit.sh
@@ -31,8 +30,7 @@ SCRIPT_TESTS = \
$(XEPHYR_GLAMOR_TESTS) \
$(NULL)
-TESTS = \
- $(TEST_PROGS) \
+TESTS = tests \
$(SCRIPT_TESTS) \
$(NULL)
@@ -42,8 +40,6 @@ TESTS_ENVIRONMENT = \
$(XORG_MALLOC_DEBUG_ENV) \
$(NULL)
-AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
-AM_CPPFLAGS = $(XORG_INCS)
if XORG
AM_CPPFLAGS += -I$(top_srcdir)/hw/xfree86/parser \
-I$(top_srcdir)/hw/xfree86/ddc \
@@ -51,23 +47,26 @@ AM_CPPFLAGS += -I$(top_srcdir)/hw/xfree86/parser \
-I$(top_srcdir)/hw/xfree86/ramdac -I$(top_srcdir)/hw/xfree86/dri \
-I$(top_srcdir)/hw/xfree86/dri2 -I$(top_srcdir)/dri3
endif
-TEST_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
+tests_LDADD = libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
if SPECIAL_DTRACE_OBJECTS
-TEST_LDADD += $(OS_LIB) $(DIX_LIB)
-endif
-
-xkb_SOURCES = test_xkb.c
-
-xkb_LDADD=$(TEST_LDADD)
-input_LDADD=$(TEST_LDADD)
-xtest_LDADD=$(TEST_LDADD)
-misc_LDADD=$(TEST_LDADD)
-fixes_LDADD=$(TEST_LDADD)
-xfree86_LDADD=$(TEST_LDADD)
-touch_LDADD=$(TEST_LDADD)
-signal_logging_LDADD=$(TEST_LDADD)
-hashtabletest_LDADD=$(TEST_LDADD)
+tests_LDADD += $(OS_LIB) $(DIX_LIB)
+endif
+
+tests_SOURCES = \
+ tests-common.c \
+ fixes.c \
+ input.c \
+ list.c \
+ misc.c \
+ signal-logging.c \
+ string.c \
+ touch.c \
+ xfree86.c \
+ test_xkb.c \
+ xtest.c \
+ $(RES_SRCS) \
+ tests.c
libxservertest_la_LIBADD = $(XSERVER_LIBS)
if XORG
@@ -151,7 +150,7 @@ endif
if XQUARTZ
libxservertest_la_LIBADD += \
$(top_builddir)/miext/rootless/librootless.la
-TEST_LDADD += -lXplugin
+tests_LDADD += -lXplugin
endif
if XWIN_MULTIWINDOWEXTWM
diff --git a/test/fixes.c b/test/fixes.c
index 4ac6750e4..573d948dc 100644
--- a/test/fixes.c
+++ b/test/fixes.c
@@ -31,6 +31,8 @@
#include <xfixesint.h>
#include <X11/extensions/xfixeswire.h>
+#include "tests-common.h"
+
static void
_fixes_test_direction(struct PointerBarrier *barrier, int d[4], int permitted)
{
@@ -343,7 +345,7 @@ fixes_pointer_barrier_clamp_test(void)
}
int
-main(int argc, char **argv)
+fixes_test(void)
{
fixes_pointer_barriers_test();
diff --git a/test/hashtabletest.c b/test/hashtabletest.c
index 86a0c58c6..0387587cb 100644
--- a/test/hashtabletest.c
+++ b/test/hashtabletest.c
@@ -8,6 +8,8 @@
#include "hashtable.h"
#include "resource.h"
+#include "tests-common.h"
+
static void
print_xid(void* ptr, void* v)
{
@@ -154,7 +156,7 @@ test3(void)
}
int
-main(void)
+hashtabletest_test(void)
{
int ok = test1();
ok = ok && test2();
diff --git a/test/input.c b/test/input.c
index 91ee43c46..4cd39bb48 100644
--- a/test/input.c
+++ b/test/input.c
@@ -43,6 +43,8 @@
#include "mi.h"
#include "assert.h"
+#include "tests-common.h"
+
/**
* Init a device with axes.
* Verify values set on the device.
@@ -1904,7 +1906,7 @@ dix_enqueue_events(void)
}
int
-main(int argc, char **argv)
+input_test(void)
{
dix_enqueue_events();
dix_double_fp_conversion();
diff --git a/test/list.c b/test/list.c
index 28d9609ef..d710f4693 100644
--- a/test/list.c
+++ b/test/list.c
@@ -31,6 +31,8 @@
#include <assert.h>
#include <stdlib.h>
+#include "tests-common.h"
+
struct parent {
int a;
struct xorg_list children;
@@ -369,7 +371,7 @@ test_nt_list_delete(void)
}
int
-main(int argc, char **argv)
+list_test(void)
{
test_xorg_list_init();
test_xorg_list_add();
diff --git a/test/misc.c b/test/misc.c
index 66330a140..ae46ccccb 100644
--- a/test/misc.c
+++ b/test/misc.c
@@ -31,6 +31,8 @@
#include "dix.h"
#include "dixstruct.h"
+#include "tests-common.h"
+
ScreenInfo screenInfo;
static void
@@ -192,7 +194,7 @@ dix_request_size_checks(void)
int
-main(int argc, char **argv)
+misc_test(void)
{
dix_version_compare();
dix_update_desktop_dimensions();
diff --git a/test/signal-logging.c b/test/signal-logging.c
index 3d2d04801..b00ee588e 100644
--- a/test/signal-logging.c
+++ b/test/signal-logging.c
@@ -30,6 +30,8 @@
#include "assert.h"
#include "misc.h"
+#include "tests-common.h"
+
struct number_format_test {
uint64_t number;
char string[21];
@@ -395,7 +397,7 @@ static void logging_format(void)
#pragma GCC diagnostic pop /* "-Wformat-security" */
int
-main(int argc, char **argv)
+signal_logging_test(void)
{
number_formatting();
logging_format();
diff --git a/test/string.c b/test/string.c
index 93867e04a..406b7bf8a 100644
--- a/test/string.c
+++ b/test/string.c
@@ -32,6 +32,7 @@
#include <assert.h>
#include "os.h"
+#include "tests-common.h"
/* Ensure we're testing our functions, even on platforms with libc versions */
#include <string.h>
@@ -62,7 +63,7 @@ strndup_checks(void)
}
int
-main(int argc, char **argv)
+string_test(void)
{
strndup_checks();
diff --git a/test/test_xkb.c b/test/test_xkb.c
index 9047f594c..23d5b22a6 100644
--- a/test/test_xkb.c
+++ b/test/test_xkb.c
@@ -48,6 +48,8 @@
#include "../xkb/xkb.h"
#include <assert.h>
+#include "tests-common.h"
+
/**
* Initialize an empty XkbRMLVOSet.
* Call XkbGetRulesDflts to obtain the default ruleset.
@@ -164,7 +166,7 @@ xkb_set_get_rules_test(void)
}
int
-main(int argc, char **argv)
+xkb_test(void)
{
xkb_set_get_rules_test();
xkb_get_rules_test();
diff --git a/test/tests-common.h b/test/tests-common.h
index f0197ad21..d5286caf2 100644
--- a/test/tests-common.h
+++ b/test/tests-common.h
@@ -1,6 +1,8 @@
#ifndef TESTS_COMMON_H
#define TESTS_COMMON_H
+#include "tests.h"
+
#define run_test(func) run_test_in_child(func, #func)
void run_test_in_child(int (*func)(void), const char *funcname);
diff --git a/test/tests.c b/test/tests.c
new file mode 100644
index 000000000..cf72acafb
--- /dev/null
+++ b/test/tests.c
@@ -0,0 +1,25 @@
+#include <string.h>
+#include "tests.h"
+#include "tests-common.h"
+
+int
+main(int argc, char **argv)
+{
+ run_test(fixes_test);
+
+#ifdef RES_TESTS
+ run_test(hashtabletest_test);
+#endif
+
+ run_test(input_test);
+ run_test(list_test);
+ run_test(misc_test);
+ run_test(signal_logging_test);
+ run_test(string_test);
+ run_test(touch_test);
+ run_test(xfree86_test);
+ run_test(xkb_test);
+ run_test(xtest_test);
+
+ return 0;
+}
diff --git a/test/tests.h b/test/tests.h
index 0b673ee7a..b96ca78bb 100644
--- a/test/tests.h
+++ b/test/tests.h
@@ -1,6 +1,18 @@
#ifndef TESTS_H
#define TESTS_H
+int fixes_test(void);
+int hashtabletest_test(void);
+int input_test(void);
+int list_test(void);
+int misc_test(void);
+int signal_logging_test(void);
+int string_test(void);
+int touch_test(void);
+int xfree86_test(void);
+int xkb_test(void);
+int xtest_test(void);
+
int protocol_xchangedevicecontrol_test(void);
int protocol_xiqueryversion_test(void);
diff --git a/test/touch.c b/test/touch.c
index 19c68784d..16aaf4bbb 100644
--- a/test/touch.c
+++ b/test/touch.c
@@ -30,6 +30,8 @@
#include "assert.h"
#include "scrnintstr.h"
+#include "tests-common.h"
+
static void
touch_grow_queue(void)
{
@@ -278,13 +280,15 @@ touch_init(void)
}
int
-main(int argc, char **argv)
+touch_test(void)
{
+ printf("touch_test: start...\n");
touch_grow_queue();
touch_find_ddxid();
touch_begin_ddxtouch();
touch_init();
touch_begin_touch();
+ printf("touch_test: exiting successfully\n");
return 0;
}
diff --git a/test/xfree86.c b/test/xfree86.c
index a98671183..ff8ad2d2d 100644
--- a/test/xfree86.c
+++ b/test/xfree86.c
@@ -30,6 +30,8 @@
#include "xf86.h"
#include "xf86Parser.h"
+#include "tests-common.h"
+
static void
xfree86_option_list_duplicate(void)
{
@@ -96,7 +98,7 @@ xfree86_add_comment(void)
}
int
-main(int argc, char **argv)
+xfree86_test(void)
{
xfree86_option_list_duplicate();
xfree86_add_comment();
diff --git a/test/xtest.c b/test/xtest.c
index e9fabfbb9..05d7ec1d3 100644
--- a/test/xtest.c
+++ b/test/xtest.c
@@ -35,6 +35,8 @@
#include "xserver-properties.h"
#include "syncsrv.h"
+#include "tests-common.h"
+
/**
*/
@@ -123,7 +125,7 @@ xtest_properties(void)
}
int
-main(int argc, char **argv)
+xtest_test(void)
{
xtest_init_devices();
xtest_properties();