Fossil SCM
For a knownBug, print test file and line number
Commit
82a55f2dd1a91bd7e92b2cbabd313c84af754e54dc6ce484f2a8ab825cb12152
Parent
c96895f393b6db5…
1 file changed
+21
-3
+21
-3
| --- test/tester.tcl | ||
| +++ test/tester.tcl | ||
| @@ -789,28 +789,46 @@ | ||
| 789 | 789 | foreach line [split $value \n] { |
| 790 | 790 | lappend lines " |$line|" |
| 791 | 791 | } |
| 792 | 792 | return $lines |
| 793 | 793 | } |
| 794 | + | |
| 795 | +# Return FILE:LINE of the statement at the top level of the test file | |
| 796 | +# that led to the current test, outside the procedures that the test | |
| 797 | +# file defines. | |
| 798 | +# | |
| 799 | +proc test_location {} { | |
| 800 | + set where "" | |
| 801 | + for {set i [info frame]} {$i > 0} {incr i -1} { | |
| 802 | + set frame [info frame $i] | |
| 803 | + if {![dict exists $frame file]} continue | |
| 804 | + set file [dict get $frame file] | |
| 805 | + if {![string match *.test $file]} continue | |
| 806 | + set where [file tail $file]:[dict get $frame line] | |
| 807 | + if {![dict exists $frame proc]} break | |
| 808 | + } | |
| 809 | + return $where | |
| 810 | +} | |
| 794 | 811 | |
| 795 | 812 | # Count test NAME as passed if OK is true, and as failed otherwise. |
| 796 | 813 | # For a failure that is not a known bug, write each line of DETAIL |
| 797 | -# after the failure line. | |
| 814 | +# after the failure line. A known bug is reported with the place in | |
| 815 | +# its test file from test_location. | |
| 798 | 816 | # |
| 799 | 817 | proc test_report {name ok constraints detail} { |
| 800 | 818 | global bad_test ignored_test test_count |
| 801 | 819 | incr test_count |
| 802 | 820 | set knownBug [expr {"knownBug" in $constraints}] |
| 803 | 821 | if {$ok} { |
| 804 | 822 | if {$knownBug && !$::STRICT} { |
| 805 | - protOut "test $name OK (knownBug)?" | |
| 823 | + protOut "test $name OK (knownBug)? [test_location]" | |
| 806 | 824 | } else { |
| 807 | 825 | protOut "test $name OK" |
| 808 | 826 | } |
| 809 | 827 | } else { |
| 810 | 828 | if {$knownBug && !$::STRICT} { |
| 811 | - protOut "test $name FAILED (knownBug)!" 1 | |
| 829 | + protOut "test $name FAILED (knownBug)! [test_location]" 1 | |
| 812 | 830 | lappend ignored_test $name |
| 813 | 831 | } else { |
| 814 | 832 | protOut "test $name FAILED!" 1 |
| 815 | 833 | foreach line $detail { |
| 816 | 834 | protOut " $line" 1 |
| 817 | 835 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -789,28 +789,46 @@ | |
| 789 | foreach line [split $value \n] { |
| 790 | lappend lines " |$line|" |
| 791 | } |
| 792 | return $lines |
| 793 | } |
| 794 | |
| 795 | # Count test NAME as passed if OK is true, and as failed otherwise. |
| 796 | # For a failure that is not a known bug, write each line of DETAIL |
| 797 | # after the failure line. |
| 798 | # |
| 799 | proc test_report {name ok constraints detail} { |
| 800 | global bad_test ignored_test test_count |
| 801 | incr test_count |
| 802 | set knownBug [expr {"knownBug" in $constraints}] |
| 803 | if {$ok} { |
| 804 | if {$knownBug && !$::STRICT} { |
| 805 | protOut "test $name OK (knownBug)?" |
| 806 | } else { |
| 807 | protOut "test $name OK" |
| 808 | } |
| 809 | } else { |
| 810 | if {$knownBug && !$::STRICT} { |
| 811 | protOut "test $name FAILED (knownBug)!" 1 |
| 812 | lappend ignored_test $name |
| 813 | } else { |
| 814 | protOut "test $name FAILED!" 1 |
| 815 | foreach line $detail { |
| 816 | protOut " $line" 1 |
| 817 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -789,28 +789,46 @@ | |
| 789 | foreach line [split $value \n] { |
| 790 | lappend lines " |$line|" |
| 791 | } |
| 792 | return $lines |
| 793 | } |
| 794 | |
| 795 | # Return FILE:LINE of the statement at the top level of the test file |
| 796 | # that led to the current test, outside the procedures that the test |
| 797 | # file defines. |
| 798 | # |
| 799 | proc test_location {} { |
| 800 | set where "" |
| 801 | for {set i [info frame]} {$i > 0} {incr i -1} { |
| 802 | set frame [info frame $i] |
| 803 | if {![dict exists $frame file]} continue |
| 804 | set file [dict get $frame file] |
| 805 | if {![string match *.test $file]} continue |
| 806 | set where [file tail $file]:[dict get $frame line] |
| 807 | if {![dict exists $frame proc]} break |
| 808 | } |
| 809 | return $where |
| 810 | } |
| 811 | |
| 812 | # Count test NAME as passed if OK is true, and as failed otherwise. |
| 813 | # For a failure that is not a known bug, write each line of DETAIL |
| 814 | # after the failure line. A known bug is reported with the place in |
| 815 | # its test file from test_location. |
| 816 | # |
| 817 | proc test_report {name ok constraints detail} { |
| 818 | global bad_test ignored_test test_count |
| 819 | incr test_count |
| 820 | set knownBug [expr {"knownBug" in $constraints}] |
| 821 | if {$ok} { |
| 822 | if {$knownBug && !$::STRICT} { |
| 823 | protOut "test $name OK (knownBug)? [test_location]" |
| 824 | } else { |
| 825 | protOut "test $name OK" |
| 826 | } |
| 827 | } else { |
| 828 | if {$knownBug && !$::STRICT} { |
| 829 | protOut "test $name FAILED (knownBug)! [test_location]" 1 |
| 830 | lappend ignored_test $name |
| 831 | } else { |
| 832 | protOut "test $name FAILED!" 1 |
| 833 | foreach line $detail { |
| 834 | protOut " $line" 1 |
| 835 |