debuggers: import openocd-0.7.0
Initial check-in of openocd-0.7.0 as it can be downloaded from http://sourceforge.net/projects/openocd/files/openocd/0.7.0/ Any modifications will follow. Change-Id: I6949beaefd589e046395ea0cb80f4e1ab1654d55
This commit is contained in:
55
debuggers/openocd/jimtcl/tests/error.test
Normal file
55
debuggers/openocd/jimtcl/tests/error.test
Normal file
@ -0,0 +1,55 @@
|
||||
source [file dirname [info script]]/testing.tcl
|
||||
needs constraint jim; needs cmd package
|
||||
proc a {} {
|
||||
error "error thrown from a"
|
||||
}
|
||||
|
||||
proc b {} {
|
||||
set rc [catch {a} msg]
|
||||
if {$rc} {
|
||||
error $msg [info stacktrace]
|
||||
}
|
||||
}
|
||||
|
||||
test error-1.1 "Rethrow caught error" {
|
||||
set rc [catch {b} msg]
|
||||
#puts stderr "error-1.1\n[errorInfo $msg]\n"
|
||||
|
||||
list $rc $msg [info stacktrace]
|
||||
} {1 {error thrown from a} {{} error.test 4 a error.test 8 b error.test 15}}
|
||||
|
||||
proc c {} {
|
||||
a
|
||||
}
|
||||
|
||||
proc d {} {
|
||||
c
|
||||
}
|
||||
|
||||
proc e {} {
|
||||
d
|
||||
}
|
||||
|
||||
test error-1.2 "Modify stacktrace" {
|
||||
set rc [catch {e} msg]
|
||||
set st [info stacktrace]
|
||||
# Now elide one entry from the stacktrace
|
||||
#puts [errorInfo $msg]
|
||||
set newst {}
|
||||
foreach {p f l} $st {
|
||||
if {$p ne "d"} {
|
||||
lappend newst $p $f $l
|
||||
}
|
||||
}
|
||||
# Now rethrow with the new stack
|
||||
set rc [catch {error $msg $newst} msg]
|
||||
#puts [errorInfo $msg]
|
||||
info stacktrace
|
||||
} {{} error.test 4 a error.test 22 c error.test 26 e error.test 34}
|
||||
|
||||
# Package should be able to invoke exit, which should exit if not caught
|
||||
test error-2.1 "Exit from package" {
|
||||
list [catch -exit {package require exitpackage} msg] $msg
|
||||
} {6 {Can't load package exitpackage}}
|
||||
|
||||
testreport
|
||||
Reference in New Issue
Block a user