1# OpenSTA, Static Timing Analyzer
2# Copyright (c) 2021, Parallax Software, Inc.
3#
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation, either version 3 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program.  If not, see <https://www.gnu.org/licenses/>.
16
17# Regression variables.
18
19# Application program to run tests on.
20set app "sta"
21set sta_dir [file dirname $test_dir]
22set app_path [file join $sta_dir "app" $app]
23# Application options.
24set app_options "-no_init -no_splash -exit"
25# Log files for each test are placed in result_dir.
26set result_dir [file join $test_dir "results"]
27# Collective diffs.
28set diff_file [file join $result_dir "diffs"]
29# File containing list of failed tests.
30set failure_file [file join $result_dir "failures"]
31# Use the DIFF_OPTIONS envar to change the diff options
32# (Solaris diff doesn't support this envar)
33set diff_options "-c"
34if [info exists env(DIFF_OPTIONS)] {
35  set diff_options $env(DIFF_OPTIONS)
36}
37
38set valgrind_suppress [file join $test_dir valgrind.suppress]
39set valgrind_options "--num-callers=20 --leak-check=full --freelist-vol=100000000 --leak-resolution=high --suppressions=$valgrind_suppress"
40if { [exec "uname"] == "Darwin" } {
41  append valgrind_options " --dsymutil=yes"
42}
43
44proc cleanse_logfile { test log_file } {
45  # Nothing to be done here.
46}
47
48################################################################
49
50# Record a test in the regression suite.
51proc record_test { test cmd_dir } {
52  global cmd_dirs test_groups
53  set cmd_dirs($test) $cmd_dir
54  lappend test_groups(all) $test
55  return $test
56}
57
58# Record a test in the $STA/examples directory.
59proc record_example_tests { tests } {
60  global test_dir test_groups
61  set example_dir [file join $test_dir ".." "examples"]
62  foreach test $tests {
63    # Prune commented tests from the list.
64    if { [string index $test 0] != "#" } {
65      record_test $test $example_dir
66    }
67  }
68}
69
70################################################################
71
72proc define_test_group { name tests } {
73  global test_groups
74  set test_groups($name) $tests
75}
76
77proc group_tests { name } {
78  global test_groups
79  return $test_groups($name)
80}
81
82# Clear the test lists.
83proc clear_tests {} {
84  global test_groups
85  unset test_groups
86}
87
88proc list_delete { list delete } {
89  set result {}
90  foreach item $list {
91    if { [lsearch $delete $item] == -1 } {
92      lappend result $item
93    }
94  }
95  return $result
96}
97
98################################################################
99
100# Regression test lists.
101
102# Record tests in sta/examples
103record_example_tests {
104  example1
105  example2
106  example3
107  example4
108  example5
109}
110
111define_test_group fast [group_tests all]
112