Posted to tcl by miguel at Mon Aug 04 17:28:30 GMT 2008view raw

  1. #!./tclsh
  2.  
  3. set sep ยบ
  4.  
  5. if {[llength $argv]} {
  6. set files $argv
  7. } else {
  8. set files [lsort [glob ../tests/*.test]]
  9. }
  10. #puts [llength $argv]$files; return
  11. set f stdout
  12.  
  13. set script {
  14. catch {source $file}
  15. proc exit args {}
  16. }
  17.  
  18. set exclude {clock.test}
  19. set i 0
  20. foreach file $files {
  21. set dont 0
  22. if {[info exists exclude] \
  23. && [string length $exclude] \
  24. && [string match [file tail $file] $exclude]} {
  25. continue
  26. }
  27.  
  28. set res {}
  29. puts stderr "starting $file"
  30. catch {
  31. exec /usr/bin/valgrind --leak-check=yes --num-callers=10 \
  32. --show-reachable=yes ./tcltest << [subst $script]
  33. } msg
  34.  
  35. regexp {definitely lost: *[1-9][^\n]*} $msg res
  36. set res $msg
  37. if {$res ne {}} {
  38. #puts $f "$file: $res"
  39. puts $f "$sep $file\n$msg\n"
  40. flush $f
  41. }
  42. #if {[incr i] >2} break
  43. }
  44.  
  45. proc exit args {}