File tree Expand file tree Collapse file tree 4 files changed +39
-29
lines changed
Expand file tree Collapse file tree 4 files changed +39
-29
lines changed Original file line number Diff line number Diff line change 11source " helpers.tcl"
22
3- set test_dir [pwd ]
4- set openroad_dir [file dirname [file dirname [file dirname $test_dir ]]]
5- set test_path [file join $openroad_dir " build" " src" " drt" " trTest" ]
6-
7- set test_status [catch { exec sh -c " BASE_DIR=$test_dir $test_path " } output option]
8-
9- puts $test_status
10- puts $output
11- if { $test_status != 0 } {
12- set test_err_info [lassign [dict get $option -errorcode] err_type]
13- switch -exact -- $err_type {
14- NONE {
15- # passed
16- }
17- CHILDSTATUS {
18- # non-zero exit status
19- set exit_status [lindex $test_err_info 1]
20- puts " ERROR: test returned exit code $exit_status "
21- exit 1
22-
23- }
24- default {
25- puts " ERROR: $option "
26- exit 1
27- }
28- }
29- }
30- puts " pass"
31- exit 0
3+ run_unit_test_and_exit [list " build" " src" " drt" " trTest" ]
Original file line number Diff line number Diff line change 1+ source " helpers.tcl"
2+
3+ run_unit_test_and_exit [list " build" " src" " rcx" " src" " rcxUnitTest" ]
Original file line number Diff line number Diff line change @@ -6,3 +6,6 @@ record_tests {
66 45_gcd
77 names
88}
9+ record_pass_fail_tests {
10+ rcx_unit_test
11+ }
Original file line number Diff line number Diff line change @@ -54,6 +54,38 @@ proc diff_files { file1 file2 } {
5454 }
5555}
5656
57+ proc run_unit_test_and_exit { relative_path } {
58+ set test_dir [pwd ]
59+ set openroad_dir [file dirname [file dirname [file dirname $test_dir ]]]
60+ set test_path [file join $openroad_dir {*}$relative_path ]
61+
62+ set test_status [catch { exec sh -c " BASE_DIR=$test_dir $test_path " } output option]
63+
64+ puts $test_status
65+ puts $output
66+ if { $test_status != 0 } {
67+ set test_err_info [lassign [dict get $option -errorcode] err_type]
68+ switch -exact -- $err_type {
69+ NONE {
70+ # passed
71+ }
72+ CHILDSTATUS {
73+ # non-zero exit status
74+ set exit_status [lindex $test_err_info 1]
75+ puts " ERROR: test returned exit code $exit_status "
76+ exit 1
77+
78+ }
79+ default {
80+ puts " ERROR: $option "
81+ exit 1
82+ }
83+ }
84+ }
85+ puts " pass"
86+ exit 0
87+ }
88+
5789# Output voltage file is specified as ...
5890suppress_message PSM 2
5991# Output current file specified ...
You can’t perform that action at this time.
0 commit comments