From 4bf003a824577b5a46a59b3b3e91687b530ee48f Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Thu, 10 Mar 2011 14:23:44 -0800 Subject: Add test framework similar to xserver and use it to test XtAsprintf Only two simple test cases to start with: - compares the results of snprintf of a short string to a static buffer with the new buffer returned by XtAsprintf. - compare the results of using XtAsprintf to replicate a portion of a very long string with the original string. Uses malloc debugging flags for various platforms to try to catch errors with uninitialized memory (such as the recently fixed failure to terminate the string). Requires xorg-macros 1.13 for XORG_ENABLE_UNIT_TESTS and XORG_WITH_GLIB. Signed-off-by: Alan Coopersmith Reviewed-by: Gaetan Nadon --- test/Makefile.am | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 test/Makefile.am (limited to 'test/Makefile.am') diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 0000000..8c0a4c3 --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,14 @@ +if ENABLE_UNIT_TESTS +if HAVE_GLIB +check_PROGRAMS = Alloc + +TESTS=$(check_PROGRAMS) + +AM_CFLAGS = $(CWARNFLAGS) $(XT_CFLAGS) $(GLIB_CFLAGS) +INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include +LDADD= $(top_builddir)/src/libXt.la $(GLIB_LIBS) + +TESTS_ENVIRONMENT = $(MALLOC_DEBUG_ENV) + +endif HAVE_GLIB +endif ENABLE_UNIT_TESTS -- cgit v1.2.3