summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--library/tcltest/pkgIndex.tcl2
-rw-r--r--library/tcltest/tcltest.tcl33
-rw-r--r--tests/init.test28
-rw-r--r--tests/package.test6
-rw-r--r--unix/Makefile.in4
-rw-r--r--win/Makefile.in4
7 files changed, 59 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index 9619fd4..a03c070 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2011-03-10 Donal K. Fellows <dkf@users.sf.net>
+ * library/tcltest/tcltest.tcl (loadIntoSlaveInterpreter): Added this
+ command to handle connecting tcltest to a slave interpreter. This adds
+ in the hook (inside the tcltest namespace) that allows the tests run
+ in the child interpreter to be reported as part of the main sequence
+ of test results. Bumped version of tcltest to 2.3.3.
+ * tests/init.test, tests/package.test: Adapted these test files to use
+ the new feature.
+
* generic/tclAlloc.c, generic/tclCmdMZ.c, generic/tclCompExpr.c:
* generic/tclCompile.c, generic/tclEnv.c, generic/tclEvent.c:
* generic/tclIO.c, generic/tclIOCmd.c, generic/tclIORChan.c:
diff --git a/library/tcltest/pkgIndex.tcl b/library/tcltest/pkgIndex.tcl
index fe80272..2eb43a6 100644
--- a/library/tcltest/pkgIndex.tcl
+++ b/library/tcltest/pkgIndex.tcl
@@ -9,4 +9,4 @@
# full path name of this file's directory.
if {![package vsatisfies [package provide Tcl] 8.5]} {return}
-package ifneeded tcltest 2.3.2 [list source [file join $dir tcltest.tcl]]
+package ifneeded tcltest 2.3.3 [list source [file join $dir tcltest.tcl]]
diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl
index 15b7293..ad61f9c 100644
--- a/library/tcltest/tcltest.tcl
+++ b/library/tcltest/tcltest.tcl
@@ -22,7 +22,7 @@ namespace eval tcltest {
# When the version number changes, be sure to update the pkgIndex.tcl file,
# and the install directory in the Makefiles. When the minor version
# changes (new feature) be sure to update the man page as well.
- variable Version 2.3.2
+ variable Version 2.3.3
# Compatibility support for dumb variables defined in tcltest 1
# Do not use these. Call [package provide Tcl] and [info patchlevel]
@@ -795,6 +795,29 @@ namespace eval tcltest {
trace variable Option(-errfile) w \
[namespace code {errorChannel $Option(-errfile) ;#}]
+ proc loadIntoSlaveInterpreter {slave args} {
+ variable Version
+ interp eval $slave [list set ::argv $args]
+ interp eval $slave [list package require tcltest $Version]
+ interp alias $slave ::tcltest::ReportToMaster \
+ {} ::tcltest::ReportedFromSlave
+ }
+ proc ReportedFromSlave {total passed skipped failed because newfiles} {
+ variable numTests
+ variable skippedBecause
+ variable createdNewFiles
+ incr numTests(Total) $total
+ incr numTests(Passed) $passed
+ incr numTests(Skipped) $skipped
+ incr numTests(Failed) $failed
+ foreach {constraint count} $because {
+ incr skippedBecause($constraint) $count
+ }
+ foreach {testfile created} $newfiles {
+ lappend createdNewFiles($testfile) {*}$created
+ }
+ return
+ }
}
#####################################################################
@@ -2354,6 +2377,14 @@ proc tcltest::cleanupTests {{calledFromAllFile 0}} {
FillFilesExisted
set testFileName [file tail [info script]]
+ # Hook to handle reporting to a parent interpreter
+ if {[llength [info commands [namespace current]::ReportToMaster]]} {
+ ReportToMaster $numTests(Total) $numTests(Passed) $numTests(Skipped) \
+ $numTests(Failed) [array get skippedBecause] \
+ [array get createdNewFiles]
+ set testSingleFile false
+ }
+
# Call the cleanup hook
cleanupTestsHook
diff --git a/tests/init.test b/tests/init.test
index 40fa507..62b3af2 100644
--- a/tests/init.test
+++ b/tests/init.test
@@ -45,26 +45,22 @@ test init-1.7 {auto_qualify - multiples colons 1} {
test init-1.8 {auto_qualify - multiple colons 2} {
auto_qualify :::foo ::bar
} foo
-
+
# We use a sub-interp and auto_reset and double the tests because there is 2
# places where auto_loading occur (before loading the indexes files and after)
set testInterp [interp create]
-interp eval $testInterp [list set argv $argv]
+tcltest::loadIntoSlaveInterpreter $testInterp {*}$argv
interp eval $testInterp {
- package require tcltest 2
namespace import -force ::tcltest::*
customMatch pairwise {apply {{mode pair} {
if {[llength $pair] != 2} {error "need a pair of values to check"}
string $mode [lindex $pair 0] [lindex $pair 1]
}}}
-}
-# TODO: Connect result reporting to master interp
-interp eval $testInterp {
-
-auto_reset
-catch {rename parray {}}
+ auto_reset
+ catch {rename parray {}}
+
test init-2.0 {load parray - stage 1} -body {
parray
} -returnCodes error -cleanup {
@@ -127,12 +123,12 @@ test init-3.0 {random stuff in the auto_index, should still work} {
set count 0
foreach arg [subst -nocommands -novariables {
- c
- {argument
+ c
+ {argument
which spans
multiple lines}
- {argument which is all on one line but which is of such great length that the Tcl C library will truncate it when appending it onto the global error stack}
- {argument which spans multiple lines
+ {argument which is all on one line but which is of such great length that the Tcl C library will truncate it when appending it onto the global error stack}
+ {argument which spans multiple lines
and is long enough to be truncated and
" <- includes a false lead in the prune point search
and must be longer still to force truncation}
@@ -141,13 +137,13 @@ foreach arg [subst -nocommands -novariables {
error stack cannot be uniquely determined.
foo bar foo
"}
- {contrived example: rare circumstance
+ {contrived example: rare circumstance
where the point at which to prune the
error stack cannot be uniquely determined.
foo bar
"}
- {argument that contains non-ASCII character, \u20ac, and which is of such great length that it will be longer than 150 bytes so it will be truncated by the Tcl C library}
- }] {
+ {argument that contains non-ASCII character, \u20ac, and which is of such great length that it will be longer than 150 bytes so it will be truncated by the Tcl C library}
+ }] { ;# emacs needs -> "
test init-4.$count.0 {::errorInfo produced by [unknown]} -setup {
auto_reset
diff --git a/tests/package.test b/tests/package.test
index dbeedb7..55aaf2b 100644
--- a/tests/package.test
+++ b/tests/package.test
@@ -19,11 +19,9 @@ if {"::tcltest" ni [namespace children]} {
# Do all this in a slave interp to avoid garbaging the package list
set i [interp create]
-interp eval $i [list set argv $argv]
-interp eval $i [list package require tcltest 2]
-interp eval $i [list namespace import -force ::tcltest::*]
+tcltest::loadIntoSlaveInterpreter $i {*}$argv
interp eval $i {
-
+namespace import -force ::tcltest::*
package forget {*}[package names]
set oldPkgUnknown [package unknown]
package unknown {}
diff --git a/unix/Makefile.in b/unix/Makefile.in
index bba6f91..20ba896 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -836,8 +836,8 @@ install-libraries: libraries
done;
@echo "Installing package msgcat 1.4.3 as a Tcl Module";
@$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/msgcat-1.4.3.tm;
- @echo "Installing package tcltest 2.3.2 as a Tcl Module";
- @$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/tcltest-2.3.2.tm;
+ @echo "Installing package tcltest 2.3.3 as a Tcl Module";
+ @$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/tcltest-2.3.3.tm;
@echo "Installing package platform 1.0.9 as a Tcl Module";
@$(INSTALL_DATA) $(TOP_DIR)/library/platform/platform.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.4/platform-1.0.9.tm;
diff --git a/win/Makefile.in b/win/Makefile.in
index eaf40d1..a2d855d 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -672,8 +672,8 @@ install-libraries: libraries install-tzdata install-msgs
done;
@echo "Installing package msgcat 1.4.3 as a Tcl Module";
@$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/msgcat-1.4.3.tm;
- @echo "Installing package tcltest 2.3.2 as a Tcl Module";
- @$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/tcltest-2.3.2.tm;
+ @echo "Installing package tcltest 2.3.3 as a Tcl Module";
+ @$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/tcltest-2.3.3.tm;
@echo "Installing package platform 1.0.9 as a Tcl Module";
@$(COPY) $(ROOT_DIR)/library/platform/platform.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.4/platform-1.0.9.tm;
@echo "Installing package platform::shell 1.1.4 as a Tcl Module";