diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2024-03-10 10:03:25 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2024-03-10 10:03:25 -0400 |
commit | c07b1728e38529ff8177e2075c2bae4724d3abe7 (patch) | |
tree | adbc853abe8a65efdfbff388874d4637d513b507 | |
parent | d0fcbd9722ad691ca0b5873c98e8e9c236fa718b (diff) |
make the examples configurable as (interactive) unit-tests
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | configure.ac | 9 | ||||
-rw-r--r-- | examples/Makefile.am | 15 | ||||
-rw-r--r-- | examples/list.c | 2 | ||||
-rw-r--r-- | examples/makefile | 11 | ||||
-rw-r--r-- | examples/simple.c | 2 |
6 files changed, 27 insertions, 14 deletions
diff --git a/Makefile.am b/Makefile.am index 8e039a0..ed0f8c7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = include src man specs +SUBDIRS = include src examples man specs pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = diff --git a/configure.ac b/configure.ac index c650194..6926d2f 100644 --- a/configure.ac +++ b/configure.ac @@ -115,7 +115,16 @@ if test "x$USE_CONST" = "xyes" ; then AC_DEFINE(_CONST_X_STRING, 1, [Define to 1 to use standard C const feature.]) fi +# --enable-unit-tests +XORG_ENABLE_UNIT_TESTS(no) +XORG_MEMORY_CHECK_FLAGS +if test "x$enable_unit_tests" != "xno" ; then + AC_CHECK_FUNCS([malloc_usable_size]) + AC_CHECK_HEADERS([malloc.h]) +fi + AC_CONFIG_FILES([Makefile + examples/Makefile include/Makefile man/Makefile specs/Makefile diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000..78308dc --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,15 @@ +if ENABLE_UNIT_TESTS +check_PROGRAMS = list menu pane repeater scrollbar simple strip toggle viewport xawhisto + +TESTS=$(check_PROGRAMS) + +AM_CFLAGS = $(CWARNFLAGS) $(XAW_CFLAGS) +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_builddir)/include/X11 +LDADD= $(top_builddir)/src/libXaw7.la $(XAW7_LIBS) + +TESTS_ENVIRONMENT = $(MALLOC_DEBUG_ENV) + +endif ENABLE_UNIT_TESTS diff --git a/examples/list.c b/examples/list.c index 8296059..06e71c8 100644 --- a/examples/list.c +++ b/examples/list.c @@ -1,6 +1,6 @@ #include <stdlib.h> #include <stdio.h> -#include <StringDefs.h> +#include <X11/StringDefs.h> #include <Xaw/Box.h> #include <Xaw/List.h> #include <Xaw/Viewport.h> diff --git a/examples/makefile b/examples/makefile deleted file mode 100644 index 7559e3d..0000000 --- a/examples/makefile +++ /dev/null @@ -1,11 +0,0 @@ -#future version should use autoconf -CC=gcc -CFLAGS=-Wall -g -I/usr/include/X11 -LDFLAGS=-L. -LOADLIBES= -lX11 -lXt -lXaw -FILES=viewport toggle strip scrollbar repeater pane menu list xawhisto simple - -all: $(FILES) - -clean: - $(RM) *.o $(FILES) diff --git a/examples/simple.c b/examples/simple.c index fd0cb32..a78bc90 100644 --- a/examples/simple.c +++ b/examples/simple.c @@ -3,7 +3,7 @@ #include <Xaw/Box.h> #include <Xaw/Simple.h> #include <Xaw/Command.h> -#include <Xmu/Drawing.h> +#include <X11/Xmu/Drawing.h> /* this is the draw function. it uses two pencils (GC) with |