Fossil SCM
Print time elapsed in the test script.
Commit
d0bbd8d6f77e1d565985331f467ed49ec4245534bb7e3c28415f086bab8a24b3
Parent
17767590da8a7d7…
1 file changed
+18
-1
+18
-1
| --- test/tester.tcl | ||
| +++ test/tester.tcl | ||
| @@ -28,10 +28,11 @@ | ||
| 28 | 28 | |
| 29 | 29 | # Minimum Tcl is 8.6. auto.def should have found us a suitable Tcl |
| 30 | 30 | # installation. Care is needed to keep compatible with both 8.6 and 9.0. |
| 31 | 31 | package require Tcl 8.6- |
| 32 | 32 | |
| 33 | +set clock_start [clock milliseconds] | |
| 33 | 34 | set testfiledir [file normalize [file dirname [info script]]] |
| 34 | 35 | set testrundir [pwd] |
| 35 | 36 | set testdir [file normalize [file dirname $argv0]] |
| 36 | 37 | set fossilexe [file normalize [lindex $argv 0]] |
| 37 | 38 | set is_windows [expr {$::tcl_platform(platform) eq "windows"}] |
| @@ -92,10 +93,24 @@ | ||
| 92 | 93 | fconfigure $out -translation platform |
| 93 | 94 | puts $out $msg |
| 94 | 95 | close $out |
| 95 | 96 | } |
| 96 | 97 | } |
| 98 | + | |
| 99 | +# print elapsed time | |
| 100 | +proc printElapsedTime {{prependMsg "Time elapsed: "}} { | |
| 101 | + global clock_start | |
| 102 | + set clock_end [clock milliseconds] | |
| 103 | + set millis [expr {$clock_end - $clock_start}] | |
| 104 | + set h [expr {$millis / 3600000}] | |
| 105 | + set m [expr {($millis - (3600000 * $h)) / 60000}] | |
| 106 | + set s [expr {($millis - (3600000 * $h) - (60000 * $m)) / 1000.0}] | |
| 107 | + puts -nonewline $prependMsg | |
| 108 | + if {$h>0} {puts -nonewline $h "hours"} | |
| 109 | + if {$m>0} {puts -nonewline "$m mins"} | |
| 110 | + puts [format "%.3f secs" $s] | |
| 111 | +} | |
| 97 | 112 | |
| 98 | 113 | # write a dict with just enough formatting |
| 99 | 114 | # to make it human readable |
| 100 | 115 | # |
| 101 | 116 | proc protOutDict {dict {pattern *}} { |
| @@ -722,11 +737,11 @@ | ||
| 722 | 737 | protOut "test $name FAILED!" 1 |
| 723 | 738 | foreach line $detail { |
| 724 | 739 | protOut " $line" 1 |
| 725 | 740 | } |
| 726 | 741 | lappend bad_test $name |
| 727 | - if {$::HALT} {exit 1} | |
| 742 | + if {$::HALT} {printElapsedTime; exit 1} | |
| 728 | 743 | } |
| 729 | 744 | } |
| 730 | 745 | } |
| 731 | 746 | |
| 732 | 747 | # Perform a test: test NAME passes if the expression EXPR, evaluated in |
| @@ -1094,7 +1109,9 @@ | ||
| 1094 | 1109 | foreach s $skipped_tests { |
| 1095 | 1110 | protOut "***** [lindex $s 0]: [lindex $s 1]" 1 |
| 1096 | 1111 | } |
| 1097 | 1112 | } |
| 1098 | 1113 | if {[llength $bad_test]>0} { |
| 1114 | + printElapsedTime | |
| 1099 | 1115 | exit 1 |
| 1100 | 1116 | } |
| 1117 | +printElapsedTime | |
| 1101 | 1118 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -28,10 +28,11 @@ | |
| 28 | |
| 29 | # Minimum Tcl is 8.6. auto.def should have found us a suitable Tcl |
| 30 | # installation. Care is needed to keep compatible with both 8.6 and 9.0. |
| 31 | package require Tcl 8.6- |
| 32 | |
| 33 | set testfiledir [file normalize [file dirname [info script]]] |
| 34 | set testrundir [pwd] |
| 35 | set testdir [file normalize [file dirname $argv0]] |
| 36 | set fossilexe [file normalize [lindex $argv 0]] |
| 37 | set is_windows [expr {$::tcl_platform(platform) eq "windows"}] |
| @@ -92,10 +93,24 @@ | |
| 92 | fconfigure $out -translation platform |
| 93 | puts $out $msg |
| 94 | close $out |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | # write a dict with just enough formatting |
| 99 | # to make it human readable |
| 100 | # |
| 101 | proc protOutDict {dict {pattern *}} { |
| @@ -722,11 +737,11 @@ | |
| 722 | protOut "test $name FAILED!" 1 |
| 723 | foreach line $detail { |
| 724 | protOut " $line" 1 |
| 725 | } |
| 726 | lappend bad_test $name |
| 727 | if {$::HALT} {exit 1} |
| 728 | } |
| 729 | } |
| 730 | } |
| 731 | |
| 732 | # Perform a test: test NAME passes if the expression EXPR, evaluated in |
| @@ -1094,7 +1109,9 @@ | |
| 1094 | foreach s $skipped_tests { |
| 1095 | protOut "***** [lindex $s 0]: [lindex $s 1]" 1 |
| 1096 | } |
| 1097 | } |
| 1098 | if {[llength $bad_test]>0} { |
| 1099 | exit 1 |
| 1100 | } |
| 1101 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -28,10 +28,11 @@ | |
| 28 | |
| 29 | # Minimum Tcl is 8.6. auto.def should have found us a suitable Tcl |
| 30 | # installation. Care is needed to keep compatible with both 8.6 and 9.0. |
| 31 | package require Tcl 8.6- |
| 32 | |
| 33 | set clock_start [clock milliseconds] |
| 34 | set testfiledir [file normalize [file dirname [info script]]] |
| 35 | set testrundir [pwd] |
| 36 | set testdir [file normalize [file dirname $argv0]] |
| 37 | set fossilexe [file normalize [lindex $argv 0]] |
| 38 | set is_windows [expr {$::tcl_platform(platform) eq "windows"}] |
| @@ -92,10 +93,24 @@ | |
| 93 | fconfigure $out -translation platform |
| 94 | puts $out $msg |
| 95 | close $out |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | # print elapsed time |
| 100 | proc printElapsedTime {{prependMsg "Time elapsed: "}} { |
| 101 | global clock_start |
| 102 | set clock_end [clock milliseconds] |
| 103 | set millis [expr {$clock_end - $clock_start}] |
| 104 | set h [expr {$millis / 3600000}] |
| 105 | set m [expr {($millis - (3600000 * $h)) / 60000}] |
| 106 | set s [expr {($millis - (3600000 * $h) - (60000 * $m)) / 1000.0}] |
| 107 | puts -nonewline $prependMsg |
| 108 | if {$h>0} {puts -nonewline $h "hours"} |
| 109 | if {$m>0} {puts -nonewline "$m mins"} |
| 110 | puts [format "%.3f secs" $s] |
| 111 | } |
| 112 | |
| 113 | # write a dict with just enough formatting |
| 114 | # to make it human readable |
| 115 | # |
| 116 | proc protOutDict {dict {pattern *}} { |
| @@ -722,11 +737,11 @@ | |
| 737 | protOut "test $name FAILED!" 1 |
| 738 | foreach line $detail { |
| 739 | protOut " $line" 1 |
| 740 | } |
| 741 | lappend bad_test $name |
| 742 | if {$::HALT} {printElapsedTime; exit 1} |
| 743 | } |
| 744 | } |
| 745 | } |
| 746 | |
| 747 | # Perform a test: test NAME passes if the expression EXPR, evaluated in |
| @@ -1094,7 +1109,9 @@ | |
| 1109 | foreach s $skipped_tests { |
| 1110 | protOut "***** [lindex $s 0]: [lindex $s 1]" 1 |
| 1111 | } |
| 1112 | } |
| 1113 | if {[llength $bad_test]>0} { |
| 1114 | printElapsedTime |
| 1115 | exit 1 |
| 1116 | } |
| 1117 | printElapsedTime |
| 1118 |