# Small utility to read tcltest, and report only the differences # of the first failure. This utility has no exception-handling, # does not clean up after itself, ... set tmp /tmp/diff[pid] set report [read stdin] regexp -- \ {---- Result was:(.*?)---- Result should have been:(.*)====} \ $report -> first second foreach part {first second} { # If my Unix bias were any greater, I'd one-line # "exec cat >$tmp$part <<[set $part]". set fp [open $tmp$part w] puts -nonewline $fp [set $part] close $fp } catch {exec diff ${tmp}first ${tmp}second]} result puts "Result is: $result"Is there an easier way?
From your question, it seems you must be a user of tcltest version 1.x.You seem to be the perfect user for the improved result-matching flexibility found in tcltest version 2.x. Tcl 8.4.0 comes with tcltest 2.2.I advise you upgrade.By the way, although tcltest 2.2 comes bundled with Tcl 8.4, it does not require Tcl 8.4. You can install it and use it with any Tcl of version 8.3 or later.
VI 2003/10/02 : I typically use something simple as a return code. In our large complex verification environments, we use the number 1 as the real return code. So each test starts off as:
tcltest::test pci-2.1 {Test PCI burst writes of 4K} { -result 1 -body { ;# All kinds of good stuff here if {$read_data != $write_data} { ;# or whatever you do any number of times error "Data mismatch, wrote $write_data, read $read_data" } ;# More good stuff here return 1 } }We've used this with both 1.x and 2.x. Though 2.x can do a lot more.