Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | minor changes to fix bad code that was outside of "test" calls. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | core-8-1-branch-old |
Files: | files | file ages | folders |
SHA1: |
f2aaa3e425f91d8c5316b1742b10b0ad |
User & Date: | hershey 1999-04-02 18:57:06.000 |
Context
1999-04-02
| ||
18:59 | lint check-in: 13af4c70f4 user: hershey tags: core-8-1-branch-old | |
18:57 | minor changes to fix bad code that was outside of "test" calls. check-in: f2aaa3e425 user: hershey tags: core-8-1-branch-old | |
00:54 | Fix previous patch on Solaris, need to provide the Tcl package before calling Tcl_InitStubs(). check-in: c8e8856000 user: redman tags: core-8-1-branch-old | |
Changes
Changes to tests/README.
1 2 | README -- Tcl test suite design document. | | | 1 2 3 4 5 6 7 8 9 10 | README -- Tcl test suite design document. RCS: @(#) $Id: README,v 1.1.2.7 1999/04/02 18:57:06 hershey Exp $ Contents: --------- 1. Introduction 2. Definitions file 3. Writing a new test |
︙ | ︙ | |||
28 29 30 31 32 33 34 | You can run the tests in three ways: (a) type "make test" in ../unix; this will run all of the tests. (b) type "tcltest <testFile> ?<option> <value>? Command line options include: | | | > | | > > | | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | You can run the tests in three ways: (a) type "make test" in ../unix; this will run all of the tests. (b) type "tcltest <testFile> ?<option> <value>? Command line options include: -verbose <level> set the level of verbosity to a substring of "bps". See the "Test output" section for an explanation of this option. -match <matchList> only run tests that match one or more of the glob patterns in <matchList> -skip <skipList> do not run tests that match one or more of the glob patterns in <skipList> -file <globPattern> only source test files that match <globPattern> (relative to the "tests" directory). This option only applies when you run the test suite with the "all.tcl" file. -constraints <list> tests with any constraints in <list> will not be skipped. Not that elements of <list> must exactly match the existing constraints. (c) start up tcltest in this directory, then "source" the test file (for example, type "source parse.test"). To run all of the tests, type "source all.tcl". To use the options in interactive mode, you can set their corresponding tcltest namespace variables after sourcing the defs.tcl file. ::tcltest::matchingTests ::tcltest::skippingTests ::tcltest::testConfig(nonPortable) ::tcltest::testConfig(knownBug) ::tcltest::testConfig(userInteractive) In all cases, no output will be generated if all goes well, except for a listing of the test files and a statistical summary. If there are errors, then additional messages will appear in the format described below. Note that some tests will be skipped if you run as superuser. This approach to testing was designed and initially implemented by Mary Ann May-Pumphrey of Sun Microsystems in the early 1990's. Many thanks to her for donating her work back to the public Tcl release. |
︙ | ︙ | |||
143 144 145 146 147 148 149 | unixOnly) to any tests that should not always be run. For example, a test that should only be run on Unix should look like the following: test getAttribute-1.1 {testing file permissions} {unixOnly} { lindex [file attributes foo.tcl] 5 } {00644} | | | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | unixOnly) to any tests that should not always be run. For example, a test that should only be run on Unix should look like the following: test getAttribute-1.1 {testing file permissions} {unixOnly} { lindex [file attributes foo.tcl] 5 } {00644} See the "Constraints" section for a list of built-in constraints and information on how to add your own constraints. The <script> argument contains the script to run to carry out the test. It must return a result that can be checked for correctness. If your script requires that a file be created on the fly, please use the ::tcltest::makeFile procedure. If your test requires that a small file (<50 lines) be checked in, please consider creating the file on |
︙ | ︙ | |||
231 232 233 234 235 236 237 | nonBlockFiles test can only be run if platform supports setting files into nonblocking mode asyncPipeClose test can only be run if platform supports async flush and async close on a pipe unixExecs test can only be run if this machine has commands | | | > | 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | nonBlockFiles test can only be run if platform supports setting files into nonblocking mode asyncPipeClose test can only be run if platform supports async flush and async close on a pipe unixExecs test can only be run if this machine has commands such as 'cat', 'echo', etc. available. hasIsoLocale test can only be run if can switch to an ISO locale fonts test can only be run if the wish app's fonts can be controlled by Tk. root test can only run if Unix user is root notRoot test can only run if Unix user is not root eformat test can only run if app has a working version of sprintf with respect to the "e" format of floating-point numbers. stdio test can only be run if the current app can be |
︙ | ︙ | |||
270 271 272 273 274 275 276 | # Remove files created by these tests # Change to original working directory # Unset global arrays ::tcltest::cleanupTests return | | | | | | | | | 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | # Remove files created by these tests # Change to original working directory # Unset global arrays ::tcltest::cleanupTests return The all.tcl file will source your new test file if the filename matches the tests/*.test pattern (as it should). The names of test files that contain regression (or glass-box) tests should correspond to the Tcl or C code file that they are testing. For example, the test file for the C file "tclCmdAH.c" is "cmdAH.test". Test files that contain black-box tests may not correspond to any Tcl or C code file so they should match the pattern "*_bb.test". Be sure your new test file can be run from any working directory. Be sure no temporary files are left behind by your test file. Be sure your tests can run cross-platform in both a build environment as well as an installation environment. If your test file contains |
︙ | ︙ | |||
401 402 403 404 405 406 407 | 2) VERBOSE values are no longer numeric. Please see the section above on "Test output" for the new usage of the ::tcltest::verbose variable. 3) When you run "make test", the working dir for the test suite is now the one from which you called "make test", rather than the "tests" directory. This change allows for both unix and windows test | | | | | 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 | 2) VERBOSE values are no longer numeric. Please see the section above on "Test output" for the new usage of the ::tcltest::verbose variable. 3) When you run "make test", the working dir for the test suite is now the one from which you called "make test", rather than the "tests" directory. This change allows for both unix and windows test suites to be run simultaneously without interference with each other or with existing files. All tests must now run independently of their working directory. 4) The "all", "defs", and "visual" files are now called "all.tcl", "defs.tcl", and "visual_bb.test", respectively. 5) Instead of creating a doAllTests file in the tests directory, to run all nonPortable tests, just use the "-constraints nonPortable" command line flag. If you are running interactively, you can set the ::tcltest::testConfig(nonPortable) variable to 1 (after sourcing the defs.tcl file). |
Changes to tests/defs.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # defs.tcl -- # # This file contains support code for the Tcl/Tk test suite.It is # It is normally sourced by the individual files in the test suite # before they run their tests. This improved approach to testing # was designed and initially implemented by Mary Ann May-Pumphrey # of Sun Microsystems. # # Copyright (c) 1990-1994 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # defs.tcl -- # # This file contains support code for the Tcl/Tk test suite.It is # It is normally sourced by the individual files in the test suite # before they run their tests. This improved approach to testing # was designed and initially implemented by Mary Ann May-Pumphrey # of Sun Microsystems. # # Copyright (c) 1990-1994 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # # RCS: @(#) $Id: defs.tcl,v 1.1.2.9 1999/04/02 18:57:07 hershey Exp $ # Initialize wish shell if {[info exists tk_version]} { tk appname tktest wm title . tktest } else { # Ensure that we have a minimal auto_path so we don't pick up extra junk. |
︙ | ︙ | |||
454 455 456 457 458 459 460 | puts stdout "Files with failing tests: $::tcltest::failFiles" set ::tcltest::failFiles {} } } # if any tests were skipped, print the constraints that kept them # from running. | | > | | 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 | puts stdout "Files with failing tests: $::tcltest::failFiles" set ::tcltest::failFiles {} } } # if any tests were skipped, print the constraints that kept them # from running. set constraintList [array names ::tcltest::skippedBecause] if {[llength $constraintList] > 0} { puts stdout "Number of tests skipped for each constraint:" foreach constraint [lsort $constraintList] { puts stdout \ "\t$::tcltest::skippedBecause($constraint)\t$constraint" unset ::tcltest::skippedBecause($constraint) } } # report the names of test files in ::tcltest::createdNewFiles, and |
︙ | ︙ |
Changes to tests/http.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # Copyright (c) 1994-1996 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # Copyright (c) 1994-1996 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # # RCS: @(#) $Id: http.test,v 1.1.2.7 1999/04/02 18:57:08 hershey Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { source [file join [pwd] [file dirname [info script]] defs.tcl] } if {[catch {package require http 2.0}]} { if {[info exist http2]} { |
︙ | ︙ | |||
32 33 34 35 36 37 38 | } } set port 8010 set bindata "This is binary data\x0d\x0amore\x0dmore\x0amore\x00null" | > | | | | | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | } } set port 8010 set bindata "This is binary data\x0d\x0amore\x0dmore\x0amore\x00null" set httpdFile [file join $::tcltest::testsDir httpd] if {[info commands testthread] == "testthread" && [file exists $httpdFile]} { set httpthread [testthread create { source $httpdFile testthread wait }] testthread send $httpthread [list set port $port] testthread send $httpthread [list set bindata $bindata] testthread send $httpthread {httpd_init $port} puts "Running httpd in thread $httpthread" } else { if ![file exists $httpdFile] { puts "Cannot read $httpdFile script, http test skipped" unset port return } source $httpdFile if [catch {httpd_init $port} listen] { puts "Cannot start http server, http test skipped" unset port return } } |
︙ | ︙ |
Changes to tests/io.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # Copyright (c) 1991-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | < < < | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | # Copyright (c) 1991-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # RCS: @(#) $Id: io.test,v 1.1.2.13 1999/04/02 18:57:08 hershey Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { source [file join [pwd] [file dirname [info script]] defs.tcl] } if {"[info commands testchannel]" != "testchannel"} { puts "Skipping io tests. This application does not seem to have the" puts "testchannel command that is needed to run these tests." return } ::tcltest::saveState removeFile test1 removeFile pipe # set up a long data file for some of the following tests set f [open longfile w] fconfigure $f -eofchar {} -translation lf for { set i 0 } { $i < 100 } { incr i} { puts $f "#123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef \#123456789abcdef01 |
︙ | ︙ | |||
58 59 60 61 62 63 64 | close $f exit 0 } } vwait forever } cat | | | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | close $f exit 0 } } vwait forever } cat set thisScript [file join [pwd] [info script]] # These tests are disabled until we decide what to do with "unsupported0". # test io-1.1 {unsupported0 command} {knownBug} { removeFile test1 set f1 [open iocmd.test] set f2 [open test1 w] |
︙ | ︙ | |||
5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 | puts $f "line 1" close $f set f [open test3 r] lappend x [gets $f] close $f set x } {0600 {line 1}} test io-40.3 {POSIX open access modes: CREAT} {unixOnly umask2} { # This test only works if your umask is 2, like ouster's. removeFile test3 set f [open test3 {WRONLY CREAT}] close $f file stat test3 stats format "0%o" [expr $stats(mode)&0777] | > > > > > | 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 | puts $f "line 1" close $f set f [open test3 r] lappend x [gets $f] close $f set x } {0600 {line 1}} # some tests can only be run is umask is 2 # if "umask" cannot be run, the tests will be skipped. catch {set ::tcltest::testConfig(umask2) [expr {[exec umask] == 2}]} test io-40.3 {POSIX open access modes: CREAT} {unixOnly umask2} { # This test only works if your umask is 2, like ouster's. removeFile test3 set f [open test3 {WRONLY CREAT}] close $f file stat test3 stats format "0%o" [expr $stats(mode)&0777] |
︙ | ︙ |
Changes to tests/unixFile.test.
1 2 3 4 5 6 7 8 9 10 11 | # This file contains tests for the routines in the file tclUnixFile.c # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # | | < > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | # This file contains tests for the routines in the file tclUnixFile.c # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1998-1999 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # RCS: @(#) $Id: unixFile.test,v 1.1.2.6 1999/04/02 18:57:09 hershey Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { source [file join [pwd] [file dirname [info script]] defs.tcl] } if {[info commands testobj] == {}} { puts "This application hasn't been compiled with the \"testfindexecutable\"" puts "command, so I can't test the Tcl_FindExecutable function" ::tcltest::cleanupTests return } catch { set oldPath $env(PATH) close [open junk w] file attributes junk -perm 0777 } set absPath [file join [pwd] junk] test unixFile-1.1 {Tcl_FindExecutable} {unixOnly} { set env(PATH) "" testfindexecutable junk } $absPath test unixFile-1.2 {Tcl_FindExecutable} {unixOnly} { set env(PATH) "/dummy" |
︙ | ︙ |