test: test.do vsim support
Assertion failures are caught by test.do and returns an EXIT_FAILURE (1).
This commit is contained in:
parent
4ca4f0b306
commit
4c2281c91f
1 changed files with 30 additions and 4 deletions
|
|
@ -1,8 +1,6 @@
|
|||
set status 0
|
||||
onerror {set status 1}
|
||||
set do_file $1
|
||||
set params ""
|
||||
|
||||
set params ""
|
||||
for {set i 2} {$i <= 9} {incr i} {
|
||||
if {[info exists $i]} {
|
||||
append params [eval set $i]
|
||||
|
|
@ -10,6 +8,34 @@ for {set i 2} {$i <= 9} {incr i} {
|
|||
}
|
||||
}
|
||||
|
||||
do $do_file {*}$params
|
||||
if { $1 == "vsim" } {
|
||||
set testbench [lindex $params 0]
|
||||
set tb_args [lrange $params 1 end-1]
|
||||
set time_us [lindex $params end]
|
||||
set assertion_log log.txt
|
||||
|
||||
vsim $testbench -assertfile $assertion_log {*}$tb_args; run ${time_us}us;
|
||||
|
||||
set f [open $assertion_log]
|
||||
set file_content [read $f]
|
||||
close $f
|
||||
|
||||
if {[catch {exec grep -c Failure << $file_content} result]} {
|
||||
set fail_count 0
|
||||
} else {
|
||||
set fail_count $result
|
||||
}
|
||||
echo "fail_count:" $fail_count
|
||||
if { $fail_count > 0 } {
|
||||
set status 1
|
||||
echo "\nSee log.txt for failure\n"
|
||||
} else {
|
||||
exec rm $assertion_log
|
||||
}
|
||||
} else {
|
||||
onerror {set status 1}
|
||||
set do_file $1
|
||||
do $do_file {*}$params
|
||||
}
|
||||
|
||||
quit -code $status
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue