tests: Convert test/ to single binary

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Mihail Konev <k.mvc@ya.ru>
This commit is contained in:
Mihail Konev 2017-01-12 13:21:10 +05:00 committed by Adam Jackson
parent 773fc07e4c
commit ead5064581
16 changed files with 98 additions and 47 deletions

12
test/.gitignore vendored
View File

@ -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

View File

@ -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)
tests_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_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

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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);

25
test/tests.c Normal file
View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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();

View File

@ -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();