2
0

test_helper.tcl 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. # Redis test suite. Copyright (C) 2009 Salvatore Sanfilippo antirez@gmail.com
  2. # This software is released under the BSD License. See the COPYING file for
  3. # more information.
  4. package require Tcl 8.5
  5. set tcl_precision 17
  6. source tests/support/redis.tcl
  7. source tests/support/server.tcl
  8. source tests/support/tmpfile.tcl
  9. source tests/support/test.tcl
  10. source tests/support/util.tcl
  11. set ::all_tests {
  12. unit/printver
  13. unit/dump
  14. unit/auth
  15. unit/protocol
  16. unit/keyspace
  17. unit/scan
  18. unit/type/string
  19. unit/type/incr
  20. unit/type/list
  21. unit/type/list-2
  22. unit/type/list-3
  23. unit/type/set
  24. unit/type/zset
  25. unit/type/hash
  26. unit/type/stream
  27. unit/type/stream-cgroups
  28. unit/sort
  29. unit/expire
  30. unit/other
  31. unit/multi
  32. unit/quit
  33. unit/aofrw
  34. unit/acl
  35. integration/block-repl
  36. integration/replication
  37. integration/replication-2
  38. integration/replication-3
  39. integration/replication-4
  40. integration/replication-psync
  41. integration/aof
  42. integration/rdb
  43. integration/convert-zipmap-hash-on-load
  44. integration/logging
  45. integration/psync2
  46. integration/psync2-reg
  47. integration/psync2-pingoff
  48. unit/pubsub
  49. unit/slowlog
  50. unit/scripting
  51. unit/maxmemory
  52. unit/introspection
  53. unit/introspection-2
  54. unit/limits
  55. unit/obuf-limits
  56. unit/bitops
  57. unit/bitfield
  58. unit/geo
  59. unit/memefficiency
  60. unit/hyperloglog
  61. unit/lazyfree
  62. unit/wait
  63. unit/pendingquerybuf
  64. unit/tls
  65. }
  66. # Index to the next test to run in the ::all_tests list.
  67. set ::next_test 0
  68. set ::host 127.0.0.1
  69. set ::port 21111
  70. set ::traceleaks 0
  71. set ::valgrind 0
  72. set ::tls 0
  73. set ::stack_logging 0
  74. set ::verbose 0
  75. set ::quiet 0
  76. set ::denytags {}
  77. set ::skiptests {}
  78. set ::allowtags {}
  79. set ::only_tests {}
  80. set ::single_tests {}
  81. set ::skip_till ""
  82. set ::external 0; # If "1" this means, we are running against external instance
  83. set ::file ""; # If set, runs only the tests in this comma separated list
  84. set ::curfile ""; # Hold the filename of the current suite
  85. set ::accurate 0; # If true runs fuzz tests with more iterations
  86. set ::force_failure 0
  87. set ::timeout 1200; # 20 minutes without progresses will quit the test.
  88. set ::last_progress [clock seconds]
  89. set ::active_servers {} ; # Pids of active Redis instances.
  90. set ::dont_clean 0
  91. set ::wait_server 0
  92. set ::stop_on_failure 0
  93. set ::loop 0
  94. set ::tlsdir "tests/tls"
  95. # Set to 1 when we are running in client mode. The Redis test uses a
  96. # server-client model to run tests simultaneously. The server instance
  97. # runs the specified number of client instances that will actually run tests.
  98. # The server is responsible of showing the result to the user, and exit with
  99. # the appropriate exit code depending on the test outcome.
  100. set ::client 0
  101. set ::numclients 16
  102. proc execute_tests name {
  103. set path "tests/$name.tcl"
  104. set ::curfile $path
  105. source $path
  106. send_data_packet $::test_server_fd done "$name"
  107. }
  108. # Setup a list to hold a stack of server configs. When calls to start_server
  109. # are nested, use "srv 0 pid" to get the pid of the inner server. To access
  110. # outer servers, use "srv -1 pid" etcetera.
  111. set ::servers {}
  112. proc srv {args} {
  113. set level 0
  114. if {[string is integer [lindex $args 0]]} {
  115. set level [lindex $args 0]
  116. set property [lindex $args 1]
  117. } else {
  118. set property [lindex $args 0]
  119. }
  120. set srv [lindex $::servers end+$level]
  121. dict get $srv $property
  122. }
  123. # Provide easy access to the client for the inner server. It's possible to
  124. # prepend the argument list with a negative level to access clients for
  125. # servers running in outer blocks.
  126. proc r {args} {
  127. set level 0
  128. if {[string is integer [lindex $args 0]]} {
  129. set level [lindex $args 0]
  130. set args [lrange $args 1 end]
  131. }
  132. [srv $level "client"] {*}$args
  133. }
  134. proc reconnect {args} {
  135. set level [lindex $args 0]
  136. if {[string length $level] == 0 || ![string is integer $level]} {
  137. set level 0
  138. }
  139. set srv [lindex $::servers end+$level]
  140. set host [dict get $srv "host"]
  141. set port [dict get $srv "port"]
  142. set config [dict get $srv "config"]
  143. set client [redis $host $port 0 $::tls]
  144. dict set srv "client" $client
  145. # select the right db when we don't have to authenticate
  146. if {![dict exists $config "requirepass"]} {
  147. $client select 9
  148. }
  149. # re-set $srv in the servers list
  150. lset ::servers end+$level $srv
  151. }
  152. proc redis_deferring_client {args} {
  153. set level 0
  154. if {[llength $args] > 0 && [string is integer [lindex $args 0]]} {
  155. set level [lindex $args 0]
  156. set args [lrange $args 1 end]
  157. }
  158. # create client that defers reading reply
  159. set client [redis [srv $level "host"] [srv $level "port"] 1 $::tls]
  160. # select the right db and read the response (OK)
  161. $client select 9
  162. $client read
  163. return $client
  164. }
  165. # Provide easy access to INFO properties. Same semantic as "proc r".
  166. proc s {args} {
  167. set level 0
  168. if {[string is integer [lindex $args 0]]} {
  169. set level [lindex $args 0]
  170. set args [lrange $args 1 end]
  171. }
  172. status [srv $level "client"] [lindex $args 0]
  173. }
  174. proc cleanup {} {
  175. if {$::dont_clean} {
  176. return
  177. }
  178. if {!$::quiet} {puts -nonewline "Cleanup: may take some time... "}
  179. flush stdout
  180. catch {exec rm -rf {*}[glob tests/tmp/redis.conf.*]}
  181. catch {exec rm -rf {*}[glob tests/tmp/server.*]}
  182. if {!$::quiet} {puts "OK"}
  183. }
  184. proc test_server_main {} {
  185. cleanup
  186. set tclsh [info nameofexecutable]
  187. # Open a listening socket, trying different ports in order to find a
  188. # non busy one.
  189. set port [find_available_port 11111]
  190. if {!$::quiet} {
  191. puts "Starting test server at port $port"
  192. }
  193. socket -server accept_test_clients -myaddr 127.0.0.1 $port
  194. # Start the client instances
  195. set ::clients_pids {}
  196. set start_port [expr {$::port+100}]
  197. for {set j 0} {$j < $::numclients} {incr j} {
  198. set start_port [find_available_port $start_port]
  199. set p [exec $tclsh [info script] {*}$::argv \
  200. --client $port --port $start_port &]
  201. lappend ::clients_pids $p
  202. incr start_port 10
  203. }
  204. # Setup global state for the test server
  205. set ::idle_clients {}
  206. set ::active_clients {}
  207. array set ::active_clients_task {}
  208. array set ::clients_start_time {}
  209. set ::clients_time_history {}
  210. set ::failed_tests {}
  211. # Enter the event loop to handle clients I/O
  212. after 100 test_server_cron
  213. vwait forever
  214. }
  215. # This function gets called 10 times per second.
  216. proc test_server_cron {} {
  217. set elapsed [expr {[clock seconds]-$::last_progress}]
  218. if {$elapsed > $::timeout} {
  219. set err "\[[colorstr red TIMEOUT]\]: clients state report follows."
  220. puts $err
  221. lappend ::failed_tests $err
  222. show_clients_state
  223. kill_clients
  224. force_kill_all_servers
  225. the_end
  226. }
  227. after 100 test_server_cron
  228. }
  229. proc accept_test_clients {fd addr port} {
  230. fconfigure $fd -encoding binary
  231. fileevent $fd readable [list read_from_test_client $fd]
  232. }
  233. # This is the readable handler of our test server. Clients send us messages
  234. # in the form of a status code such and additional data. Supported
  235. # status types are:
  236. #
  237. # ready: the client is ready to execute the command. Only sent at client
  238. # startup. The server will queue the client FD in the list of idle
  239. # clients.
  240. # testing: just used to signal that a given test started.
  241. # ok: a test was executed with success.
  242. # err: a test was executed with an error.
  243. # skip: a test was skipped by skipfile or individual test options.
  244. # ignore: a test was skipped by a group tag.
  245. # exception: there was a runtime exception while executing the test.
  246. # done: all the specified test file was processed, this test client is
  247. # ready to accept a new task.
  248. proc read_from_test_client fd {
  249. set bytes [gets $fd]
  250. set payload [read $fd $bytes]
  251. foreach {status data} $payload break
  252. set ::last_progress [clock seconds]
  253. if {$status eq {ready}} {
  254. if {!$::quiet} {
  255. puts "\[$status\]: $data"
  256. }
  257. signal_idle_client $fd
  258. } elseif {$status eq {done}} {
  259. set elapsed [expr {[clock seconds]-$::clients_start_time($fd)}]
  260. set all_tests_count [llength $::all_tests]
  261. set running_tests_count [expr {[llength $::active_clients]-1}]
  262. set completed_tests_count [expr {$::next_test-$running_tests_count}]
  263. puts "\[$completed_tests_count/$all_tests_count [colorstr yellow $status]\]: $data ($elapsed seconds)"
  264. lappend ::clients_time_history $elapsed $data
  265. signal_idle_client $fd
  266. set ::active_clients_task($fd) "(DONE) $data"
  267. } elseif {$status eq {ok}} {
  268. if {!$::quiet} {
  269. puts "\[[colorstr green $status]\]: $data"
  270. }
  271. set ::active_clients_task($fd) "(OK) $data"
  272. } elseif {$status eq {skip}} {
  273. if {!$::quiet} {
  274. puts "\[[colorstr yellow $status]\]: $data"
  275. }
  276. } elseif {$status eq {ignore}} {
  277. if {!$::quiet} {
  278. puts "\[[colorstr cyan $status]\]: $data"
  279. }
  280. } elseif {$status eq {err}} {
  281. set err "\[[colorstr red $status]\]: $data"
  282. puts $err
  283. lappend ::failed_tests $err
  284. set ::active_clients_task($fd) "(ERR) $data"
  285. if {$::stop_on_failure} {
  286. puts -nonewline "(Test stopped, press enter to continue)"
  287. flush stdout
  288. gets stdin
  289. }
  290. } elseif {$status eq {exception}} {
  291. puts "\[[colorstr red $status]\]: $data"
  292. kill_clients
  293. force_kill_all_servers
  294. exit 1
  295. } elseif {$status eq {testing}} {
  296. set ::active_clients_task($fd) "(IN PROGRESS) $data"
  297. } elseif {$status eq {server-spawning}} {
  298. set ::active_clients_task($fd) "(SPAWNING SERVER) $data"
  299. } elseif {$status eq {server-spawned}} {
  300. lappend ::active_servers $data
  301. set ::active_clients_task($fd) "(SPAWNED SERVER) pid:$data"
  302. } elseif {$status eq {server-killing}} {
  303. set ::active_clients_task($fd) "(KILLING SERVER) pid:$data"
  304. } elseif {$status eq {server-killed}} {
  305. set ::active_servers [lsearch -all -inline -not -exact $::active_servers $data]
  306. set ::active_clients_task($fd) "(KILLED SERVER) pid:$data"
  307. } else {
  308. if {!$::quiet} {
  309. puts "\[$status\]: $data"
  310. }
  311. }
  312. }
  313. proc show_clients_state {} {
  314. # The following loop is only useful for debugging tests that may
  315. # enter an infinite loop.
  316. foreach x $::active_clients {
  317. if {[info exist ::active_clients_task($x)]} {
  318. puts "$x => $::active_clients_task($x)"
  319. } else {
  320. puts "$x => ???"
  321. }
  322. }
  323. }
  324. proc kill_clients {} {
  325. foreach p $::clients_pids {
  326. catch {exec kill $p}
  327. }
  328. }
  329. proc force_kill_all_servers {} {
  330. foreach p $::active_servers {
  331. puts "Killing still running Redis server $p"
  332. catch {exec kill -9 $p}
  333. }
  334. }
  335. # A new client is idle. Remove it from the list of active clients and
  336. # if there are still test units to run, launch them.
  337. proc signal_idle_client fd {
  338. # Remove this fd from the list of active clients.
  339. set ::active_clients \
  340. [lsearch -all -inline -not -exact $::active_clients $fd]
  341. # New unit to process?
  342. if {$::next_test != [llength $::all_tests]} {
  343. if {!$::quiet} {
  344. puts [colorstr bold-white "Testing [lindex $::all_tests $::next_test]"]
  345. set ::active_clients_task($fd) "ASSIGNED: $fd ([lindex $::all_tests $::next_test])"
  346. }
  347. set ::clients_start_time($fd) [clock seconds]
  348. send_data_packet $fd run [lindex $::all_tests $::next_test]
  349. lappend ::active_clients $fd
  350. incr ::next_test
  351. if {$::loop && $::next_test == [llength $::all_tests]} {
  352. set ::next_test 0
  353. }
  354. } else {
  355. lappend ::idle_clients $fd
  356. set ::active_clients_task($fd) "SLEEPING, no more units to assign"
  357. if {[llength $::active_clients] == 0} {
  358. the_end
  359. }
  360. }
  361. }
  362. # The the_end function gets called when all the test units were already
  363. # executed, so the test finished.
  364. proc the_end {} {
  365. # TODO: print the status, exit with the rigth exit code.
  366. puts "\n The End\n"
  367. puts "Execution time of different units:"
  368. foreach {time name} $::clients_time_history {
  369. puts " $time seconds - $name"
  370. }
  371. if {[llength $::failed_tests]} {
  372. puts "\n[colorstr bold-red {!!! WARNING}] The following tests failed:\n"
  373. foreach failed $::failed_tests {
  374. puts "*** $failed"
  375. }
  376. cleanup
  377. exit 1
  378. } else {
  379. puts "\n[colorstr bold-white {\o/}] [colorstr bold-green {All tests passed without errors!}]\n"
  380. cleanup
  381. exit 0
  382. }
  383. }
  384. # The client is not even driven (the test server is instead) as we just need
  385. # to read the command, execute, reply... all this in a loop.
  386. proc test_client_main server_port {
  387. set ::test_server_fd [socket localhost $server_port]
  388. fconfigure $::test_server_fd -encoding binary
  389. send_data_packet $::test_server_fd ready [pid]
  390. while 1 {
  391. set bytes [gets $::test_server_fd]
  392. set payload [read $::test_server_fd $bytes]
  393. foreach {cmd data} $payload break
  394. if {$cmd eq {run}} {
  395. execute_tests $data
  396. } else {
  397. error "Unknown test client command: $cmd"
  398. }
  399. }
  400. }
  401. proc send_data_packet {fd status data} {
  402. set payload [list $status $data]
  403. puts $fd [string length $payload]
  404. puts -nonewline $fd $payload
  405. flush $fd
  406. }
  407. proc print_help_screen {} {
  408. puts [join {
  409. "--valgrind Run the test over valgrind."
  410. "--stack-logging Enable OSX leaks/malloc stack logging."
  411. "--accurate Run slow randomized tests for more iterations."
  412. "--quiet Don't show individual tests."
  413. "--single <unit> Just execute the specified unit (see next option). this option can be repeated."
  414. "--list-tests List all the available test units."
  415. "--only <test> Just execute the specified test by test name. this option can be repeated."
  416. "--skip-till <unit> Skip all units until (and including) the specified one."
  417. "--clients <num> Number of test clients (default 16)."
  418. "--timeout <sec> Test timeout in seconds (default 10 min)."
  419. "--force-failure Force the execution of a test that always fails."
  420. "--config <k> <v> Extra config file argument."
  421. "--skipfile <file> Name of a file containing test names that should be skipped (one per line)."
  422. "--dont-clean Don't delete redis log files after the run."
  423. "--stop Blocks once the first test fails."
  424. "--loop Execute the specified set of tests forever."
  425. "--wait-server Wait after server is started (so that you can attach a debugger)."
  426. "--tls Run tests in TLS mode."
  427. "--help Print this help screen."
  428. } "\n"]
  429. }
  430. # parse arguments
  431. for {set j 0} {$j < [llength $argv]} {incr j} {
  432. set opt [lindex $argv $j]
  433. set arg [lindex $argv [expr $j+1]]
  434. if {$opt eq {--tags}} {
  435. foreach tag $arg {
  436. if {[string index $tag 0] eq "-"} {
  437. lappend ::denytags [string range $tag 1 end]
  438. } else {
  439. lappend ::allowtags $tag
  440. }
  441. }
  442. incr j
  443. } elseif {$opt eq {--config}} {
  444. set arg2 [lindex $argv [expr $j+2]]
  445. lappend ::global_overrides $arg
  446. lappend ::global_overrides $arg2
  447. incr j 2
  448. } elseif {$opt eq {--skipfile}} {
  449. incr j
  450. set fp [open $arg r]
  451. set file_data [read $fp]
  452. close $fp
  453. set ::skiptests [split $file_data "\n"]
  454. } elseif {$opt eq {--valgrind}} {
  455. set ::valgrind 1
  456. } elseif {$opt eq {--stack-logging}} {
  457. if {[string match {*Darwin*} [exec uname -a]]} {
  458. set ::stack_logging 1
  459. }
  460. } elseif {$opt eq {--quiet}} {
  461. set ::quiet 1
  462. } elseif {$opt eq {--tls}} {
  463. package require tls 1.6
  464. set ::tls 1
  465. ::tls::init \
  466. -cafile "$::tlsdir/ca.crt" \
  467. -certfile "$::tlsdir/redis.crt" \
  468. -keyfile "$::tlsdir/redis.key"
  469. } elseif {$opt eq {--host}} {
  470. set ::external 1
  471. set ::host $arg
  472. # If we use an external server, we can only set numclients to 1,
  473. # otherwise the port will be miscalculated.
  474. set ::numclients 1
  475. incr j
  476. } elseif {$opt eq {--port}} {
  477. set ::port $arg
  478. incr j
  479. } elseif {$opt eq {--accurate}} {
  480. set ::accurate 1
  481. } elseif {$opt eq {--force-failure}} {
  482. set ::force_failure 1
  483. } elseif {$opt eq {--single}} {
  484. lappend ::single_tests $arg
  485. incr j
  486. } elseif {$opt eq {--only}} {
  487. lappend ::only_tests $arg
  488. incr j
  489. } elseif {$opt eq {--skip-till}} {
  490. set ::skip_till $arg
  491. incr j
  492. } elseif {$opt eq {--list-tests}} {
  493. foreach t $::all_tests {
  494. puts $t
  495. }
  496. exit 0
  497. } elseif {$opt eq {--verbose}} {
  498. set ::verbose 1
  499. } elseif {$opt eq {--client}} {
  500. set ::client 1
  501. set ::test_server_port $arg
  502. incr j
  503. } elseif {$opt eq {--clients}} {
  504. set ::numclients $arg
  505. incr j
  506. } elseif {$opt eq {--dont-clean}} {
  507. set ::dont_clean 1
  508. } elseif {$opt eq {--wait-server}} {
  509. set ::wait_server 1
  510. } elseif {$opt eq {--stop}} {
  511. set ::stop_on_failure 1
  512. } elseif {$opt eq {--loop}} {
  513. set ::loop 1
  514. } elseif {$opt eq {--timeout}} {
  515. set ::timeout $arg
  516. incr j
  517. } elseif {$opt eq {--help}} {
  518. print_help_screen
  519. exit 0
  520. } else {
  521. puts "Wrong argument: $opt"
  522. exit 1
  523. }
  524. }
  525. # If --skil-till option was given, we populate the list of single tests
  526. # to run with everything *after* the specified unit.
  527. if {$::skip_till != ""} {
  528. set skipping 1
  529. foreach t $::all_tests {
  530. if {$skipping == 0} {
  531. lappend ::single_tests $t
  532. }
  533. if {$t == $::skip_till} {
  534. set skipping 0
  535. }
  536. }
  537. if {$skipping} {
  538. puts "test $::skip_till not found"
  539. exit 0
  540. }
  541. }
  542. # Override the list of tests with the specific tests we want to run
  543. # in case there was some filter, that is --single or --skip-till options.
  544. if {[llength $::single_tests] > 0} {
  545. set ::all_tests $::single_tests
  546. }
  547. proc attach_to_replication_stream {} {
  548. if {$::tls} {
  549. set s [::tls::socket [srv 0 "host"] [srv 0 "port"]]
  550. } else {
  551. set s [socket [srv 0 "host"] [srv 0 "port"]]
  552. }
  553. fconfigure $s -translation binary
  554. puts -nonewline $s "SYNC\r\n"
  555. flush $s
  556. # Get the count
  557. while 1 {
  558. set count [gets $s]
  559. set prefix [string range $count 0 0]
  560. if {$prefix ne {}} break; # Newlines are allowed as PINGs.
  561. }
  562. if {$prefix ne {$}} {
  563. error "attach_to_replication_stream error. Received '$count' as count."
  564. }
  565. set count [string range $count 1 end]
  566. # Consume the bulk payload
  567. while {$count} {
  568. set buf [read $s $count]
  569. set count [expr {$count-[string length $buf]}]
  570. }
  571. return $s
  572. }
  573. proc read_from_replication_stream {s} {
  574. fconfigure $s -blocking 0
  575. set attempt 0
  576. while {[gets $s count] == -1} {
  577. if {[incr attempt] == 10} return ""
  578. after 100
  579. }
  580. fconfigure $s -blocking 1
  581. set count [string range $count 1 end]
  582. # Return a list of arguments for the command.
  583. set res {}
  584. for {set j 0} {$j < $count} {incr j} {
  585. read $s 1
  586. set arg [::redis::redis_bulk_read $s]
  587. if {$j == 0} {set arg [string tolower $arg]}
  588. lappend res $arg
  589. }
  590. return $res
  591. }
  592. proc assert_replication_stream {s patterns} {
  593. for {set j 0} {$j < [llength $patterns]} {incr j} {
  594. assert_match [lindex $patterns $j] [read_from_replication_stream $s]
  595. }
  596. }
  597. proc close_replication_stream {s} {
  598. close $s
  599. }
  600. # With the parallel test running multiple Redis instances at the same time
  601. # we need a fast enough computer, otherwise a lot of tests may generate
  602. # false positives.
  603. # If the computer is too slow we revert the sequential test without any
  604. # parallelism, that is, clients == 1.
  605. proc is_a_slow_computer {} {
  606. set start [clock milliseconds]
  607. for {set j 0} {$j < 1000000} {incr j} {}
  608. set elapsed [expr [clock milliseconds]-$start]
  609. expr {$elapsed > 200}
  610. }
  611. if {$::client} {
  612. if {[catch { test_client_main $::test_server_port } err]} {
  613. set estr "Executing test client: $err.\n$::errorInfo"
  614. if {[catch {send_data_packet $::test_server_fd exception $estr}]} {
  615. puts $estr
  616. }
  617. exit 1
  618. }
  619. } else {
  620. if {[is_a_slow_computer]} {
  621. puts "** SLOW COMPUTER ** Using a single client to avoid false positives."
  622. set ::numclients 1
  623. }
  624. if {[catch { test_server_main } err]} {
  625. if {[string length $err] > 0} {
  626. # only display error when not generated by the test suite
  627. if {$err ne "exception"} {
  628. puts $::errorInfo
  629. }
  630. exit 1
  631. }
  632. }
  633. }