[test/Makefile.am] Add 'make run' target

It runs tests under a tool specified tool.  For example:

	make run TOOL=gdb TESTS=user-font TARGETS=pdf
This commit is contained in:
Behdad Esfahbod 2008-05-15 18:50:55 -04:00
parent 537ffa7628
commit 142ba30604
2 changed files with 33 additions and 6 deletions

View file

@ -860,7 +860,10 @@ EXTRA_PROGRAMS += $(TESTS) $(DISABLED_TESTS)
TARGETS = $(CAIRO_TEST_TARGET)
TARGETS_EXCLUDE = $(CAIRO_TEST_TARGET_EXCLUDE)
TESTS_ENVIRONMENT = CAIRO_XFAIL_TESTS="$(XFAIL_TESTS:$(EXEEXT)=)" CAIRO_TEST_TARGET="$(TARGETS)" CAIRO_TEST_TARGET_EXCLUDE="$(TARGETS_EXCLUDE)"
# Same about ENV vs CAIRO_TEST_ENV. ENV is used with "make run" only
ENV = $(CAIRO_TEST_ENV)
TESTS_ENVIRONMENT = CAIRO_XFAIL_TESTS="$(XFAIL_TESTS:$(EXEEXT)=)" CAIRO_TEST_TARGET="$(TARGETS)" CAIRO_TEST_TARGET_EXCLUDE="$(TARGETS_EXCLUDE)" $(ENV)
EXTRA_VALGRIND_FLAGS = $(CAIRO_EXTRA_VALGRIND_FLAGS)
VALGRIND_FLAGS = \
@ -887,11 +890,6 @@ clean-local:
-${FIND} . -name '*-diff.png' -print | ${XARGS} ${RM}
-${FIND} . -name '*.log' -print | ${XARGS} ${RM}
# Check tests under valgrind
# Saves log to valgrind-log
check-valgrind:
$(MAKE) $(AM_MAKEFLAGS) check TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) $(top_builddir)/libtool --mode=execute valgrind $(VALGRIND_FLAGS)' 2>&1 | tee valgrind-log
# The following definitions both should work.
#FAILED_TESTS = `grep -l '\<FAIL\>' $(TESTS:$(EXEEXT)=.log) 2>/dev/null | sed -e 's/[.]log$$//' | xargs echo`
FAILED_TESTS = `grep -l '\<FAIL\>' $(TESTS:$(EXEEXT)=.log) 2>/dev/null | tr '\n' ' ' | sed -e 's/[.]log */ /g; s/^ //; s/ $$//'`
@ -925,6 +923,15 @@ html:
rehtml:
@$(MAKE) $(AM_MAKEFLAGS) TESTS="$(FAILED_TESTS)" html
# Run tests under a tool specified by TOOL. For example, make run TOOL=gdb
run:
$(MAKE) $(AM_MAKEFLAGS) check TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) $(top_builddir)/libtool --mode=execute env $(TOOL)'
# Check tests under valgrind. Saves log to valgrind-log
check-valgrind:
$(MAKE) $(AM_MAKEFLAGS) check TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) $(top_builddir)/libtool --mode=execute valgrind $(VALGRIND_FLAGS)' 2>&1 | tee valgrind-log
%.log: % $(check_PROGRAMS)
-./$<
@ -937,6 +944,7 @@ index.html: $(srcdir)/make-html.pl $(TESTS:$(EXEEXT)=.log)
@echo Creating index.html
@perl $^ > $@
# Identify identical reference images
check-ref-dups:
@LANG=C; \

View file

@ -42,6 +42,25 @@ This will re-run the test suite, but only on tests that failed on the
last run. So this is a much faster way of checking if changes actually
fix bugs rather than running the entire test suite again.
Running tests under modified enviroments or tools
-------------------------------------------------
To run tests under a tool like gdb, one can use the run target and
the TOOL variable. For example:
make run TOOL=gdb TARGETS=pdf TESTS=user-font
If you want to run under valgrind, there is a specific target for that
that also sets a bunch of useful valgrind options. Try:
make check-valgrind TESTS=user-font
You can run tests under a modified environment you can use the ENV
make variable. However, that environment will also affect the libtool
wrapper of the tests. To only affect the actual test binaries, pass
such environment as TOOL:
make run TOOL="LD_PRELOAD=/path/to/something.so" TEST=user-font
Getting the elusive zero failures
---------------------------------
It's generally been very difficult to achieve a test run with zero