regression fast

This commit is contained in:
James Cherry 2019-08-09 18:44:31 -07:00
parent 30a5abebc6
commit 109925644f
15 changed files with 401068 additions and 0 deletions

135
examples/example1.dspef Normal file
View File

@ -0,0 +1,135 @@
*SPEF "IEEE 1481-1998"
*DESIGN "reg1"
*DATE "Fri Nov 20 13:23:00 2002"
*VENDOR "Parallax Software, Inc"
*PROGRAM "Handjob"
*VERSION "1.0.1c"
*DESIGN_FLOW "MISSING_NETS"
*DIVIDER /
*DELIMITER :
*BUS_DELIMITER [ ]
*T_UNIT 1.0 PS
*C_UNIT 1.0 PF
*R_UNIT 1.0 OHM
*L_UNIT 1.0 HENRY
*POWER_NETS VDD
*GROUND_NETS VSS
*PORTS
in1 I
in2 I
clk1 I
clk2 I
clk3 I
out O
*D_NET in1 0.275
*CONN
*P in1 I
*I r1:D I *L .0036
*CAP
1 in1 .243
2 r1:D .032
*RES
3 in1 r1:D 40
*END
*D_NET in2 0.275
*CONN
*P in2 I
*I r2:D I *L .0036
*CAP
1 in2 .243
2 r2:D .032
*RES
3 in2 r2:D 40
*END
*D_NET clk1 0.275
*CONN
*P clk1 I
*I r1:CK I *L .0036
*CAP
1 clk1 .243
2 r1:CK .032
*RES
3 clk1 r1:CK 40
*END
*D_NET clk2 0.275
*CONN
*P clk2 I
*I r2:CK I *L .0036
*CAP
1 clk2 .243
2 r2:CK .032
*RES
3 clk2 r2:CK 40
*END
*D_NET clk3 0.275
*CONN
*P clk3 I
*I r3:CK I *L .0036
*CAP
1 clk3 .243
2 r3:CK .032
*RES
3 clk3 r3:CK 40
*END
*D_NET r1q 0.275
*CONN
*I r1:Q O
*I u2:A1 I *L .0086
*CAP
1 r1:Q .243
2 u2:A1 .032
*RES
3 r1:Q u2:A1 40
*END
*D_NET r2q 0.275
*CONN
*I r2:Q O
*I u1:A I *L .0086
*CAP
1 r2:Q .243
2 u1:A .032
*RES
3 r2:Q u1:A 40
*END
*D_NET u1z 0.275
*CONN
*I u1:Z O
*I u2:A2 I *L .0086
*CAP
1 u1:Z .243
2 u2:A2 .032
*RES
3 u1:Z u2:A2 40
*END
*D_NET u2z 0.275
*CONN
*I u2:ZN O
*I r3:D I *L .0086
*CAP
1 u2:ZN .243
2 r3:D .032
*RES
3 u2:ZN r3:D 40
*END
*D_NET out 0.275
*CONN
*I r3:Q O
*P out O
*CAP
1 r3:Q .243
2 out .032
*RES
3 r3:Q out 40
*END

133288
examples/example1_fast.lib Normal file

File diff suppressed because it is too large Load Diff

133288
examples/example1_slow.lib Normal file

File diff suppressed because it is too large Load Diff

133288
examples/example1_typ.lib Normal file

File diff suppressed because it is too large Load Diff

29
test/example1.ok Normal file
View File

@ -0,0 +1,29 @@
Startpoint: r2 (rising edge-triggered flip-flop clocked by clk)
Endpoint: r3 (rising edge-triggered flip-flop clocked by clk)
Path Group: clk
Path Type: max
Delay Time Description
---------------------------------------------------------
0.00 0.00 clock clk (rise edge)
0.00 0.00 clock network delay (ideal)
0.00 0.00 ^ r2/CK (DFF_X1)
1.10 1.10 v r2/Q (DFF_X1)
1.10 2.20 v u1/Z (BUF_X1)
1.10 3.30 v u2/ZN (AND2_X1)
0.00 3.30 v r3/D (DFF_X1)
3.30 data arrival time
10.00 10.00 clock clk (rise edge)
0.00 10.00 clock network delay (ideal)
0.00 10.00 clock reconvergence pessimism
10.00 ^ r3/CK (DFF_X1)
-0.50 9.50 library setup time
9.50 data required time
---------------------------------------------------------
9.50 data required time
-3.30 data arrival time
---------------------------------------------------------
6.20 slack (MET)

29
test/example2.ok Normal file
View File

@ -0,0 +1,29 @@
Startpoint: r2 (rising edge-triggered flip-flop clocked by clk)
Endpoint: r3 (rising edge-triggered flip-flop clocked by clk)
Path Group: clk
Path Type: max
Delay Time Description
---------------------------------------------------------
0.00 0.00 clock clk (rise edge)
0.00 0.00 clock network delay (ideal)
0.00 0.00 ^ r2/CK (DFF_X1)
0.23 0.23 v r2/Q (DFF_X1)
0.08 0.32 v u1/Z (BUF_X1)
0.10 0.42 v u2/ZN (AND2_X1)
0.00 0.42 v r3/D (DFF_X1)
0.42 data arrival time
10.00 10.00 clock clk (rise edge)
0.00 10.00 clock network delay (ideal)
0.00 10.00 clock reconvergence pessimism
10.00 ^ r3/CK (DFF_X1)
-0.16 9.84 library setup time
9.84 data required time
---------------------------------------------------------
9.84 data required time
-0.42 data arrival time
---------------------------------------------------------
9.43 slack (MET)

56
test/example3.ok Normal file
View File

@ -0,0 +1,56 @@
Startpoint: in1 (input port clocked by clk)
Endpoint: r1 (rising edge-triggered flip-flop clocked by clk)
Path Group: clk
Path Type: min
Delay Time Description
---------------------------------------------------------
0.00 0.00 clock clk (rise edge)
0.00 0.00 clock network delay (ideal)
0.00 0.00 v input external delay
0.00 0.00 v in1 (in)
0.00 0.00 v r1/D (DFF_X1)
0.00 data arrival time
0.00 0.00 clock clk (rise edge)
0.00 0.00 clock network delay (ideal)
0.00 0.00 clock reconvergence pessimism
0.00 ^ r1/CK (DFF_X1)
0.00 0.00 library hold time
0.00 data required time
---------------------------------------------------------
0.00 data required time
-0.00 data arrival time
---------------------------------------------------------
0.00 slack (VIOLATED)
Startpoint: r2 (rising edge-triggered flip-flop clocked by clk)
Endpoint: r3 (rising edge-triggered flip-flop clocked by clk)
Path Group: clk
Path Type: max
Delay Time Description
---------------------------------------------------------
0.00 0.00 clock clk (rise edge)
0.00 0.00 clock network delay (ideal)
0.00 0.00 ^ r2/CK (DFF_X1)
0.23 0.23 v r2/Q (DFF_X1)
0.08 0.32 v u1/Z (BUF_X1)
0.10 0.42 v u2/ZN (AND2_X1)
0.00 0.42 v r3/D (DFF_X1)
0.42 data arrival time
10.00 10.00 clock clk (rise edge)
0.00 10.00 clock network delay (ideal)
0.00 10.00 clock reconvergence pessimism
10.00 ^ r3/CK (DFF_X1)
-0.16 9.84 library setup time
9.84 data required time
---------------------------------------------------------
9.84 data required time
-0.42 data arrival time
---------------------------------------------------------
9.43 slack (MET)

29
test/example4.ok Normal file
View File

@ -0,0 +1,29 @@
Startpoint: r2 (rising edge-triggered flip-flop clocked by clk)
Endpoint: r3 (rising edge-triggered flip-flop clocked by clk)
Path Group: clk
Path Type: max
Delay Time Description
---------------------------------------------------------
0.00 0.00 clock clk (rise edge)
0.00 0.00 clock network delay (ideal)
0.00 0.00 ^ r2/CK (DFF_X1)
2.58 2.58 ^ r2/Q (DFF_X1)
2.59 5.17 ^ u1/Z (BUF_X1)
2.77 7.95 ^ u2/ZN (AND2_X1)
0.00 7.95 ^ r3/D (DFF_X1)
7.95 data arrival time
10.00 10.00 clock clk (rise edge)
0.00 10.00 clock network delay (ideal)
0.00 10.00 clock reconvergence pessimism
10.00 ^ r3/CK (DFF_X1)
-0.61 9.39 library setup time
9.39 data required time
---------------------------------------------------------
9.39 data required time
-7.95 data arrival time
---------------------------------------------------------
1.45 slack (MET)

88
test/example5.ok Normal file
View File

@ -0,0 +1,88 @@
Startpoint: in1 (input port clocked by clk)
Endpoint: r1 (rising edge-triggered flip-flop clocked by clk)
Path Group: clk
Path Type: min
Corner: ss
Delay Time Description
---------------------------------------------------------
0.00 0.00 clock clk (rise edge)
0.00 0.00 clock network delay (ideal)
0.00 0.00 ^ input external delay
0.00 0.00 ^ in1 (in)
0.00 0.00 ^ r1/D (DFF_X1)
0.00 data arrival time
0.00 0.00 clock clk (rise edge)
0.00 0.00 clock network delay (ideal)
0.00 0.00 clock reconvergence pessimism
0.00 ^ r1/CK (DFF_X1)
0.01 0.01 library hold time
0.01 data required time
---------------------------------------------------------
0.01 data required time
-0.00 data arrival time
---------------------------------------------------------
-0.01 slack (VIOLATED)
Startpoint: r2 (rising edge-triggered flip-flop clocked by clk)
Endpoint: r3 (rising edge-triggered flip-flop clocked by clk)
Path Group: clk
Path Type: max
Corner: ss
Delay Time Description
---------------------------------------------------------
0.00 0.00 clock clk (rise edge)
0.00 0.00 clock network delay (ideal)
0.00 0.00 ^ r2/CK (DFF_X1)
0.26 0.26 v r2/Q (DFF_X1)
0.09 0.35 v u1/Z (BUF_X1)
0.11 0.46 v u2/ZN (AND2_X1)
0.00 0.46 v r3/D (DFF_X1)
0.46 data arrival time
10.00 10.00 clock clk (rise edge)
0.00 10.00 clock network delay (ideal)
0.00 10.00 clock reconvergence pessimism
10.00 ^ r3/CK (DFF_X1)
-0.16 9.84 library setup time
9.84 data required time
---------------------------------------------------------
9.84 data required time
-0.46 data arrival time
---------------------------------------------------------
9.38 slack (MET)
Startpoint: r2 (rising edge-triggered flip-flop clocked by clk)
Endpoint: r3 (rising edge-triggered flip-flop clocked by clk)
Path Group: clk
Path Type: max
Corner: tt
Delay Time Description
---------------------------------------------------------
0.00 0.00 clock clk (rise edge)
0.00 0.00 clock network delay (ideal)
0.00 0.00 ^ r2/CK (DFF_X1)
0.09 0.09 v r2/Q (DFF_X1)
0.03 0.11 v u1/Z (BUF_X1)
0.03 0.14 v u2/ZN (AND2_X1)
0.00 0.14 v r3/D (DFF_X1)
0.14 data arrival time
10.00 10.00 clock clk (rise edge)
0.00 10.00 clock network delay (ideal)
0.00 10.00 clock reconvergence pessimism
10.00 ^ r3/CK (DFF_X1)
-0.04 9.96 library setup time
9.96 data required time
---------------------------------------------------------
9.96 data required time
-0.14 data arrival time
---------------------------------------------------------
9.82 slack (MET)

26
test/find_parent_dir.tcl Normal file
View File

@ -0,0 +1,26 @@
#! /bin/sh
# The next line is executed by /bin/sh, but not Tcl \
exec tclsh $0 ${1+"$@"}
# Parallax Static Timing Analyzer
# Copyright (c) 2019, Parallax Software, Inc.
# All rights reserved.
#
# No part of this document may be copied, transmitted or
# disclosed in any form or fashion without the express
# written consent of Parallax Software, Inc.
proc find_parent_dir { dir } {
if { $dir == "." } {
return ".."
} else {
set path [file split $dir]
set path_len [llength $path]
if { $path_len == 1 } {
return "."
} else {
set path_len2 [expr $path_len - 2]
return [eval file join [lrange $path 0 $path_len2]]
}
}
}

26
test/regression Executable file
View File

@ -0,0 +1,26 @@
#!/bin/sh
# The next line is executed by /bin/sh, but not Tcl \
exec tclsh $0 ${1+"$@"}
# Parallax Static Timing Analyzer
# Copyright (c) 2019, Parallax Software, Inc.
# All rights reserved.
#
# No part of this document may be copied, transmitted or
# disclosed in any form or fashion without the express
# written consent of Parallax Software, Inc.
# Usage: regression help | test1 [test2...]
# where test is all or the name of a tcl script in $STA/test
# Directory containing tests.
set test_dir [file dirname [file normalize [info script]]]
source [file join $test_dir find_parent_dir.tcl]
source [file join $test_dir regression_vars.tcl]
source [file join $test_dir regression.tcl]
regression_main
# Local Variables:
# mode:tcl
# End:

500
test/regression.tcl Executable file
View File

@ -0,0 +1,500 @@
# Parallax Static Timing Analyzer
# Copyright (c) 2019, Parallax Software, Inc.
# All rights reserved.
#
# No part of this document may be copied, transmitted or
# disclosed in any form or fashion without the express
# written consent of Parallax Software, Inc.
proc regression_main {} {
setup
parse_args
run_tests
show_summary
exit [found_errors]
}
proc setup {} {
global result_dir diff_file failure_file errors
global use_valgrind valgrind_shared_lib_failure
set use_valgrind 0
if { !([file exists $result_dir] && [file isdirectory $result_dir]) } {
file mkdir $result_dir
}
file delete $diff_file
file delete $failure_file
set errors(error) 0
set errors(memory) 0
set errors(leak) 0
set errors(race) 0
set errors(slow) 0
set errors(fast) 0
set errors(big) 0
set errors(small) 0
set errors(fail) 0
set errors(no_cmd) 0
set errors(no_ok) 0
set valgrind_shared_lib_failure 0
}
proc parse_args {} {
global argv app_options tests test_groups cmd_paths
global use_valgrind
global result_dir tests
while { $argv != {} } {
set arg [lindex $argv 0]
if { $arg == "help" || $arg == "-help" } {
puts {Usage: regression [-help] [-threads threads] [-valgrind] tests...}
puts " -threads max|integer - number of threads to use"
puts " -valgrind - run valgrind (linux memory checker)"
puts " Wildcarding for test names is supported (enclose in \"'s)"
puts " Tests are: all, fast, med, slow, or a test group or test name"
puts ""
puts " If 'limit coredumpsize unlimited' corefiles are saved in $result_dir/test.core"
exit
} elseif { $arg == "-threads" } {
set threads [lindex $argv 1]
if { !([string is integer $threads] || $threads == "max") } {
puts "Error: -threads arg $threads is not an integer or max."
exit 0
}
lappend app_options "-threads"
lappend app_options $threads
set argv [lrange $argv 2 end]
} elseif { $arg == "-valgrind" } {
set use_valgrind 1
set argv [lrange $argv 1 end]
} elseif { [llength $argv] == 0 } {
# Default is to run dist tests.
set tests [group_tests dist]
} else {
break
}
}
set tests [expand_tests $argv]
}
proc expand_tests { argv } {
global test_groups
set tests {}
foreach arg $argv {
if { [info exists test_groups($arg)] } {
set tests [concat $tests $test_groups($arg)]
} elseif { [string first "*" $arg] != -1 \
|| [string first "?" $arg] != -1 } {
# Find wildcard matches.
foreach test [group_tests "all"] {
if [string match $arg $test] {
lappend tests $test
}
}
} elseif { [lsearch [group_tests "all"] $arg] != -1 } {
lappend tests $arg
} else {
puts "Error: test $arg not found."
}
}
return $tests
}
proc run_tests {} {
global tests errors app_path
foreach test $tests {
run_test $test
}
# Macos debug info generated by valgrind.
file delete -force "$app_path.dSYM"
}
proc run_test { test } {
global result_dir diff_file errors diff_options
set cmd_file [test_cmd_file $test]
if [file exists $cmd_file] {
set ok_file [test_ok_file $test]
set log_file [test_log_file $test]
foreach file [glob -nocomplain [file join $result_dir $test.*]] {
file delete -force $file
}
puts -nonewline $test
flush stdout
set test_errors [run_test_app $test $cmd_file $log_file]
if { [lindex $test_errors 0] == "ERROR" } {
puts " *ERROR* [lrange $test_errors 1 end]"
append_failure $test
incr errors(error)
# For some reason seg faults aren't echoed in the log - add them.
if [file exists $log_file] {
set log_ch [open $log_file "a"]
puts $log_ch "$test_errors"
close $log_ch
}
# Report partial log diff anyway.
if [file exists $ok_file] {
catch [concat exec diff $diff_options $ok_file $log_file \
>> $diff_file]
}
} else {
set error_msg ""
if { [lsearch $test_errors "MEMORY"] != -1 } {
append error_msg " *MEMORY*"
append_failure $test
incr errors(memory)
}
if { [lsearch $test_errors "LEAK"] != -1 } {
append error_msg " *LEAK*"
append_failure $test
incr errors(leak)
}
if { [lsearch $test_errors "RACE"] != -1 } {
append error_msg " *RACE*"
append_failure $test
incr errors(race)
}
if { [lsearch $test_errors "SLOW"] != -1 } {
append error_msg " *SLOW*"
incr errors(slow)
}
if { [lsearch $test_errors "FAST"] != -1 } {
append error_msg " *FAST*"
incr errors(fast)
}
if { [lsearch $test_errors "BIG"] != -1 } {
append error_msg " *BIG*"
incr errors(big)
}
if { [lsearch $test_errors "SMALL"] != -1 } {
append error_msg " *SMALL*"
incr errors(small)
}
if [file exists $ok_file] {
# Filter dos '/r's from log file.
set tmp_file [file join $result_dir $test.tmp]
exec tr -d "\r" < $log_file > $tmp_file
file rename -force $tmp_file $log_file
if [catch [concat exec diff $diff_options $ok_file $log_file \
>> $diff_file]] {
puts " *FAIL*$error_msg"
append_failure $test
incr errors(fail)
} else {
puts " pass$error_msg"
}
} else {
puts " *NO OK FILE*$error_msg"
append_failure $test
incr errors(no_ok)
}
}
} else {
puts "$test *NO CMD FILE*"
incr errors(no_cmd)
}
}
proc append_failure { test } {
global failure_file
set fail_ch [open $failure_file "a"]
puts $fail_ch $test
close $fail_ch
}
# Return error.
proc run_test_app { test cmd_file log_file } {
global app_path errorCode use_valgrind
if { $use_valgrind } {
return [run_test_valgrind $test $cmd_file $log_file]
} else {
return [run_test_plain $test $cmd_file $log_file]
}
}
proc run_test_plain { test cmd_file log_file } {
global app_path app_options result_dir errorCode
if { ![file exists $app_path] } {
return "ERROR $app_path not found."
} elseif { ![file executable $app_path] } {
return "ERROR $app_path is not executable."
} else {
set save_dir [pwd]
cd [file dirname $cmd_file]
if { [catch [concat exec $app_path $app_options \
[file tail $cmd_file] >& $log_file]] } {
cd $save_dir
set signal [lindex $errorCode 2]
set error [lindex $errorCode 3]
# Errors strings are not consistent across platforms but signal
# names are.
if { $signal == "SIGSEGV" } {
# Save corefiles to regression results directory.
set pid [lindex $errorCode 1]
set sys_corefile [test_sys_core_file $test $pid]
if { [file exists $sys_corefile] } {
file copy $sys_corefile [test_core_file $test]
}
}
cleanse_logfile $test $log_file
return "ERROR $error"
}
cd $save_dir
cleanse_logfile $test $log_file
return ""
}
}
proc run_test_valgrind { test cmd_file log_file } {
global app_path app_options valgrind_options result_dir errorCode
set vg_cmd_file [test_valgrind_cmd_file $test]
set vg_stream [open $vg_cmd_file "w"]
puts $vg_stream "cd [file dirname $cmd_file]"
puts $vg_stream "source [file tail $cmd_file]"
puts $vg_stream "sta::delete_all_memory"
close $vg_stream
set cmd [concat exec valgrind $valgrind_options \
$app_path $app_options $vg_cmd_file >& $log_file]
if { [catch $cmd] } {
set error [lindex $errorCode 3]
cleanse_valgrind_logfile $test $log_file
cleanse_logfile $test $log_file
return "ERROR $error"
} else {
cleanse_logfile $test $log_file
return [cleanse_valgrind_logfile $test $log_file]
}
}
# Error messages can be found in "valgrind/memcheck/mc_errcontext.c".
#
# "Conditional jump or move depends on uninitialised value(s)"
# "%s contains unaddressable byte(s)"
# "%s contains uninitialised or unaddressable byte(s)"
# "Use of uninitialised value of size %d"
# "Invalid read of size %d"
# "Syscall param %s contains uninitialised or unaddressable byte(s)"
# "Unaddressable byte(s) found during client check request"
# "Uninitialised or unaddressable byte(s) found during client check request"
# "Invalid free() / delete / delete[]"
# "Mismatched free() / delete / delete []"
set valgrind_mem_regexp "(depends on uninitialised value)|(contains unaddressable)|(contains uninitialised)|(Use of uninitialised value)|(Invalid read)|(Unaddressable byte)|(Uninitialised or unaddressable)|(Invalid free)|(Mismatched free)"
# "%d bytes in %d blocks are definitely lost in loss record %d of %d"
# "%d bytes in %d blocks are possibly lost in loss record %d of %d"
#set valgrind_leak_regexp "blocks are (possibly|definitely) lost"
set valgrind_leak_regexp "blocks are definitely lost"
# Valgrind fails on executables using shared libraries.
set valgrind_shared_lib_failure_regexp "No malloc'd blocks -- no leaks are possible"
# Scan the log file to separate valgrind notifications and check for
# valgrind errors.
proc cleanse_valgrind_logfile { test log_file } {
global valgrind_mem_regexp valgrind_leak_regexp
global valgrind_shared_lib_failure_regexp
global valgrind_shared_lib_failure
set tmp_file [test_tmp_file $test]
set valgrind_log_file [test_valgrind_file $test]
file copy -force $log_file $tmp_file
set tmp [open $tmp_file "r"]
set log [open $log_file "w"]
set valgrind [open $valgrind_log_file "w"]
set leaks 0
set mem_errors 0
gets $tmp line
while { ![eof $tmp] } {
if {[regexp "^==" $line]} {
puts $valgrind $line
if {[regexp $valgrind_leak_regexp $line]} {
set leaks 1
}
if {[regexp $valgrind_mem_regexp $line]} {
set mem_errors 1
}
if {[regexp $valgrind_shared_lib_failure_regexp $line]} {
set valgrind_shared_lib_failure 1
}
} elseif {[regexp {^--[0-9]+} $line]} {
# Valgrind notification line.
} else {
puts $log $line
}
gets $tmp line
}
close $log
close $tmp
close $valgrind
file delete $tmp_file
set errors {}
if { $mem_errors } {
lappend errors "MEMORY"
}
if { $leaks } {
lappend errors "LEAK"
}
return $errors
}
################################################################
proc show_summary {} {
global errors tests diff_file result_dir valgrind_shared_lib_failure
global app_path app
puts "------------------------------------------------------"
set test_count [llength $tests]
if { [found_errors] } {
if { $errors(error) != 0 } {
puts "Errored $errors(error)/$test_count"
}
if { $errors(fail) != 0 } {
puts "Failed $errors(fail)/$test_count"
}
if { $errors(leak) != 0 } {
puts "Memory leaks in $errors(leak)/$test_count"
}
if { $errors(memory) != 0 } {
puts "Memory corruption in $errors(memory)/$test_count"
}
if { $errors(race) != 0 } {
puts "Race errors in $errors(race)/$test_count"
}
if { $errors(no_ok) != 0 } {
puts "No ok file for $errors(no_ok)/$test_count"
}
if { $errors(no_cmd) != 0 } {
puts "No cmd tcl file for $errors(no_cmd)/$test_count"
}
if { $errors(fail) != 0 } {
puts "See $diff_file for differences"
}
} else {
puts "Passed $test_count"
}
if { $valgrind_shared_lib_failure } {
puts "WARNING: valgrind failed because the executable is not statically linked."
}
puts "See $result_dir for log files"
}
proc found_errors {} {
global errors
return [expr $errors(error) != 0 || $errors(fail) != 0 \
|| $errors(no_cmd) != 0 || $errors(no_ok) != 0 \
|| $errors(memory) != 0 || $errors(leak) != 0 \
|| $errors(race) != 0]
}
################################################################
proc save_ok_main {} {
global argv
if { $argv == "help" || $argv == "-help" } {
puts {Usage: save_ok [failures] test1 [test2]...}
} elseif { $argv == "failures" } {
global failure_file
if [file exists $failure_file] {
set fail_ch [open $failure_file "r"]
while { ! [eof $fail_ch] } {
set test [gets $fail_ch]
if { $test != "" } {
save_ok $test
}
}
close $fail_ch
}
} else {
foreach test $argv {
save_ok $test
}
}
}
proc save_ok { test } {
if { [lsearch [group_tests "all"] $test] == -1 } {
puts "Error: test $test not found."
} else {
set ok_file [test_ok_file $test]
set log_file [test_log_file $test]
if { ! [file exists $log_file] } {
puts "Error: log file $log_file not found."
} else {
file copy -force $log_file $ok_file
}
}
}
################################################################
proc test_cmd_dir { test } {
global cmd_dirs
if {[info exists cmd_dirs($test)]} {
return $cmd_dirs($test)
} else {
return ""
}
}
proc test_cmd_file { test } {
return [file join [test_cmd_dir $test] "$test.tcl"]
}
proc test_ok_file { test } {
global test_dir
return [file join $test_dir "$test.ok"]
}
proc test_log_file { test } {
global result_dir
return [file join $result_dir "$test.log"]
}
proc test_tmp_file { test } {
global result_dir
return [file join $result_dir $test.tmp]
}
proc test_valgrind_cmd_file { test } {
global result_dir
return [file join $result_dir $test.vg_cmd]
}
proc test_valgrind_file { test } {
global result_dir
return [file join $result_dir $test.valgrind]
}
proc test_core_file { test } {
global result_dir
return [file join $result_dir $test.core]
}
proc test_sys_core_file { test pid } {
global cmd_dirs
# macos
# return [file join "/cores" "core.$pid"]
# Suse
return [file join [test_cmd_dir $test] "core"]
}
################################################################
# Local Variables:
# mode:tcl
# End:

107
test/regression_vars.tcl Normal file
View File

@ -0,0 +1,107 @@
# Parallax Static Timing Analyzer
# Copyright (c) 2019, Parallax Software, Inc.
# All rights reserved.
#
# No part of this document may be copied, transmitted or
# disclosed in any form or fashion without the express
# written consent of Parallax Software, Inc.
# Regression variables.
# Application program to run tests on.
if { [regexp "CYGWIN" [exec uname -a]] } {
set app "sta.exe"
} else {
set app "sta"
}
set sta_dir [find_parent_dir $test_dir]
set app_path [file join $sta_dir "app" $app]
# Application options.
set app_options "-no_init -no_splash -exit"
# Log files for each test are placed in result_dir.
set result_dir [file join $test_dir "results"]
# Collective diffs.
set diff_file [file join $result_dir "diffs"]
# File containing list of failed tests.
set failure_file [file join $result_dir "failures"]
# Use the DIFF_OPTIONS envar to change the diff options
# (Solaris diff doesn't support this envar)
set diff_options "-c"
if [info exists env(DIFF_OPTIONS)] {
set diff_options $env(DIFF_OPTIONS)
}
set valgrind_suppress [file join $test_dir valgrind.suppress]
set valgrind_options "--num-callers=20 --leak-check=full --freelist-vol=100000000 --leak-resolution=high --suppressions=$valgrind_suppress"
if { [exec "uname"] == "Darwin" } {
append valgrind_options " --dsymutil=yes"
}
proc cleanse_logfile { test log_file } {
# Nothing to be done here.
}
################################################################
# Record a test in the regression suite.
proc record_test { test cmd_dir } {
global cmd_dirs test_groups
set cmd_dirs($test) $cmd_dir
lappend test_groups(all) $test
return $test
}
# Record a test in the $STA/examples directory.
proc record_example_tests { tests } {
global test_dir test_groups
set example_dir [file join $test_dir ".." "examples"]
foreach test $tests {
# Prune commented tests from the list.
if { [string index $test 0] != "#" } {
record_test $test $example_dir
}
}
}
################################################################
proc define_test_group { name tests } {
global test_groups
set test_groups($name) $tests
}
proc group_tests { name } {
global test_groups
return $test_groups($name)
}
# Clear the test lists.
proc clear_tests {} {
global test_groups
unset test_groups
}
proc list_delete { list delete } {
set result {}
foreach item $list {
if { [lsearch $delete $item] == -1 } {
lappend result $item
}
}
return $result
}
################################################################
# Regression test lists.
# Record tests in sta/examples
record_example_tests {
example1
example2
example3
example4
example5
}
define_test_group fast [group_tests all]

24
test/save_ok Executable file
View File

@ -0,0 +1,24 @@
#! /bin/sh
# The next line is executed by /bin/sh, but not Tcl \
exec tclsh $0 ${1+"$@"}
# Parallax Static Timing Analyzer
# Copyright (c) 2019, Parallax Software, Inc.
# All rights reserved.
#
# No part of this document may be copied, transmitted or
# disclosed in any form or fashion without the express
# written consent of Parallax Software, Inc.
# Directory containing tests.
set test_dir [file dirname [info script]]
source [file join $test_dir find_parent_dir.tcl]
set sta_dir [find_parent_dir $test_dir]
source [file join $test_dir regression_vars.tcl]
source [file join $test_dir regression.tcl]
save_ok_main
# Local Variables:
# mode:tcl
# End:

155
test/valgrind.suppress Normal file
View File

@ -0,0 +1,155 @@
{
SuSE 12.1
Memcheck:Leak
fun:malloc
obj:/usr/lib64/libtcl8.5.so
}
{
SuSE 12.1
Memcheck:Leak
fun:realloc
obj:/usr/lib64/libtcl8.5.so
}
{
MACOS 10.6.4
Memcheck:Leak
fun:malloc
fun:TclpAlloc
}
{
MACOS 10.6.4
Memcheck:Leak
fun:malloc
fun:SWIG_Tcl_NewInstanceObj
}
{
MACOS 10.6.4
Memcheck:Leak
fun:malloc
fun:Tcl_GetMemoryInfo
}
{
MACOS 10.6.4
Memcheck:Leak
fun:malloc_zone_malloc
...
fun:TclpSetInitialEncodings
}
{
MACOS 10.6.4
Memcheck:Leak
fun:malloc_zone_malloc
...
fun:CFPreferencesCopyAppValue
}
{
MACOS 10.6.4
Memcheck:Cond
obj:/usr/lib/libSystem.B.dylib
}
{
MACOS 10.6.4
Memcheck:Cond
fun:pthread_rwlock_init
}
{
MACOS 10.6.4
Memcheck:Cond
fun:Tcl_GetVersion
}
{
MACOS 10.6.4
Memcheck:Cond
fun:TclObjInvoke
}
{
MACOS 10.10.1
Memcheck:Leak
fun:malloc
obj:/usr/lib/libicucore.A.dylib
}
{
MACOS 10.10.1
Memcheck:Leak
fun:calloc
obj:/usr/lib/libobjc.A.dylib
}
{
MACOS 10.10.1
Memcheck:Leak
fun:malloc_zone_malloc
obj:/usr/lib/libobjc.A.dylib
}
{
MACOS 10.10.1
Memcheck:Leak
fun:malloc_zone_calloc
obj:/usr/lib/libobjc.A.dylib
}
{
MACOS 10.10.1
Memcheck:Leak
fun:malloc
...
obj:/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
}
{
MACOS 10.10.1
Memcheck:Leak
fun:malloc_zone_malloc
obj:/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
}
{
MACOS 10.10.1
Memcheck:Cond
fun:Tcl_AppendObjToErrorInfo
}
{
Ubuntu 11.10
Memcheck:Leak
fun:malloc
...
fun:Tcl_CreateInterp
}
{
Ubuntu 11.10
Memcheck:Leak
fun:malloc
...
fun:Tcl_NewStringObj
}
{
Ubuntu 11.10
Memcheck:Leak
fun:malloc
...
fun:TclSetByteCodeFromAny
}
{
Ubuntu 11.10
Memcheck:Leak
fun:malloc
...
fun:TclObjInterpProcCore
}
{
Ubuntu 11.10
Memcheck:Cond
fun:inflateReset2
}
{
Ubuntu 11.10
Memcheck:Leak
fun:malloc
...
fun:Tcl_NewObj
}
{
Ubuntu 11.10
Memcheck:Leak
fun:malloc
...
fun:TclNRRunCallbacks
}