2009-05-18  Jan Michael Alonzo  <jmalonzo@webkit.org>

         Reviewed by Xan Lopez.

         [Gtk] Various autotools build refactoring and fixes
         https://bugs.webkit.org/show_bug.cgi?id=25286

         Add support for running unit tests. Also run the tests whenever
         the 'check' target runs.

         * GNUmakefile.am:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@43827 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/GNUmakefile.am b/GNUmakefile.am
index 613866a..aba8e49 100644
--- a/GNUmakefile.am
+++ b/GNUmakefile.am
@@ -36,6 +36,10 @@
 # Script for creating hash tables
 CREATE_HASH_TABLE = $(srcdir)/JavaScriptCore/create_hash_table
 
+# Programs to run the WebKitGtk unit tests
+GTESTER = gtester
+GTESTER_REPORT = gtester-report
+
 # Libraries and support components
 bin_PROGRAMS :=
 noinst_PROGRAMS :=
@@ -575,3 +579,23 @@
 installdirs-data-local: po-installdirs-data-local
 
 uninstall-local: po-uninstall-local
+
+# Run all tests in cwd
+# FIXME: we should run this under xvfb
+test: $(TEST_PROGS)
+	$(GTESTER) --verbose $(TEST_PROGS);
+
+# test-report: run tests in cwd and generate report
+# full-report: run tests in cwd with -m perf and -m slow and generate report
+# perf-report: run tests in cwd with -m perf and generate report
+test-report full-report perf-report: $(TEST_PROGS)
+	@ case $@ in \
+	  test-report) test_options="-k";; \
+	  full-report) test_options="-k -m=perf";; \
+	  perf-report) test_options="-k -m=perf -m=slow";; \
+	  esac ; \
+	  $(GTESTER) --verbose $$test_options -o test-report.xml $(TEST_PROGS); \
+	  $(GTESTER_REPORT) test-report.xml > test-report.html ;
+
+.PHONY: test test-report perf-report full-report
+check-local: test