Index: /trunk/psLib/test/astro/Makefile.am
===================================================================
--- /trunk/psLib/test/astro/Makefile.am	(revision 8957)
+++ /trunk/psLib/test/astro/Makefile.am	(revision 8958)
@@ -17,8 +17,8 @@
 if BUILD_TESTS
 bin_PROGRAMS = $(TEST_PROGS)
+TESTS = $(TEST_PROGS)
 else
 check_PROGRAMS = $(TEST_PROGS)
 endif
-TESTS = $(TEST_PROGS)
 
 CLEANFILES = $(check_DATA) temp/* core core.* *~ *.bb *.bbg *.da gmon.out
Index: /trunk/psLib/test/db/Makefile.am
===================================================================
--- /trunk/psLib/test/db/Makefile.am	(revision 8957)
+++ /trunk/psLib/test/db/Makefile.am	(revision 8958)
@@ -9,8 +9,8 @@
 if BUILD_TESTS
 bin_PROGRAMS = $(TEST_PROGS)
+TESTS = $(TEST_PROGS)
 else
 check_PROGRAMS = $(TEST_PROGS)
 endif
-TESTS = $(TEST_PROGS)
 
 CLEANFILES = $(check_DATA) temp/* core core.* *~ *.bb *.bbg *.da gmon.out
Index: /trunk/psLib/test/fft/Makefile.am
===================================================================
--- /trunk/psLib/test/fft/Makefile.am	(revision 8957)
+++ /trunk/psLib/test/fft/Makefile.am	(revision 8958)
@@ -9,8 +9,8 @@
 if BUILD_TESTS
 bin_PROGRAMS = $(TEST_PROGS)
+TESTS = $(TEST_PROGS)
 else
 check_PROGRAMS = $(TEST_PROGS)
 endif
-TESTS = $(TEST_PROGS)
 
 CLEANFILES = $(check_DATA) temp/* core core.* *~ *.bb *.bbg *.da gmon.out
Index: /trunk/psLib/test/fits/Makefile.am
===================================================================
--- /trunk/psLib/test/fits/Makefile.am	(revision 8957)
+++ /trunk/psLib/test/fits/Makefile.am	(revision 8958)
@@ -9,8 +9,8 @@
 if BUILD_TESTS
 bin_PROGRAMS = $(TEST_PROGS)
+TESTS = $(TEST_PROGS)
 else
 check_PROGRAMS = $(TEST_PROGS)
 endif
-TESTS = $(TEST_PROGS)
 
 CLEANFILES = $(check_DATA) temp/* multi.fits table.fits tmpImages/* core core.* *~ \
Index: /trunk/psLib/test/imageops/Makefile.am
===================================================================
--- /trunk/psLib/test/imageops/Makefile.am	(revision 8957)
+++ /trunk/psLib/test/imageops/Makefile.am	(revision 8958)
@@ -9,8 +9,8 @@
 if BUILD_TESTS
 bin_PROGRAMS = $(TEST_PROGS)
+TESTS = $(TEST_PROGS)
 else
 check_PROGRAMS = $(TEST_PROGS)
 endif
-TESTS = $(TEST_PROGS)
 
 CLEANFILES = $(check_DATA) temp/* fOut.fits sOut.fits fBiOut.fits sBiOut.fits \
Index: /trunk/psLib/test/jpeg/Makefile.am
===================================================================
--- /trunk/psLib/test/jpeg/Makefile.am	(revision 8957)
+++ /trunk/psLib/test/jpeg/Makefile.am	(revision 8958)
@@ -9,8 +9,8 @@
 if BUILD_TESTS
 bin_PROGRAMS = $(TEST_PROGS)
+TESTS = $(TEST_PROGS)
 else
 check_PROGRAMS = $(TEST_PROGS)
 endif
-TESTS = $(TEST_PROGS)
 
 CLEANFILES = $(check_DATA) core core.* *~ *.bb *.bbg *.da gmon.out
Index: /trunk/psLib/test/math/Makefile.am
===================================================================
--- /trunk/psLib/test/math/Makefile.am	(revision 8957)
+++ /trunk/psLib/test/math/Makefile.am	(revision 8958)
@@ -9,8 +9,8 @@
 if BUILD_TESTS
 bin_PROGRAMS = $(TEST_PROGS)
+TESTS = $(TEST_PROGS)
 else
 check_PROGRAMS = $(TEST_PROGS)
 endif
-TESTS = $(TEST_PROGS)
 
 CLEANFILES = $(check_DATA) temp/* seed_msglog1.txt core core.* *~ *.bb *.bbg *.da gmon.out
Index: /trunk/psLib/test/mathtypes/Makefile.am
===================================================================
--- /trunk/psLib/test/mathtypes/Makefile.am	(revision 8957)
+++ /trunk/psLib/test/mathtypes/Makefile.am	(revision 8958)
@@ -15,8 +15,8 @@
 if BUILD_TESTS
 bin_PROGRAMS = $(TEST_PROGS)
+TESTS = $(TEST_PROGS)
 else
 check_PROGRAMS = $(TEST_PROGS)
 endif
-TESTS = $(TEST_PROGS)
 
 CLEANFILES = $(check_DATA) temp/* core core.* *~ *.bb *.bbg *.da gmon.out
Index: /trunk/psLib/test/sys/Makefile.am
===================================================================
--- /trunk/psLib/test/sys/Makefile.am	(revision 8957)
+++ /trunk/psLib/test/sys/Makefile.am	(revision 8958)
@@ -15,8 +15,8 @@
 if BUILD_TESTS
 bin_PROGRAMS = $(TEST_PROGS)
+TESTS = $(TEST_PROGS)
 else
 check_PROGRAMS = $(TEST_PROGS)
 endif
-TESTS = $(TEST_PROGS)
 
 CLEANFILES = $(check_DATA) temp/* log.txt log2.txt test.fits tst_psTrace02_OUT \
Index: /trunk/psLib/test/tap/configure.in
===================================================================
--- /trunk/psLib/test/tap/configure.in	(revision 8957)
+++ /trunk/psLib/test/tap/configure.in	(revision 8958)
@@ -3,4 +3,5 @@
 AM_INIT_AUTOMAKE([foreign])
 AC_CONFIG_HEADERS([src/config.h])
+AC_GNU_SOURCE
 AC_PROG_CC
 AC_PROG_LIBTOOL
@@ -40,22 +41,4 @@
 AC_CONFIG_FILES([Makefile
 		 src/Makefile
-		 tests/Makefile
-		 tests/diag/Makefile
-		 tests/fail/Makefile
-		 tests/ok/Makefile
-		 tests/ok/ok-hash/Makefile
-		 tests/ok/ok-numeric/Makefile
-		 tests/ok/ok/Makefile
-		 tests/pass/Makefile
-		 tests/plan/Makefile
-		 tests/plan/no-tests/Makefile
-		 tests/plan/no_plan/Makefile
-		 tests/plan/not-enough-tests/Makefile
-		 tests/plan/sane/Makefile
-		 tests/plan/skip_all/Makefile
-		 tests/plan/too-many-plans/Makefile
-		 tests/plan/too-many-tests/Makefile
-		 tests/skip/Makefile
-		 tests/todo/Makefile
 		])
 AC_OUTPUT
Index: /trunk/psLib/test/tap/src/tap.c
===================================================================
--- /trunk/psLib/test/tap/src/tap.c	(revision 8957)
+++ /trunk/psLib/test/tap/src/tap.c	(revision 8958)
@@ -25,4 +25,8 @@
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <ctype.h>
 #include <stdarg.h>
@@ -67,96 +71,96 @@
  */
 unsigned int
-_gen_result(int ok, const char *func, char *file, unsigned int line, 
-	    char *test_name, ...)
-{
-	va_list ap;
-	char *local_test_name = NULL;
-	char *c;
-	int name_is_digits;
-
-	LOCK;
-
-	test_count++;
-
-	/* Start by taking the test name and performing any printf()
-	   expansions on it */
-	if(test_name != NULL) {
-		va_start(ap, test_name);
-		vasprintf(&local_test_name, test_name, ap);
-		va_end(ap);
-
-		/* Make sure the test name contains more than digits
-		   and spaces.  Emit an error message and exit if it
-		   does */
-		if(local_test_name) {
-			name_is_digits = 1;
-			for(c = local_test_name; *c != '\0'; c++) {
-				if(!isdigit(*c) && !isspace(*c)) {
-					name_is_digits = 0;
-					break;
-				}
-			}
-
-			if(name_is_digits) {
-				diag("    You named your test '%s'.  You shouldn't use numbers for your test names.", local_test_name);
-				diag("    Very confusing.");
-			}
-		}
-	}
-
-	if(!ok) {
-		printf("not ");
-		failures++;
-	}
-
-	printf("ok %d", test_count);
-
-	if(test_name != NULL) {
-		printf(" - ");
-
-		/* Print the test name, escaping any '#' characters it
-		   might contain */
-		if(local_test_name != NULL) {
-			flockfile(stdout);
-			for(c = local_test_name; *c != '\0'; c++) {
-				if(*c == '#')
-					fputc('\\', stdout);
-				fputc((int)*c, stdout);
-			}
-			funlockfile(stdout);
-		} else {	/* vasprintf() failed, use a fixed message */
-			printf("%s", todo_msg_fixed);
-		}
-	}
-
-	/* If we're in a todo_start() block then flag the test as being
-	   TODO.  todo_msg should contain the message to print at this
-	   point.  If it's NULL then asprintf() failed, and we should
-	   use the fixed message.
-
-	   This is not counted as a failure, so decrement the counter if
-	   the test failed. */
-	if(todo) {
-		printf(" # TODO %s", todo_msg ? todo_msg : todo_msg_fixed);
-		if(!ok)
-			failures--;
-	}
-
-	printf("\n");
-
-	if(!ok) {
-		if(getenv("HARNESS_ACTIVE") != NULL)
-			fputs("\n", stderr);
-
-		diag("    Failed %stest (%s:%s() at line %d)", 
-		     todo ? "(TODO) " : "", file, func, line);
-	}
-	free(local_test_name);
-
-	UNLOCK;
-
-	/* We only care (when testing) that ok is positive, but here we
-	   specifically only want to return 1 or 0 */
-	return ok ? 1 : 0;
+_gen_result(int ok, const char *func, char *file, unsigned int line,
+            char *test_name, ...)
+{
+    va_list ap;
+    char *local_test_name = NULL;
+    char *c;
+    int name_is_digits;
+
+    LOCK;
+
+    test_count++;
+
+    /* Start by taking the test name and performing any printf()
+       expansions on it */
+    if(test_name != NULL) {
+        va_start(ap, test_name);
+        vasprintf(&local_test_name, test_name, ap);
+        va_end(ap);
+
+        /* Make sure the test name contains more than digits
+           and spaces.  Emit an error message and exit if it
+           does */
+        if(local_test_name) {
+            name_is_digits = 1;
+            for(c = local_test_name; *c != '\0'; c++) {
+                if(!isdigit(*c) && !isspace(*c)) {
+                    name_is_digits = 0;
+                    break;
+                }
+            }
+
+            if(name_is_digits) {
+                diag("    You named your test '%s'.  You shouldn't use numbers for your test names.", local_test_name);
+                diag("    Very confusing.");
+            }
+        }
+    }
+
+    if(!ok) {
+        printf("not ");
+        failures++;
+    }
+
+    printf("ok %d", test_count);
+
+    if(test_name != NULL) {
+        printf(" - ");
+
+        /* Print the test name, escaping any '#' characters it
+           might contain */
+        if(local_test_name != NULL) {
+            flockfile(stdout);
+            for(c = local_test_name; *c != '\0'; c++) {
+                if(*c == '#')
+                    fputc('\\', stdout);
+                fputc((int)*c, stdout);
+            }
+            funlockfile(stdout);
+        } else { /* vasprintf() failed, use a fixed message */
+            printf("%s", todo_msg_fixed);
+        }
+    }
+
+    /* If we're in a todo_start() block then flag the test as being
+       TODO.  todo_msg should contain the message to print at this
+       point.  If it's NULL then asprintf() failed, and we should
+       use the fixed message.
+
+       This is not counted as a failure, so decrement the counter if
+       the test failed. */
+    if(todo) {
+        printf(" # TODO %s", todo_msg ? todo_msg : todo_msg_fixed);
+        if(!ok)
+            failures--;
+    }
+
+    printf("\n");
+
+    if(!ok) {
+        if(getenv("HARNESS_ACTIVE") != NULL)
+            fputs("\n", stderr);
+
+        diag("    Failed %stest (%s:%s() at line %d)",
+             todo ? "(TODO) " : "", file, func, line);
+    }
+    free(local_test_name);
+
+    UNLOCK;
+
+    /* We only care (when testing) that ok is positive, but here we
+       specifically only want to return 1 or 0 */
+    return ok ? 1 : 0;
 }
 
@@ -168,15 +172,15 @@
 _tap_init(void)
 {
-	static int run_once = 0;
-
-	if(!run_once) {
-		atexit(_cleanup);
-
-		/* stdout needs to be unbuffered so that the output appears
-		   in the same place relative to stderr output as it does 
-		   with Test::Harness */
-		setbuf(stdout, 0);
-		run_once = 1;
-	}
+    static int run_once = 0;
+
+    if(!run_once) {
+        atexit(_cleanup);
+
+        /* stdout needs to be unbuffered so that the output appears
+           in the same place relative to stderr output as it does 
+           with Test::Harness */
+        setbuf(stdout, 0);
+        run_once = 1;
+    }
 }
 
@@ -188,21 +192,21 @@
 {
 
-	LOCK;
-
-	_tap_init();
-
-	if(have_plan != 0) {
-		fprintf(stderr, "You tried to plan twice!\n");
-		test_died = 1;
-		UNLOCK;
-		exit(255);
-	}
-
-	have_plan = 1;
-	no_plan = 1;
-
-	UNLOCK;
-
-	return 1;
+    LOCK;
+
+    _tap_init();
+
+    if(have_plan != 0) {
+        fprintf(stderr, "You tried to plan twice!\n");
+        test_died = 1;
+        UNLOCK;
+        exit(255);
+    }
+
+    have_plan = 1;
+    no_plan = 1;
+
+    UNLOCK;
+
+    return 1;
 }
 
@@ -214,20 +218,20 @@
 {
 
-	LOCK;
-
-	_tap_init();
-
-	skip_all = 1;
-
-	printf("1..0");
-
-	if(reason != NULL)
-		printf(" # Skip %s", reason);
-
-	printf("\n");
-
-	UNLOCK;
-
-	exit(0);
+    LOCK;
+
+    _tap_init();
+
+    skip_all = 1;
+
+    printf("1..0");
+
+    if(reason != NULL)
+        printf(" # Skip %s", reason);
+
+    printf("\n");
+
+    UNLOCK;
+
+    exit(0);
 }
 
@@ -239,29 +243,29 @@
 {
 
-	LOCK;
-
-	_tap_init();
-
-	if(have_plan != 0) {
-		fprintf(stderr, "You tried to plan twice!\n");
-		test_died = 1;
-		UNLOCK;
-		exit(255);
-	}
-
-	if(tests == 0) {
-		fprintf(stderr, "You said to run 0 tests!  You've got to run something.\n");
-		test_died = 1;
-		UNLOCK;
-		exit(255);
-	}
-
-	have_plan = 1;
-
-	_expected_tests(tests);
-
-	UNLOCK;
-
-	return e_tests;
+    LOCK;
+
+    _tap_init();
+
+    if(have_plan != 0) {
+        fprintf(stderr, "You tried to plan twice!\n");
+        test_died = 1;
+        UNLOCK;
+        exit(255);
+    }
+
+    if(tests == 0) {
+        fprintf(stderr, "You said to run 0 tests!  You've got to run something.\n");
+        test_died = 1;
+        UNLOCK;
+        exit(255);
+    }
+
+    have_plan = 1;
+
+    _expected_tests(tests);
+
+    UNLOCK;
+
+    return e_tests;
 }
 
@@ -269,15 +273,15 @@
 diag(char *fmt, ...)
 {
-	va_list ap;
-
-	fputs("# ", stderr);
-
-	va_start(ap, fmt);
-	vfprintf(stderr, fmt, ap);
-	va_end(ap);
-
-	fputs("\n", stderr);
-
-	return 0;
+    va_list ap;
+
+    fputs("# ", stderr);
+
+    va_start(ap, fmt);
+    vfprintf(stderr, fmt, ap);
+    va_end(ap);
+
+    fputs("\n", stderr);
+
+    return 0;
 }
 
@@ -286,6 +290,6 @@
 {
 
-	printf("1..%d\n", tests);
-	e_tests = tests;
+    printf("1..%d\n", tests);
+    e_tests = tests;
 }
 
@@ -293,25 +297,25 @@
 skip(unsigned int n, char *fmt, ...)
 {
-	va_list ap;
-	char *skip_msg;
-
-	LOCK;
-
-	va_start(ap, fmt);
-	asprintf(&skip_msg, fmt, ap);
-	va_end(ap);
-
-	while(n-- > 0) {
-		test_count++;
-		printf("ok %d # skip %s\n", test_count, 
-		       skip_msg != NULL ? 
-		       skip_msg : "libtap():malloc() failed");
-	}
-
-	free(skip_msg);
-
-	UNLOCK;
-
-	return 1;
+    va_list ap;
+    char *skip_msg;
+
+    LOCK;
+
+    va_start(ap, fmt);
+    asprintf(&skip_msg, fmt, ap);
+    va_end(ap);
+
+    while(n-- > 0) {
+        test_count++;
+        printf("ok %d # skip %s\n", test_count,
+               skip_msg != NULL ?
+               skip_msg : "libtap():malloc() failed");
+    }
+
+    free(skip_msg);
+
+    UNLOCK;
+
+    return 1;
 }
 
@@ -319,15 +323,15 @@
 todo_start(char *fmt, ...)
 {
-	va_list ap;
-
-	LOCK;
-
-	va_start(ap, fmt);
-	vasprintf(&todo_msg, fmt, ap);
-	va_end(ap);
-
-	todo = 1;
-
-	UNLOCK;
+    va_list ap;
+
+    LOCK;
+
+    va_start(ap, fmt);
+    vasprintf(&todo_msg, fmt, ap);
+    va_end(ap);
+
+    todo = 1;
+
+    UNLOCK;
 }
 
@@ -336,10 +340,10 @@
 {
 
-	LOCK;
-
-	todo = 0;
-	free(todo_msg);
-
-	UNLOCK;
+    LOCK;
+
+    todo = 0;
+    free(todo_msg);
+
+    UNLOCK;
 }
 
@@ -347,28 +351,28 @@
 exit_status(void)
 {
-	int r;
-
-	LOCK;
-
-	/* If there's no plan, just return the number of failures */
-	if(no_plan || !have_plan) {
-		UNLOCK;
-		return failures;
-	}
-
-	/* Ran too many tests?  Return the number of tests that were run
-	   that shouldn't have been */
-	if(e_tests < test_count) {
-		r = test_count - e_tests;
-		UNLOCK;
-		return r;
-	}
-
-	/* Return the number of tests that failed + the number of tests 
-	   that weren't run */
-	r = failures + e_tests - test_count;
-	UNLOCK;
-
-	return r;
+    int r;
+
+    LOCK;
+
+    /* If there's no plan, just return the number of failures */
+    if(no_plan || !have_plan) {
+        UNLOCK;
+        return failures;
+    }
+
+    /* Ran too many tests?  Return the number of tests that were run
+       that shouldn't have been */
+    if(e_tests < test_count) {
+        r = test_count - e_tests;
+        UNLOCK;
+        return r;
+    }
+
+    /* Return the number of tests that failed + the number of tests
+       that weren't run */
+    r = failures + e_tests - test_count;
+    UNLOCK;
+
+    return r;
 }
 
@@ -381,46 +385,46 @@
 {
 
-	LOCK;
-
-	/* If plan_no_plan() wasn't called, and we don't have a plan,
-	   and we're not skipping everything, then something happened
-	   before we could produce any output */
-	if(!no_plan && !have_plan && !skip_all) {
-		diag("Looks like your test died before it could output anything.");
-		UNLOCK;
-		return;
-	}
-
-	if(test_died) {
-		diag("Looks like your test died just after %d.", test_count);
-		UNLOCK;
-		return;
-	}
-
-
-	/* No plan provided, but now we know how many tests were run, and can
-	   print the header at the end */
-	if(!skip_all && (no_plan || !have_plan)) {
-		printf("1..%d\n", test_count);
-	}
-
-	if((have_plan && !no_plan) && e_tests < test_count) {
-		diag("Looks like you planned %d %s but ran %d extra.",
-		     e_tests, e_tests == 1 ? "test" : "tests", test_count - e_tests);
-		UNLOCK;
-		return;
-	}
-
-	if((have_plan || !no_plan) && e_tests > test_count) {
-		diag("Looks like you planned %d %s but only ran %d.",
-		     e_tests, e_tests == 1 ? "test" : "tests", test_count);
-		UNLOCK;
-		return;
-	}
-
-	if(failures)
-		diag("Looks like you failed %d %s of %d.", 
-		     failures, failures == 1 ? "test" : "tests", test_count);
-
-	UNLOCK;
-}
+    LOCK;
+
+    /* If plan_no_plan() wasn't called, and we don't have a plan,
+       and we're not skipping everything, then something happened
+       before we could produce any output */
+    if(!no_plan && !have_plan && !skip_all) {
+        diag("Looks like your test died before it could output anything.");
+        UNLOCK;
+        return;
+    }
+
+    if(test_died) {
+        diag("Looks like your test died just after %d.", test_count);
+        UNLOCK;
+        return;
+    }
+
+
+    /* No plan provided, but now we know how many tests were run, and can
+       print the header at the end */
+    if(!skip_all && (no_plan || !have_plan)) {
+        printf("1..%d\n", test_count);
+    }
+
+    if((have_plan && !no_plan) && e_tests < test_count) {
+        diag("Looks like you planned %d %s but ran %d extra.",
+             e_tests, e_tests == 1 ? "test" : "tests", test_count - e_tests);
+        UNLOCK;
+        return;
+    }
+
+    if((have_plan || !no_plan) && e_tests > test_count) {
+        diag("Looks like you planned %d %s but only ran %d.",
+             e_tests, e_tests == 1 ? "test" : "tests", test_count);
+        UNLOCK;
+        return;
+    }
+
+    if(failures)
+        diag("Looks like you failed %d %s of %d.",
+             failures, failures == 1 ? "test" : "tests", test_count);
+
+    UNLOCK;
+}
Index: /trunk/psLib/test/types/Makefile.am
===================================================================
--- /trunk/psLib/test/types/Makefile.am	(revision 8957)
+++ /trunk/psLib/test/types/Makefile.am	(revision 8958)
@@ -28,8 +28,8 @@
 if BUILD_TESTS
 bin_PROGRAMS = $(TEST_PROGS)
+TESTS = $(TEST_PROGS)
 else
 check_PROGRAMS = $(TEST_PROGS)
 endif
-TESTS = $(TEST_PROGS)
 
 check_DATA = \
Index: /trunk/psLib/test/xml/Makefile.am
===================================================================
--- /trunk/psLib/test/xml/Makefile.am	(revision 8957)
+++ /trunk/psLib/test/xml/Makefile.am	(revision 8958)
@@ -9,8 +9,8 @@
 if BUILD_TESTS
 bin_PROGRAMS = $(TEST_PROGS)
+TESTS = $(TEST_PROGS)
 else
 check_PROGRAMS = $(TEST_PROGS)
 endif
-TESTS = $(TEST_PROGS)
 
 EXTRA_DIST = psTime.xml psTime2.xml psTime3.xml psTime4.xml
