Artifact
62417e5acf7a1111396cdceb54fae5653d403dcc:
Attachment "singletests.tcl" to
ticket [fdcc860df5]
added by
pointsman
2014-11-13 23:20:47.
(unpublished)
0000: 0a 73 6f 75 72 63 65 20 5b 66 69 6c 65 20 6a 6f .source [file jo
0010: 69 6e 20 5b 66 69 6c 65 20 64 69 72 6e 61 6d 65 in [file dirname
0020: 20 5b 69 6e 66 6f 20 73 63 72 69 70 74 5d 5d 20 [info script]]
0030: 75 74 69 6c 73 2e 74 63 6c 5d 0a 0a 73 65 74 20 utils.tcl]..set
0040: 6f 70 74 69 6f 6e 73 28 2d 74 65 73 74 61 70 70 options(-testapp
0050: 29 20 74 63 6c 74 65 73 74 0a 73 65 74 20 6f 70 ) tcltest.set op
0060: 74 69 6f 6e 73 28 2d 66 69 6c 65 29 20 2a 2e 74 tions(-file) *.t
0070: 65 73 74 0a 73 65 74 20 6f 70 74 69 6f 6e 73 28 est.set options(
0080: 2d 6e 6f 74 66 69 6c 65 29 20 22 22 0a 73 65 74 -notfile) "".set
0090: 20 6f 70 74 69 6f 6e 73 28 2d 74 63 6c 74 65 73 options(-tcltes
00a0: 74 64 69 72 29 20 22 2e 2e 2f 74 65 73 74 73 22 tdir) "../tests"
00b0: 0a 73 65 74 20 6f 70 74 69 6f 6e 73 28 2d 74 65 .set options(-te
00c0: 73 74 6d 61 69 6e 29 20 22 61 6c 6c 2e 74 63 6c stmain) "all.tcl
00d0: 22 0a 73 65 74 20 6f 70 74 69 6f 6e 73 28 2d 6f ".set options(-o
00e0: 75 74 66 69 6c 65 29 20 22 73 69 6e 67 6c 65 74 utfile) "singlet
00f0: 65 73 74 73 5f 6f 75 74 5f 5b 63 6c 6f 63 6b 20 ests_out_[clock
0100: 66 6f 72 6d 61 74 20 5b 63 6c 6f 63 6b 20 73 65 format [clock se
0110: 63 6f 6e 64 73 5d 20 5c 0a 20 20 20 20 20 20 20 conds] \.
0120: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0130: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0140: 20 2d 66 6f 72 6d 61 74 20 22 25 59 2d 25 6d 2d -format "%Y-%m-
0150: 25 64 54 25 54 22 5d 2e 74 78 74 22 0a 73 65 74 %dT%T"].txt".set
0160: 20 6f 70 74 69 6f 6e 73 28 2d 6f 76 65 72 77 72 options(-overwr
0170: 69 74 65 6f 75 74 66 69 6c 65 29 20 30 0a 23 20 iteoutfile) 0.#
0180: 41 73 20 6f 66 20 74 63 6c 38 2e 36 2e 33 20 74 As of tcl8.6.3 t
0190: 68 65 20 74 77 6f 20 74 65 73 74 73 20 69 6f 2d he two tests io-
01a0: 31 34 2e 39 20 61 6e 64 20 69 6f 63 6d 64 2e 74 14.9 and iocmd.t
01b0: 66 2d 32 34 2e 31 37 2e 62 75 67 33 35 32 32 35 f-24.17.bug35225
01c0: 36 30 0a 23 20 68 61 76 65 20 61 6e 20 5b 61 66 60.# have an [af
01d0: 74 65 72 20 31 30 30 30 30 5d 20 77 69 74 68 69 ter 10000] withi
01e0: 6e 20 74 68 65 20 74 65 73 74 20 63 6f 64 65 20 n the test code
01f0: 61 6e 64 20 74 68 65 20 74 65 73 74 20 72 65 67 and the test reg
0200: 65 78 70 2d 32 32 2e 35 0a 23 20 69 6e 20 66 61 exp-22.5.# in fa
0210: 63 74 20 72 75 6e 73 20 73 6f 6d 65 20 73 65 63 ct runs some sec
0220: 6f 6e 64 73 20 69 74 20 69 73 20 61 64 76 69 63 onds it is advic
0230: 65 64 20 74 6f 20 6e 6f 74 20 6c 6f 77 65 72 20 ed to not lower
0240: 2d 74 69 6d 65 6f 75 74 20 62 65 6c 6f 77 0a 23 -timeout below.#
0250: 20 31 35 30 30 30 0a 73 65 74 20 6f 70 74 69 6f 15000.set optio
0260: 6e 73 28 2d 74 69 6d 65 6f 75 74 29 20 31 35 30 ns(-timeout) 150
0270: 30 30 0a 73 65 74 20 6f 70 74 69 6f 6e 73 28 2d 00.set options(-
0280: 70 72 6f 67 72 65 73 73 29 20 35 30 0a 0a 70 72 progress) 50..pr
0290: 6f 63 20 67 65 74 54 65 73 74 4e 61 6d 65 73 20 oc getTestNames
02a0: 7b 66 69 6c 65 7d 20 7b 0a 20 20 20 20 67 6c 6f {file} {. glo
02b0: 62 61 6c 20 6f 70 74 69 6f 6e 73 0a 20 20 20 20 bal options.
02c0: 67 6c 6f 62 61 6c 20 67 65 74 74 65 73 74 6e 61 global gettestna
02d0: 6d 65 73 43 6d 64 0a 0a 20 20 20 20 73 65 74 20 mesCmd.. set
02e0: 6e 61 6d 65 73 43 6d 64 20 22 24 67 65 74 74 65 namesCmd "$gette
02f0: 73 74 6e 61 6d 65 73 43 6d 64 20 24 6f 70 74 69 stnamesCmd $opti
0300: 6f 6e 73 28 2d 74 63 6c 74 65 73 74 64 69 72 29 ons(-tcltestdir)
0310: 20 24 66 69 6c 65 22 0a 20 20 20 20 73 65 74 20 $file". set
0320: 72 61 77 74 65 73 74 6e 61 6d 65 73 6c 69 73 74 rawtestnameslist
0330: 20 5b 65 76 61 6c 20 65 78 65 63 20 24 6e 61 6d [eval exec $nam
0340: 65 73 43 6d 64 5d 0a 20 20 20 20 73 65 74 20 74 esCmd]. set t
0350: 65 73 74 6e 61 6d 65 73 6c 69 73 74 20 5b 6c 69 estnameslist [li
0360: 6e 64 65 78 20 5b 73 70 6c 69 74 20 24 72 61 77 ndex [split $raw
0370: 74 65 73 74 6e 61 6d 65 73 6c 69 73 74 20 5c 6e testnameslist \n
0380: 5d 20 65 6e 64 5d 0a 20 20 20 20 66 6f 72 65 61 ] end]. forea
0390: 63 68 20 74 65 73 74 20 24 74 65 73 74 6e 61 6d ch test $testnam
03a0: 65 73 6c 69 73 74 20 7b 0a 20 20 20 20 20 20 20 eslist {.
03b0: 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 if {[info exist
03c0: 73 20 74 6d 70 28 24 74 65 73 74 29 5d 7d 20 7b s tmp($test)]} {
03d0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 70 75 74 . put
03e0: 73 20 22 46 69 6c 65 20 27 24 66 69 6c 65 27 3a s "File '$file':
03f0: 20 6e 6f 74 20 75 6e 69 71 75 65 20 74 65 73 74 not unique test
0400: 20 6e 61 6d 65 20 27 24 74 65 73 74 27 22 0a 20 name '$test'".
0410: 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 }.
0420: 20 69 6e 63 72 20 74 6d 70 28 24 74 65 73 74 29 incr tmp($test)
0430: 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 . }. retur
0440: 6e 20 24 74 65 73 74 6e 61 6d 65 73 6c 69 73 74 n $testnameslist
0450: 0a 7d 0a 0a 23 20 46 72 6f 6d 3a 20 68 74 74 70 .}..# From: http
0460: 3a 2f 2f 77 69 6b 69 2e 74 63 6c 2e 74 6b 2f 38 ://wiki.tcl.tk/8
0470: 38 30 0a 70 72 6f 63 20 69 73 52 65 61 64 61 62 80.proc isReadab
0480: 6c 65 20 7b 20 66 20 7d 20 7b 0a 20 20 20 20 67 le { f } {. g
0490: 6c 6f 62 61 6c 20 74 63 6c 74 65 73 74 4f 75 74 lobal tcltestOut
04a0: 70 75 74 0a 0a 20 20 20 20 23 20 54 68 65 20 63 put.. # The c
04b0: 68 61 6e 6e 65 6c 20 69 73 20 72 65 61 64 61 62 hannel is readab
04c0: 6c 65 3b 20 74 72 79 20 74 6f 20 72 65 61 64 20 le; try to read
04d0: 69 74 2e 0a 20 20 20 20 73 65 74 20 73 74 61 74 it.. set stat
04e0: 75 73 20 5b 63 61 74 63 68 20 7b 20 67 65 74 73 us [catch { gets
04f0: 20 24 66 20 6c 69 6e 65 20 7d 20 72 65 73 75 6c $f line } resul
0500: 74 5d 0a 20 20 20 20 69 66 20 7b 20 24 73 74 61 t]. if { $sta
0510: 74 75 73 20 21 3d 20 30 20 7d 20 7b 0a 20 20 20 tus != 0 } {.
0520: 20 20 20 20 20 23 20 45 72 72 6f 72 20 6f 6e 20 # Error on
0530: 74 68 65 20 63 68 61 6e 6e 65 6c 0a 20 20 20 20 the channel.
0540: 20 20 20 20 73 65 74 20 3a 3a 44 4f 4e 45 20 32 set ::DONE 2
0550: 0a 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 20 . } elseif {
0560: 24 72 65 73 75 6c 74 20 3e 3d 20 30 20 7d 20 7b $result >= 0 } {
0570: 0a 20 20 20 20 20 20 20 20 23 20 53 75 63 63 65 . # Succe
0580: 73 73 66 75 6c 6c 79 20 72 65 61 64 20 74 68 65 ssfully read the
0590: 20 63 68 61 6e 6e 65 6c 0a 20 20 20 20 20 20 20 channel.
05a0: 20 61 70 70 65 6e 64 20 74 63 6c 74 65 73 74 4f append tcltestO
05b0: 75 74 70 75 74 20 24 6c 69 6e 65 5c 6e 0a 20 20 utput $line\n.
05c0: 20 20 7d 20 65 6c 73 65 69 66 20 7b 20 5b 65 6f } elseif { [eo
05d0: 66 20 24 66 5d 20 7d 20 7b 0a 20 20 20 20 20 20 f $f] } {.
05e0: 20 20 23 20 45 6e 64 20 6f 66 20 66 69 6c 65 20 # End of file
05f0: 6f 6e 20 74 68 65 20 63 68 61 6e 6e 65 6c 0a 20 on the channel.
0600: 20 20 20 20 20 20 20 73 65 74 20 3a 3a 44 4f 4e set ::DON
0610: 45 20 31 0a 20 20 20 20 7d 20 65 6c 73 65 69 66 E 1. } elseif
0620: 20 7b 20 5b 66 62 6c 6f 63 6b 65 64 20 24 66 5d { [fblocked $f]
0630: 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 23 20 52 } {. # R
0640: 65 61 64 20 62 6c 6f 63 6b 65 64 2e 20 20 4a 75 ead blocked. Ju
0650: 73 74 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 20 st return. }
0660: 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 23 else {. #
0670: 20 53 6f 6d 65 74 68 69 6e 67 20 65 6c 73 65 0a Something else.
0680: 20 20 20 20 20 20 20 20 73 65 74 20 3a 3a 44 4f set ::DO
0690: 4e 45 20 33 0a 20 20 20 20 7d 0a 7d 0a 0a 70 72 NE 3. }.}..pr
06a0: 6f 63 20 74 65 73 74 54 69 6d 65 6f 75 74 20 7b oc testTimeout {
06b0: 7d 20 7b 0a 20 20 20 20 67 6c 6f 62 61 6c 20 72 } {. global r
06c0: 75 6e 6e 69 6e 67 54 65 73 74 0a 20 20 20 20 67 unningTest. g
06d0: 6c 6f 62 61 6c 20 74 65 73 74 66 69 6c 65 0a 20 lobal testfile.
06e0: 20 20 20 67 6c 6f 62 61 6c 20 74 65 73 74 0a 20 global test.
06f0: 20 20 20 67 6c 6f 62 61 6c 20 73 75 6d 6d 61 72 global summar
0700: 79 66 64 0a 20 20 20 20 67 6c 6f 62 61 6c 20 6f yfd. global o
0710: 70 74 69 6f 6e 73 0a 0a 20 20 20 20 70 75 74 73 ptions.. puts
0720: 20 24 73 75 6d 6d 61 72 79 66 64 20 22 66 69 6c $summaryfd "fil
0730: 65 20 24 74 65 73 74 66 69 6c 65 20 74 65 73 74 e $testfile test
0740: 20 24 74 65 73 74 3a 20 4e 6f 74 20 66 69 6e 69 $test: Not fini
0750: 73 68 65 64 20 61 66 74 65 72 5c 0a 20 20 20 20 shed after\.
0760: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0770: 20 24 6f 70 74 69 6f 6e 73 28 2d 74 69 6d 65 6f $options(-timeo
0780: 75 74 29 20 6d 69 6c 6c 69 73 65 63 6f 6e 64 73 ut) milliseconds
0790: 2e 20 43 61 6e 63 65 6c 69 6e 67 20 74 68 65 5c . Canceling the\
07a0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
07b0: 20 20 20 20 20 20 74 65 73 74 2e 22 0a 20 20 20 test.".
07c0: 20 73 65 74 20 3a 3a 44 4f 4e 45 20 34 0a 7d 0a set ::DONE 4.}.
07d0: 0a 70 72 6f 63 20 74 65 73 74 4f 6e 65 46 69 6c .proc testOneFil
07e0: 65 20 7b 66 69 6c 65 7d 20 7b 0a 20 20 20 20 67 e {file} {. g
07f0: 6c 6f 62 61 6c 20 6f 70 74 69 6f 6e 73 0a 20 20 lobal options.
0800: 20 20 67 6c 6f 62 61 6c 20 67 65 74 74 65 73 74 global gettest
0810: 6e 61 6d 65 73 43 6d 64 0a 20 20 20 20 67 6c 6f namesCmd. glo
0820: 62 61 6c 20 74 65 73 74 72 75 6e 0a 20 20 20 20 bal testrun.
0830: 67 6c 6f 62 61 6c 20 74 69 6d 65 6f 75 74 49 44 global timeoutID
0840: 0a 20 20 20 20 67 6c 6f 62 61 6c 20 74 65 73 74 . global test
0850: 66 69 6c 65 0a 20 20 20 20 67 6c 6f 62 61 6c 20 file. global
0860: 74 65 73 74 0a 20 20 20 20 67 6c 6f 62 61 6c 20 test. global
0870: 73 75 6d 6d 61 72 79 66 64 0a 20 20 20 20 67 6c summaryfd. gl
0880: 6f 62 61 6c 20 74 63 6c 74 65 73 74 4f 75 74 70 obal tcltestOutp
0890: 75 74 0a 0a 20 20 20 20 73 65 74 20 74 65 73 74 ut.. set test
08a0: 66 69 6c 65 20 24 66 69 6c 65 0a 20 20 20 20 70 file $file. p
08b0: 75 74 73 20 24 66 69 6c 65 0a 20 20 20 20 73 65 uts $file. se
08c0: 74 20 74 65 73 74 63 6f 75 6e 74 65 72 20 30 0a t testcounter 0.
08d0: 20 20 20 20 70 75 74 73 20 2d 6e 6f 6e 65 77 6c puts -nonewl
08e0: 69 6e 65 20 22 23 22 0a 20 20 20 20 66 6f 72 65 ine "#". fore
08f0: 61 63 68 20 74 65 73 74 20 5b 67 65 74 54 65 73 ach test [getTes
0900: 74 4e 61 6d 65 73 20 24 66 69 6c 65 5d 20 7b 0a tNames $file] {.
0910: 20 20 20 20 20 20 20 20 69 6e 63 72 20 74 65 73 incr tes
0920: 74 63 6f 75 6e 74 65 72 0a 20 20 20 20 20 20 20 tcounter.
0930: 20 23 20 53 68 6f 77 2c 20 79 6f 75 27 72 65 20 # Show, you're
0940: 61 6c 69 76 65 2e 20 52 65 70 6f 72 74 20 70 72 alive. Report pr
0950: 6f 67 72 65 73 73 2e 0a 20 20 20 20 20 20 20 20 ogress..
0960: 69 66 20 7b 24 74 65 73 74 63 6f 75 6e 74 65 72 if {$testcounter
0970: 20 3e 3d 20 24 6f 70 74 69 6f 6e 73 28 2d 70 72 >= $options(-pr
0980: 6f 67 72 65 73 73 29 7d 20 7b 0a 20 20 20 20 20 ogress)} {.
0990: 20 20 20 20 20 20 20 70 75 74 73 20 2d 6e 6f 6e puts -non
09a0: 65 77 6c 69 6e 65 20 22 23 22 0a 20 20 20 20 20 ewline "#".
09b0: 20 20 20 20 20 20 20 66 6c 75 73 68 20 73 74 64 flush std
09c0: 6f 75 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 out.
09d0: 73 65 74 20 74 65 73 74 63 6f 75 6e 74 65 72 20 set testcounter
09e0: 30 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 0. }.
09f0: 20 20 20 20 73 65 74 20 74 65 73 74 20 24 74 65 set test $te
0a00: 73 74 0a 20 20 20 20 20 20 20 20 73 65 74 20 3a st. set :
0a10: 3a 44 4f 4e 45 20 30 0a 20 20 20 20 20 20 20 20 :DONE 0.
0a20: 73 65 74 20 74 63 6c 74 65 73 74 4f 75 74 70 75 set tcltestOutpu
0a30: 74 20 22 22 0a 20 20 20 20 20 20 20 20 73 65 74 t "". set
0a40: 20 63 6d 64 20 22 24 6f 70 74 69 6f 6e 73 28 2d cmd "$options(-
0a50: 74 65 73 74 61 70 70 29 20 22 0a 20 20 20 20 20 testapp) ".
0a60: 20 20 20 61 70 70 65 6e 64 20 63 6d 64 20 22 20 append cmd "
0a70: 24 6f 70 74 69 6f 6e 73 28 2d 74 63 6c 74 65 73 $options(-tcltes
0a80: 74 64 69 72 29 2f 24 6f 70 74 69 6f 6e 73 28 2d tdir)/$options(-
0a90: 74 65 73 74 6d 61 69 6e 29 20 22 0a 20 20 20 20 testmain) ".
0aa0: 20 20 20 20 61 70 70 65 6e 64 20 63 6d 64 20 22 append cmd "
0ab0: 20 2d 66 69 6c 65 20 24 66 69 6c 65 20 2d 6d 61 -file $file -ma
0ac0: 74 63 68 20 24 74 65 73 74 20 22 0a 20 20 20 20 tch $test ".
0ad0: 20 20 20 20 61 70 70 65 6e 64 20 63 6d 64 20 22 append cmd "
0ae0: 20 2d 76 65 72 62 6f 73 65 20 7b 7d 20 22 0a 20 -verbose {} ".
0af0: 20 20 20 20 20 20 20 61 70 70 65 6e 64 20 63 6d append cm
0b00: 64 20 22 20 2d 73 69 6e 67 6c 65 70 72 6f 63 20 d " -singleproc
0b10: 31 20 22 0a 20 20 20 20 20 20 20 20 73 65 74 20 1 ". set
0b20: 72 75 6e 6e 69 6e 67 54 65 73 74 20 5b 6f 70 65 runningTest [ope
0b30: 6e 20 22 7c 20 24 63 6d 64 22 5d 0a 20 20 20 20 n "| $cmd"].
0b40: 20 20 20 20 66 63 6f 6e 66 69 67 75 72 65 20 24 fconfigure $
0b50: 72 75 6e 6e 69 6e 67 54 65 73 74 20 2d 62 6c 6f runningTest -blo
0b60: 63 6b 69 6e 67 20 66 61 6c 73 65 0a 20 20 20 20 cking false.
0b70: 20 20 20 20 66 69 6c 65 65 76 65 6e 74 20 24 72 fileevent $r
0b80: 75 6e 6e 69 6e 67 54 65 73 74 20 72 65 61 64 61 unningTest reada
0b90: 62 6c 65 20 5b 6c 69 73 74 20 69 73 52 65 61 64 ble [list isRead
0ba0: 61 62 6c 65 20 24 72 75 6e 6e 69 6e 67 54 65 73 able $runningTes
0bb0: 74 5d 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 t]. set t
0bc0: 69 6d 65 6f 75 74 49 44 20 5b 61 66 74 65 72 20 imeoutID [after
0bd0: 24 6f 70 74 69 6f 6e 73 28 2d 74 69 6d 65 6f 75 $options(-timeou
0be0: 74 29 20 74 65 73 74 54 69 6d 65 6f 75 74 5d 0a t) testTimeout].
0bf0: 20 20 20 20 20 20 20 20 76 77 61 69 74 20 3a 3a vwait ::
0c00: 44 4f 4e 45 0a 20 20 20 20 20 20 20 20 61 66 74 DONE. aft
0c10: 65 72 20 63 61 6e 63 65 6c 20 24 74 69 6d 65 6f er cancel $timeo
0c20: 75 74 49 44 0a 20 20 20 20 20 20 20 20 73 65 74 utID. set
0c30: 20 6c 6f 67 6d 73 67 20 22 5c 6e 5c 6e 2a 2a 2a logmsg "\n\n***
0c40: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 5c 6e 66 *************\nf
0c50: 69 6c 65 20 24 74 65 73 74 66 69 6c 65 20 74 65 ile $testfile te
0c60: 73 74 20 24 74 65 73 74 3a 20 22 0a 20 20 20 20 st $test: ".
0c70: 20 20 20 20 73 77 69 74 63 68 20 24 3a 3a 44 4f switch $::DO
0c80: 4e 45 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 NE {.
0c90: 20 31 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 1 {.
0ca0: 20 20 20 20 20 66 6f 72 65 61 63 68 20 6c 69 6e foreach lin
0cb0: 65 20 5b 73 70 6c 69 74 20 24 74 63 6c 74 65 73 e [split $tcltes
0cc0: 74 4f 75 74 70 75 74 20 22 5c 6e 22 5d 20 7b 0a tOutput "\n"] {.
0cd0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0ce0: 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 if {[string
0cf0: 66 69 72 73 74 20 24 6f 70 74 69 6f 6e 73 28 2d first $options(-
0d00: 74 65 73 74 6d 61 69 6e 29 20 24 6c 69 6e 65 5d testmain) $line]
0d10: 20 3d 3d 20 30 7d 20 7b 0a 20 20 20 20 20 20 20 == 0} {.
0d20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0d30: 20 23 20 54 68 69 73 20 73 65 74 73 20 74 68 65 # This sets the
0d40: 20 76 61 72 69 61 62 6c 65 73 20 54 6f 74 61 6c variables Total
0d50: 2c 20 50 61 73 73 65 64 2c 0a 20 20 20 20 20 20 , Passed,.
0d60: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0d70: 20 20 23 20 53 6b 69 70 70 65 64 20 61 6e 64 20 # Skipped and
0d80: 46 61 69 6c 65 64 2c 20 61 73 20 6f 66 20 74 63 Failed, as of tc
0d90: 6c 74 65 73 74 20 32 2e 33 2e 35 2e 0a 20 20 20 ltest 2.3.5..
0da0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0db0: 20 20 20 20 20 66 6f 72 65 61 63 68 20 7b 77 68 foreach {wh
0dc0: 61 74 20 6e 72 4f 66 7d 20 5b 6c 72 61 6e 67 65 at nrOf} [lrange
0dd0: 20 24 6c 69 6e 65 20 31 20 65 6e 64 5d 20 7b 0a $line 1 end] {.
0de0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0df0: 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20 set
0e00: 24 77 68 61 74 20 24 6e 72 4f 66 0a 20 20 20 20 $what $nrOf.
0e10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0e20: 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20 }.
0e30: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 if
0e40: 20 7b 24 46 61 69 6c 65 64 20 21 3d 20 30 7d 20 {$Failed != 0}
0e50: 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 {.
0e60: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 70 ap
0e70: 70 65 6e 64 20 6c 6f 67 6d 73 67 20 22 54 65 73 pend logmsg "Tes
0e80: 74 20 66 61 69 6c 65 64 2e 5c 6e 24 74 63 6c 74 t failed.\n$tclt
0e90: 65 73 74 4f 75 74 70 75 74 22 0a 20 20 20 20 20 estOutput".
0ea0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0eb0: 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 } else {.
0ec0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0ed0: 20 20 20 20 20 20 20 20 73 65 74 20 6c 6f 67 6d set logm
0ee0: 73 67 20 22 22 0a 20 20 20 20 20 20 20 20 20 20 sg "".
0ef0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0a }.
0f00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0f10: 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20 }.
0f20: 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 }.
0f30: 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20 }.
0f40: 20 20 32 20 7b 0a 20 20 20 20 20 20 20 20 20 20 2 {.
0f50: 20 20 20 20 20 20 61 70 70 65 6e 64 20 6c 6f 67 append log
0f60: 6d 73 67 20 22 45 72 72 6f 72 2e 5c 6e 24 74 63 msg "Error.\n$tc
0f70: 6c 74 65 73 74 4f 75 74 70 75 74 22 0a 20 20 20 ltestOutput".
0f80: 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 }.
0f90: 20 20 20 20 20 20 20 33 20 7b 0a 20 20 20 20 20 3 {.
0fa0: 20 20 20 20 20 20 20 20 20 20 20 61 70 70 65 6e appen
0fb0: 64 20 6c 6f 67 6d 73 67 20 22 49 72 72 65 67 75 d logmsg "Irregu
0fc0: 6c 61 72 20 72 65 61 64 20 66 72 6f 6d 20 73 75 lar read from su
0fd0: 62 70 72 6f 63 65 73 73 5c 6e 24 74 63 6c 74 65 bprocess\n$tclte
0fe0: 73 74 4f 75 74 70 75 74 22 0a 20 20 20 20 20 20 stOutput".
0ff0: 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 }.
1000: 20 20 20 20 34 20 7b 0a 20 20 20 20 20 20 20 20 4 {.
1010: 20 20 20 20 20 20 20 20 23 20 54 65 73 74 20 63 # Test c
1020: 61 6e 63 6c 65 64 20 61 66 74 65 72 20 74 69 6d ancled after tim
1030: 65 6f 75 74 2e 20 41 6c 72 65 61 64 79 20 72 65 eout. Already re
1040: 70 6f 72 74 65 64 2c 0a 20 20 20 20 20 20 20 20 ported,.
1050: 20 20 20 20 20 20 20 20 23 20 64 6f 6e 27 74 20 # don't
1060: 6d 65 73 73 20 75 70 20 6c 6f 67 2e 0a 20 20 20 mess up log..
1070: 20 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 set
1080: 20 6c 6f 67 6d 73 67 20 22 22 0a 20 20 20 20 20 logmsg "".
1090: 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 }.
10a0: 20 20 20 20 20 64 65 66 61 75 6c 74 20 7b 0a 20 default {.
10b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 #
10c0: 20 63 61 6e 27 74 20 68 61 70 70 65 6e 0a 20 20 can't happen.
10d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 70 ap
10e0: 70 65 6e 64 20 6c 6f 67 6d 73 67 20 22 52 65 61 pend logmsg "Rea
10f0: 63 68 65 64 20 27 63 61 6e 27 74 20 68 61 70 70 ched 'can't happ
1100: 65 6e 27 20 63 61 73 65 20 69 6e 20 74 65 73 74 en' case in test
1110: 4f 6e 65 46 69 6c 65 2e 22 0a 20 20 20 20 20 20 OneFile.".
1120: 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 }.
1130: 7d 0a 20 20 20 20 20 20 20 20 70 75 74 73 20 2d }. puts -
1140: 6e 6f 6e 65 77 6c 69 6e 65 20 24 73 75 6d 6d 61 nonewline $summa
1150: 72 79 66 64 20 24 6c 6f 67 6d 73 67 0a 20 20 20 ryfd $logmsg.
1160: 20 20 20 20 20 63 6c 6f 73 65 20 24 72 75 6e 6e close $runn
1170: 69 6e 67 54 65 73 74 0a 20 20 20 20 7d 0a 20 20 ingTest. }.
1180: 20 20 70 75 74 73 20 22 22 0a 7d 0a 0a 70 72 6f puts "".}..pro
1190: 63 20 69 6e 69 74 20 7b 7d 20 7b 0a 20 20 20 20 c init {} {.
11a0: 67 6c 6f 62 61 6c 20 6f 70 74 69 6f 6e 73 0a 20 global options.
11b0: 20 20 20 67 6c 6f 62 61 6c 20 67 65 74 74 65 73 global gettes
11c0: 74 6e 61 6d 65 73 43 6d 64 0a 20 20 20 20 67 6c tnamesCmd. gl
11d0: 6f 62 61 6c 20 73 75 6d 6d 61 72 79 66 64 0a 0a obal summaryfd..
11e0: 20 20 20 20 72 65 61 64 41 72 67 73 0a 20 20 20 readArgs.
11f0: 20 69 66 20 7b 21 5b 66 69 6c 65 20 65 78 69 73 if {![file exis
1200: 74 73 20 24 6f 70 74 69 6f 6e 73 28 2d 74 65 73 ts $options(-tes
1210: 74 61 70 70 29 5d 7d 20 7b 0a 20 20 20 20 20 20 tapp)]} {.
1220: 20 20 70 75 74 73 20 73 74 64 65 72 72 20 22 4e puts stderr "N
1230: 6f 20 24 3a 3a 6f 70 74 69 6f 6e 73 28 2d 74 65 o $::options(-te
1240: 73 74 61 70 70 29 20 61 70 70 20 69 6e 20 74 68 stapp) app in th
1250: 65 20 72 75 6e 20 64 69 72 2e 20 41 62 6f 72 74 e run dir. Abort
1260: 69 6e 67 2e 22 0a 20 20 20 20 20 20 20 20 65 78 ing.". ex
1270: 69 74 20 31 0a 20 20 20 20 7d 0a 20 20 20 20 69 it 1. }. i
1280: 66 20 7b 21 5b 73 74 72 69 6e 67 20 69 73 20 62 f {![string is b
1290: 6f 6f 6c 65 61 6e 20 2d 73 74 72 69 63 74 20 24 oolean -strict $
12a0: 6f 70 74 69 6f 6e 73 28 2d 6f 76 65 72 77 72 69 options(-overwri
12b0: 74 65 6f 75 74 66 69 6c 65 29 5d 7d 20 7b 0a 20 teoutfile)]} {.
12c0: 20 20 20 20 20 20 20 70 75 74 73 20 73 74 64 65 puts stde
12d0: 72 72 20 22 54 68 65 20 6f 70 74 69 6f 6e 20 2d rr "The option -
12e0: 6f 76 65 72 77 72 69 74 65 6f 75 74 66 69 6c 65 overwriteoutfile
12f0: 20 65 78 70 65 63 74 73 20 61 20 62 6f 6f 6c 65 expects a boole
1300: 61 6e 20 76 61 6c 75 65 2e 5c 0a 20 20 20 20 20 an value.\.
1310: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1320: 41 62 6f 72 74 69 6e 67 2e 22 0a 20 20 20 20 20 Aborting.".
1330: 20 20 20 65 78 69 74 20 31 0a 20 20 20 20 7d 0a exit 1. }.
1340: 20 20 20 20 69 66 20 7b 21 5b 73 74 72 69 6e 67 if {![string
1350: 20 69 73 20 69 6e 74 65 67 65 72 20 2d 73 74 72 is integer -str
1360: 69 63 74 20 24 6f 70 74 69 6f 6e 73 28 2d 74 69 ict $options(-ti
1370: 6d 65 6f 75 74 29 5d 0a 20 20 20 20 20 20 20 20 meout)].
1380: 7c 7c 20 24 6f 70 74 69 6f 6e 73 28 2d 74 69 6d || $options(-tim
1390: 65 6f 75 74 29 20 3c 3d 20 30 7d 20 7b 0a 20 20 eout) <= 0} {.
13a0: 20 20 20 20 20 20 70 75 74 73 20 73 74 72 69 6e puts strin
13b0: 67 20 22 54 68 65 20 6f 70 74 69 6f 6e 20 2d 74 g "The option -t
13c0: 69 6d 65 6f 75 74 20 65 78 70 65 63 74 73 20 61 imeout expects a
13d0: 20 70 6f 73 69 74 69 76 65 20 69 6e 74 65 67 65 positive intege
13e0: 72 20 61 73 20 76 61 6c 75 65 2e 5c 0a 20 20 20 r as value.\.
13f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1400: 20 20 41 62 6f 72 74 69 6e 67 2e 22 0a 20 20 20 Aborting.".
1410: 20 20 20 20 20 65 78 69 74 20 31 0a 20 20 20 20 exit 1.
1420: 7d 0a 20 20 20 20 69 66 20 7b 21 5b 73 74 72 69 }. if {![stri
1430: 6e 67 20 69 73 20 69 6e 74 65 67 65 72 20 2d 73 ng is integer -s
1440: 74 72 69 63 74 20 24 6f 70 74 69 6f 6e 73 28 2d trict $options(-
1450: 70 72 6f 67 72 65 73 73 29 5d 7d 20 7b 0a 20 20 progress)]} {.
1460: 20 20 20 20 20 20 70 75 74 73 20 73 74 72 69 6e puts strin
1470: 67 20 22 54 68 65 20 6f 70 74 69 6f 6e 73 20 2d g "The options -
1480: 70 72 6f 67 72 65 73 73 20 65 78 70 65 63 74 73 progress expects
1490: 20 61 20 70 6f 73 69 74 69 76 65 20 69 6e 74 65 a positive inte
14a0: 67 65 72 20 61 73 5c 0a 20 20 20 20 20 20 20 20 ger as\.
14b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 76 61 6c val
14c0: 75 65 2e 20 41 62 6f 72 74 69 6e 67 2e 22 0a 20 ue. Aborting.".
14d0: 20 20 20 20 20 20 20 65 78 69 74 20 31 0a 20 20 exit 1.
14e0: 20 20 7d 0a 20 20 20 20 73 65 74 20 6f 70 74 69 }. set opti
14f0: 6f 6e 73 28 2d 74 65 73 74 61 70 70 29 20 5b 66 ons(-testapp) [f
1500: 69 6c 65 20 6a 6f 69 6e 20 5b 70 77 64 5d 20 24 ile join [pwd] $
1510: 6f 70 74 69 6f 6e 73 28 2d 74 65 73 74 61 70 70 options(-testapp
1520: 29 5d 0a 0a 20 20 20 20 73 65 74 20 67 65 74 74 )].. set gett
1530: 65 73 74 6e 61 6d 65 73 43 6d 64 20 22 24 3a 3a estnamesCmd "$::
1540: 6f 70 74 69 6f 6e 73 28 2d 74 65 73 74 61 70 70 options(-testapp
1550: 29 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 ) \.
1560: 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 [file
1570: 6a 6f 69 6e 20 5b 66 69 6c 65 20 64 69 72 6e 61 join [file dirna
1580: 6d 65 20 5b 69 6e 66 6f 20 73 63 72 69 70 74 5d me [info script]
1590: 5d 20 74 65 73 74 2d 6e 61 6d 65 73 2e 74 63 6c ] test-names.tcl
15a0: 5d 22 0a 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 ]". if {[file
15b0: 20 65 78 69 73 74 73 20 24 6f 70 74 69 6f 6e 73 exists $options
15c0: 28 2d 6f 75 74 66 69 6c 65 29 5d 20 26 26 20 21 (-outfile)] && !
15d0: 24 6f 70 74 69 6f 6e 73 28 2d 6f 76 65 72 77 72 $options(-overwr
15e0: 69 74 65 6f 75 74 66 69 6c 65 29 7d 20 7b 0a 20 iteoutfile)} {.
15f0: 20 20 20 20 20 20 20 70 75 74 73 20 73 74 64 65 puts stde
1600: 72 72 20 22 4f 75 74 20 66 69 6c 65 20 27 24 6f rr "Out file '$o
1610: 70 74 69 6f 6e 73 28 2d 6f 75 74 66 69 6c 65 29 ptions(-outfile)
1620: 27 20 61 6c 72 65 61 64 79 20 65 78 69 73 74 73 ' already exists
1630: 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 \.
1640: 20 20 20 20 20 20 20 61 6e 64 20 2d 6f 76 65 72 and -over
1650: 77 72 69 74 65 6f 75 74 66 69 6c 65 20 6e 6f 74 writeoutfile not
1660: 20 74 72 75 65 2e 20 41 62 6f 72 74 69 6e 67 2e true. Aborting.
1670: 22 0a 20 20 20 20 20 20 20 20 65 78 69 74 20 31 ". exit 1
1680: 0a 20 20 20 20 7d 0a 20 20 20 20 73 65 74 20 73 . }. set s
1690: 75 6d 6d 61 72 79 66 64 20 5b 6f 70 65 6e 20 24 ummaryfd [open $
16a0: 6f 70 74 69 6f 6e 73 28 2d 6f 75 74 66 69 6c 65 options(-outfile
16b0: 29 20 77 2b 5d 0a 20 20 20 20 66 63 6f 6e 66 69 ) w+]. fconfi
16c0: 67 75 72 65 20 24 73 75 6d 6d 61 72 79 66 64 20 gure $summaryfd
16d0: 2d 62 75 66 66 65 72 69 6e 67 20 6c 69 6e 65 0a -buffering line.
16e0: 20 20 20 20 70 75 74 73 20 24 73 75 6d 6d 61 72 puts $summar
16f0: 79 66 64 20 22 53 74 61 72 74 65 64 5c 0a 20 20 yfd "Started\.
1700: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1710: 20 20 20 5b 63 6c 6f 63 6b 20 66 6f 72 6d 61 74 [clock format
1720: 20 5b 63 6c 6f 63 6b 20 73 65 63 6f 6e 64 73 5d [clock seconds]
1730: 20 2d 66 6f 72 6d 61 74 20 22 25 59 2d 25 6d 2d -format "%Y-%m-
1740: 25 64 54 25 54 22 5d 22 0a 20 20 20 20 70 75 74 %dT%T"]". put
1750: 73 20 24 73 75 6d 6d 61 72 79 66 64 20 22 54 65 s $summaryfd "Te
1760: 73 74 20 66 69 6c 65 20 70 61 74 74 65 72 6e 3a st file pattern:
1770: 20 24 6f 70 74 69 6f 6e 73 28 2d 66 69 6c 65 29 $options(-file)
1780: 5c 6e 22 0a 7d 0a 0a 70 72 6f 63 20 72 75 6e 45 \n".}..proc runE
1790: 76 65 72 79 54 65 73 74 41 6c 6f 6e 65 20 7b 7d veryTestAlone {}
17a0: 20 7b 0a 20 20 20 20 69 6e 69 74 0a 20 20 20 20 {. init.
17b0: 66 6f 72 65 61 63 68 20 74 65 73 74 66 69 6c 65 foreach testfile
17c0: 20 5b 67 65 74 54 65 73 74 46 69 6c 65 73 5d 20 [getTestFiles]
17d0: 7b 0a 20 20 20 20 20 20 20 20 74 65 73 74 4f 6e {. testOn
17e0: 65 46 69 6c 65 20 24 74 65 73 74 66 69 6c 65 0a eFile $testfile.
17f0: 20 20 20 20 7d 0a 7d 0a 0a 72 75 6e 45 76 65 72 }.}..runEver
1800: 79 54 65 73 74 41 6c 6f 6e 65 0a yTestAlone.