diff --git a/ChangeLog b/ChangeLog
index 4d7333aa6..6ad18b9b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-12-18 Peter Stephenson
+
+ * 24289 plus change suggested by Ismail in 24290:
+ Test/Makefile.in, Test/runtests.zsh, Test/ztst.zsh,
+ Test/.distfiles: count successful and unsuccessful scripts
+ and report with status.
+
2007-12-18 Peter Stephenson
* 24279: Src/jobs.c, Src/zle_main.c, Src/zle_thingy.c: allow
diff --git a/Test/.distfiles b/Test/.distfiles
index 2a33c9708..d79079696 100644
--- a/Test/.distfiles
+++ b/Test/.distfiles
@@ -1,15 +1,41 @@
DISTFILES_SRC='
+.cvsignore
.distfiles
-.cvsignore B01cd.ztst D03procsubst.ztst Y02compmatch.ztst
-C01arith.ztst D04parameter.ztst Y03arguments.ztst
-A01grammar.ztst C02cond.ztst D05array.ztst comptest
-A02alias.ztst C03traps.ztst E02xtrace.ztst
-A03quoting.ztst C04funcdef.ztst Makefile.in ztst.zsh
-A04redirect.ztst D01prompt.ztst V02zregexparse.ztst
-A05execution.ztst D02glob.ztst Y01completion.ztst
-D06subscript.ztst D07multibyte.ztst D08cmdsubst.ztst
-V01zmodload.ztst E01options.ztst
-B02typeset.ztst B03print.ztst A06assign.ztst B04read.ztst
-V03mathfunc.ztst V04features.ztst V05styles.ztst
+A01grammar.ztst
+A02alias.ztst
+A03quoting.ztst
+A04redirect.ztst
+A05execution.ztst
+A06assign.ztst
+B01cd.ztst
+B02typeset.ztst
+B03print.ztst
+B04read.ztst
+C01arith.ztst
+C02cond.ztst
+C03traps.ztst
+C04funcdef.ztst
+D01prompt.ztst
+D02glob.ztst
+D03procsubst.ztst
+D04parameter.ztst
+D05array.ztst
+D06subscript.ztst
+D07multibyte.ztst
+D08cmdsubst.ztst
+E01options.ztst
+E02xtrace.ztst
+Makefile.in
README
+V01zmodload.ztst
+V02zregexparse.ztst
+V03mathfunc.ztst
+V04features.ztst
+V05styles.ztst
+Y01completion.ztst
+Y02compmatch.ztst
+Y03arguments.ztst
+comptest
+runtests.zsh
+ztst.zsh
'
diff --git a/Test/Makefile.in b/Test/Makefile.in
index 1e03c703f..5eeb716e2 100644
--- a/Test/Makefile.in
+++ b/Test/Makefile.in
@@ -45,11 +45,17 @@ check test:
cd $(dir_top) && DESTDIR= \
$(MAKE) MODDIR=`pwd`/$(subdir)/Modules install.modules > /dev/null; \
fi
- -for f in $(sdir)/$(TESTNUM)*.ztst; do \
- ZTST_exe=$(dir_top)/Src/zsh \
- $(dir_top)/Src/zsh +Z -f $(sdir)/ztst.zsh $$f; \
- done
- rm -rf Modules .zcompdump
+ if ZTST_testlist="`for f in $(sdir)/$(TESTNUM)*.ztst; \
+ do echo $$f; done`" \
+ ZTST_srcdir="$(sdir)" \
+ ZTST_exe=$(dir_top)/Src/zsh \
+ $(dir_top)/Src/zsh +Z -f $(sdir)/runtests.zsh; then \
+ stat=0; \
+ else \
+ stat=1; \
+ fi; \
+ rm -rf Modules .zcompdump; \
+ exit $$stat
# ========== DEPENDENCIES FOR CLEANUP ==========
diff --git a/Test/runtests.zsh b/Test/runtests.zsh
new file mode 100644
index 000000000..1d4321576
--- /dev/null
+++ b/Test/runtests.zsh
@@ -0,0 +1,23 @@
+#!/bin/zsh -f
+
+emulate zsh
+
+# Run all specified tests, keeping count of which succeeded.
+# The reason for this extra layer above the test script is to
+# protect from catastrophic failure of an individual test.
+# We could probably do that with subshells instead.
+
+integer success failure
+for file in "${(f)ZTST_testlist}"; do
+ $ZTST_exe +Z -f $ZTST_srcdir/ztst.zsh $file
+ if (( $? )); then
+ (( failure++ ))
+ else
+ (( success++ ))
+ fi
+done
+print "**************************************
+$success successful test script${${success:#1}:+s}, \
+$failure failure${${failure:#1}:+s}
+**************************************"
+return $(( failure ? 1 : 0 ))
diff --git a/Test/ztst.zsh b/Test/ztst.zsh
index cc27c5791..bd9cd5d1c 100755
--- a/Test/ztst.zsh
+++ b/Test/ztst.zsh
@@ -1,4 +1,4 @@
-#!/usr/local/bin/zsh -f
+#!/bin/zsh -f
# The line above is just for convenience. Normally tests will be run using
# a specified version of zsh. With dynamic loading, any required libraries
# must already have been installed in that case.