Tcl Library Source Code

Check-in [ecb61a8a4f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:sak: To improve test isolation, give each .test file its own interpreter.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | pooryorick
Files: files | file ages | folders
SHA3-256: ecb61a8a4fe7623ebb0caaf20f015d2c82b98a6d84d2e2ca3da17dbc2a2d9b75
User & Date: pooryorick 2018-12-06 10:13:44.204
Context
2021-05-01
12:54
sak: To improve test isolation, give each .test file its own interpreter. check-in: 47d611db27 user: pooryorick tags: trunk
12:35
sak: To improve test isolation, give each .test file its own interpreter. check-in: a5c744bddf user: pooryorick tags: mime
2018-12-06
10:48
chan and mime modules: Update Tcl version requirements. check-in: 1832d405fb user: pooryorick tags: pooryorick
10:13
sak: To improve test isolation, give each .test file its own interpreter. check-in: ecb61a8a4f user: pooryorick tags: pooryorick
02:15
Bug fixes and a version bump to practcl check-in: 32300021ed user: hypnotoad tags: pooryorick
Changes
Unified Diff Ignore Whitespace Patch
Changes to support/devel/all.tcl.
150
151
152
153
154
155
156


157
158
159
160
161


162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223

224
225
226
227
228
229
230

    # For each module, make a slave interp and source that module's
    # tests into the slave. This isolates the test suites from one
    # another.

    Note Module [file tail $module]



    set c [interp create]
    interp alias $c pSet {} set
    interp alias $c Note {} Note

    $c eval {


	# import the auto_path from the parent interp,
	# so "package require" works

	set ::auto_path    [pSet ::auto_path]
	set ::argv0        [pSet ::argv0]
	set ::tcllibModule [pSet module]

	# The next command allows the execution of 'tk' constrained
	# tests, if Tk is present (for example when this code is run
	# run by 'wish').

	# Under wish 8.2/8.3 we have to explicitly load Tk into the
	# slave, the package management is not able to.

	if {![package vsatisfies [package provide Tcl] 8.4]} {
	    catch {
		load {} Tk
		wm withdraw .
	    }
	} else {
	    catch {
		package require Tk
		wm withdraw .
	    }
	}

	package require tcltest

	# Re-import, the loading of an older tcltest package reset it
	# to the standard set of paths.
	set ::auto_path [pSet ::auto_path]

	namespace import ::tcltest::*
	set ::tcltest::testSingleFile false
	set ::tcltest::testsDirectory [pSet ::tcltest::testsDirectory]

	# configure not present in tcltest 1.x
	if {[catch {::tcltest::configure -verbose bstep}]} {
	    set ::tcltest::verbose psb
	}
    }

    interp alias \
	    $c ::tcltest::cleanupTestsHook \
	    {} ::tcltest::cleanupTestsHook $c

    # source each of the specified tests
    foreach file [lsort [::tcltest::getMatchingFiles]] {
	set tail [file tail $file]
	Note Testsuite [string map [list "$root/" ""] $file]
	Note StartFile [Now]
	$c eval {
	    if {[catch {source [pSet file]} msg]} {
		puts stdout "@+"
		puts stdout @|[join [split $errorInfo \n] "\n@|"]
		puts stdout "@-"
	    }
	}
	Note EndFile [Now]
    }
    interp delete $c
    puts stdout ""

}

# cleanup
Note End [Now]
::tcltest::cleanupTests 1
# FRINK: nocheck
# Use of 'exit' ensures proper termination of the test system when







>
>
|
|
|

|
>
>
|
|

|
|
|

|
|
|

|
|

|
|
|
|
|
|
|
|
|
|
|

|

|
|
|

|
|
|

|
|
|
|
|

|
|
|

|
<











|
|
|
>







150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212

213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234

    # For each module, make a slave interp and source that module's
    # tests into the slave. This isolates the test suites from one
    # another.

    Note Module [file tail $module]

    # source each of the specified tests
    foreach file [lsort [::tcltest::getMatchingFiles]] {
	set c [interp create]
	interp alias $c pSet {} set
	interp alias $c Note {} Note

	$c eval {

	    set file [pSet file]
	    # import the auto_path from the parent interp,
	    # so "package require" works

	    set ::auto_path    [pSet ::auto_path]
	    set ::argv0        [pSet ::argv0]
	    set ::tcllibModule [pSet module]

	    # The next command allows the execution of 'tk' constrained
	    # tests, if Tk is present (for example when this code is run
	    # run by 'wish').

	    # Under wish 8.2/8.3 we have to explicitly load Tk into the
	    # slave, the package management is not able to.

	    if {![package vsatisfies [package provide Tcl] 8.4]} {
		catch {
		    load {} Tk
		    wm withdraw .
		}
	    } else {
		catch {
		    package require Tk
		    wm withdraw .
		}
	    }

	    package require tcltest

	    # Re-import, the loading of an older tcltest package reset it
	    # to the standard set of paths.
	    set ::auto_path [pSet ::auto_path]

	    namespace import ::tcltest::*
	    set ::tcltest::testSingleFile false
	    set ::tcltest::testsDirectory [pSet ::tcltest::testsDirectory]

	    # configure not present in tcltest 1.x
	    if {[catch {::tcltest::configure -verbose bstep}]} {
		set ::tcltest::verbose psb
	    }
	}

	interp alias \
		$c ::tcltest::cleanupTestsHook \
		{} ::tcltest::cleanupTestsHook $c



	set tail [file tail $file]
	Note Testsuite [string map [list "$root/" ""] $file]
	Note StartFile [Now]
	$c eval {
	    if {[catch {source [pSet file]} msg]} {
		puts stdout "@+"
		puts stdout @|[join [split $errorInfo \n] "\n@|"]
		puts stdout "@-"
	    }
	}
	Note EndFile [Now]

	interp delete $c
	puts stdout ""
    }
}

# cleanup
Note End [Now]
::tcltest::cleanupTests 1
# FRINK: nocheck
# Use of 'exit' ensures proper termination of the test system when