Fossil SCM

For a knownBug, print test file and line number

danshearer 2026-11-11 11:23 UTC test-suite-new
Commit 82a55f2dd1a91bd7e92b2cbabd313c84af754e54dc6ce484f2a8ab825cb12152
1 file changed +21 -3
+21 -3
--- test/tester.tcl
+++ test/tester.tcl
@@ -789,28 +789,46 @@
789789
foreach line [split $value \n] {
790790
lappend lines " |$line|"
791791
}
792792
return $lines
793793
}
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
+}
794811
795812
# Count test NAME as passed if OK is true, and as failed otherwise.
796813
# 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.
798816
#
799817
proc test_report {name ok constraints detail} {
800818
global bad_test ignored_test test_count
801819
incr test_count
802820
set knownBug [expr {"knownBug" in $constraints}]
803821
if {$ok} {
804822
if {$knownBug && !$::STRICT} {
805
- protOut "test $name OK (knownBug)?"
823
+ protOut "test $name OK (knownBug)? [test_location]"
806824
} else {
807825
protOut "test $name OK"
808826
}
809827
} else {
810828
if {$knownBug && !$::STRICT} {
811
- protOut "test $name FAILED (knownBug)!" 1
829
+ protOut "test $name FAILED (knownBug)! [test_location]" 1
812830
lappend ignored_test $name
813831
} else {
814832
protOut "test $name FAILED!" 1
815833
foreach line $detail {
816834
protOut " $line" 1
817835
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button