11 KiB
Test Quality Improvement — Implementation Plan (Revised)
Status Summary
| Comment | Issue | Status |
|---|---|---|
| 1 | verilog_write_types.tcl quality | Done |
| 2 | Tcl→C++ conversion (dcalc, others) | Done |
| 3 | Unnecessary catch blocks | Done — removed where safe, kept where commands genuinely fail |
| 4 | "puts PASS" anti-pattern | Done |
| 5 | Incremental timing tests | Done — TestSearchIncremental.cc expanded: 8→36 tests |
| 6 | liberty_wireload.tcl missing report_checks | Done — report_checks after each set_wire_load_model |
| 7 | liberty_ccsn_ecsm.tcl misnaming | Done — renamed to liberty_ccsn.tcl |
| 8 | liberty_sky130_corners.tcl not testing corners | Done — define_corners + read_liberty -corner, actual multi-corner timing |
| 9 | Orphaned sdc_disable_case.ok | Done |
| 10 | C++ tests too short | Done — TestPower: 71→96, TestSpice: 98→126, TestSearchIncremental: 8→36 |
| 11 | Remove PASS prints | Done (same as Comment 4) |
| 12 | test/ $ ./regression -R verilog_specify broken |
Done — special case for test/ directory |
| 13 | search/test/CMakeLists.txt messy | Done — sta_module_tests() function, all 12 modules refactored |
Remaining Tasks
Task 1: Remove remaining catch blocks (Comment 3)
Problem: 176 catch blocks remain in 30 Tcl test files, silently swallowing errors.
Affected files (30):
| Module | Files | Count |
|---|---|---|
| search | 16 files | 84 |
| sdc | 6 files | 39 |
| liberty | 8 files | 35 |
| verilog | 4 files | 4 |
Action for each file:
- Remove
catch {}wrappers around commands that should succeed — keep the command bare - Keep
catchonly when intentionally testing an error condition (e.g.,if {[catch {...} msg]} { ... }) - Regenerate
.okfiles by running the test
Note: Some catch blocks may have been left intentionally (e.g., liberty_ccsn_ecsm.tcl wrapping report_lib_cell calls that may fail on missing cells). Review each case carefully.
Task 2: Fix verilog test quality issues (Comment 1)
Problems remaining:
- Stale line-number comments in headers (e.g.,
# writeInstBusPin (line 382, hit=0)) - Useless
if { [file exists $out] && [file size $out] > 0 }checks — 16 files verilog_write_types.tclis monolithic (174 lines, no .ok file)
Affected files:
verilog_write_types.tcl,verilog_assign.tcl,verilog_complex_bus.tcl,verilog_const_concat.tcl— stale line# comments- 15 verilog + 1 sdf test files — empty file-existence checks
Action:
- Remove all
# Targets: ... (line NNN, hit=N)comment blocks from headers - Remove the useless
if { [file exists ...] && [file size ...] > 0 } { }blocks entirely (the.okdiff already validates output) - Either delete
verilog_write_types.tcl(its .ok is already gone) or regenerate its .ok - Regenerate affected
.okfiles
Task 3: Clean up dcalc Tcl tests (Comment 2)
Problem: 21 dcalc Tcl test files remain but ALL their .ok files were deleted. These Tcl tests are now effectively dead (cannot be regression-tested). New C++ tests have been added in TestDcalc.cc and TestFindRoot.cc.
Action:
- Verify the new C++ tests cover what the Tcl tests covered
- Delete the 21 orphaned Tcl files
- Remove their entries from
dcalc/test/CMakeLists.txt
Files to delete:
dcalc/test/dcalc_advanced.tcl dcalc/test/dcalc_multi_engine_spef.tcl
dcalc/test/dcalc_annotate_slew.tcl dcalc/test/dcalc_prima.tcl
dcalc/test/dcalc_annotated_incremental.tcl dcalc/test/dcalc_prima_arnoldi_deep.tcl
dcalc/test/dcalc_arnoldi_prima.tcl dcalc/test/dcalc_report.tcl
dcalc/test/dcalc_arnoldi_spef.tcl dcalc/test/dcalc_spef.tcl
dcalc/test/dcalc_ccs_incremental.tcl
dcalc/test/dcalc_ccs_parasitics.tcl
dcalc/test/dcalc_corners.tcl
dcalc/test/dcalc_dmp_ceff.tcl
dcalc/test/dcalc_dmp_convergence.tcl
dcalc/test/dcalc_dmp_edge_cases.tcl
dcalc/test/dcalc_dmp_pi_model_deep.tcl
dcalc/test/dcalc_engines.tcl
dcalc/test/dcalc_gcd_arnoldi_prima.tcl
dcalc/test/dcalc_graph_delay.tcl
dcalc/test/dcalc_incremental_tolerance.tcl
Task 4: Fix liberty_wireload.tcl (Comment 6)
Problem: Sets 9 different wireload models but only calls report_checks once at the end. Reviewer says: "Add report_checks call for each set_wire_load_model."
File: liberty/test/liberty_wireload.tcl
Action:
- Add
report_checks -from [get_ports in1] -to [get_ports out1]after eachset_wire_load_modelcall (lines 23-39) - This produces output that shows timing changes per wireload model — captured in the
.okgolden file - Regenerate
liberty_wireload.ok
Task 5: Fix liberty_ccsn_ecsm.tcl (Comment 7)
Problem: Test claims to test ECSM but only loads NLDM libraries. No ECSM libraries exist in the test data.
File: liberty/test/liberty_ccsn_ecsm.tcl
Action:
- Rename to
liberty_ccsn.tcl— remove "ecsm" from the name since no ECSM library is available - Update comments to remove ECSM claims
- Also fix the 13 remaining catch blocks in this file (Task 1 overlap)
- Update CMakeLists.txt registration
- Rename
.okfile accordingly - Regenerate
.ok
Task 6: Fix liberty_sky130_corners.tcl (Comment 8)
Problem:
- Claims to test corners but never uses
read_liberty -minor-max - Contains unrelated ASAP7 library reads (lines 125-153) that have nothing to do with corners
File: liberty/test/liberty_sky130_corners.tcl
Action:
- Use
define_corners+read_liberty -cornerto actually test multi-corner:define_corners fast slow read_liberty -corner fast ../../test/sky130hd/sky130_fd_sc_hd__ff_n40C_1v95.lib read_liberty -corner slow ../../test/sky130hd/sky130_fd_sc_hd__ss_n40C_1v40.lib - Add a design + constraints, then
report_checksper corner to verify different timing - Remove unrelated ASAP7 library reads (already covered by other tests)
- Fix remaining catch blocks (Task 1 overlap)
- Regenerate
.ok
Task 7: Fix test/ $ ./regression -R verilog_specify (Comment 12)
Problem: The test/regression script derives the module name from the current directory:
module=${script_path#${sta_home}/} # → "test"
module=${module%%/*} # → "test"
Then runs ctest -L "module_test". But tests in test/CMakeLists.txt are labeled "tcl", not "module_test".
Root cause: test/CMakeLists.txt uses sta_tcl_test() which sets label "tcl", while module CMakeLists.txt files set label "module_<name>".
Fix options (choose one):
- Option A (recommended): Update
test/regressionto handle thetest/directory as a special case — when module is "test", use label "tcl" instead of "module_test" - Option B: Add
"module_test"label tosta_tcl_test()function
I recommend Option A because it's minimal and doesn't change the labeling semantics.
Action:
- Edit
test/regressionto add special case fortest/directory - Verify:
cd test && ./regression -R verilog_specifypasses
Task 8: Clean up module CMakeLists.txt files (Comment 13)
Problem: search/test/CMakeLists.txt is 519 lines of repetitive boilerplate:
add_test(
NAME tcl.search.timing
COMMAND bash ${STA_HOME}/test/regression.sh $<TARGET_FILE:sta> search_timing
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
set_tests_properties(tcl.search.timing PROPERTIES LABELS "tcl;module_search")
This 6-line block is repeated ~85 times. The reference (rsz/test/CMakeLists.txt) uses a declarative list:
or_integration_tests("rsz" TESTS test1 test2 ...)
Action:
- Create a
sta_module_tests()CMake function (analogous toor_integration_tests()) in the top-level CMake or a shared include:function(sta_module_tests module_name) cmake_parse_arguments(ARG "" "" "TESTS" ${ARGN}) foreach(test_name ${ARG_TESTS}) add_test( NAME tcl.${module_name}.${test_name} COMMAND bash ${STA_HOME}/test/regression.sh $<TARGET_FILE:sta> ${module_name}_${test_name} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) set_tests_properties(tcl.${module_name}.${test_name} PROPERTIES LABELS "tcl;module_${module_name}") endforeach() endfunction() - Convert all module CMakeLists.txt files to use this function:
sta_module_tests("search" TESTS timing report_formats analysis ... ) add_subdirectory(cpp) - Affected files (all using verbose pattern):
search/test/CMakeLists.txt(519 lines → ~85 lines)sdc/test/CMakeLists.txt(281 lines → ~50 lines)liberty/test/CMakeLists.txt(218 lines → ~40 lines)verilog/test/CMakeLists.txt(190 lines → ~35 lines)network/test/CMakeLists.txt(183 lines → ~30 lines)dcalc/test/CMakeLists.txt(148 lines → ~25 lines, after Task 3 cleanup)parasitics/test/CMakeLists.txt(120 lines → ~20 lines)graph/test/CMakeLists.txt(78 lines → ~15 lines)sdf/test/CMakeLists.txt(71 lines → ~15 lines)spice/test/CMakeLists.txt(64 lines → ~12 lines)util/test/CMakeLists.txt(64 lines → ~12 lines)power/test/CMakeLists.txt(50 lines → ~10 lines)
- Verify all tests still pass via
ctest
Task 9: Expand short C++ tests (Comment 10) — DEFERRED
Problem: Some C++ test files are too short:
TestSearchIncremental.cc— 460 lines, 8 testsTestFindRoot.cc— 667 lines, 46 testsTestPower.cc— 914 lines, 71 testsTestSpice.cc— 1,370 lines, 98 tests
Action: This is a substantial effort. Focus on higher-priority items (Tasks 1-8) first. Expansion can be done incrementally in follow-up PRs.
Task 10: Add incremental timing C++ tests (Comment 5) — DEFERRED
Problem: Reviewer asked for tests that "modify the netlist and do incremental timing." Tcl tests exist (search_network_edit_replace.tcl, search_network_edit_deep.tcl, dcalc_annotated_incremental.tcl) but C++ coverage is thin (TestSearchIncremental.cc has only 8 tests).
Action: Expand TestSearchIncremental.cc with comprehensive C++ tests. Deferred — same rationale as Task 9.
Execution Order
Task 1: Remove remaining catch blocks (Comment 3)
Task 2: Fix verilog test quality (Comment 1)
Task 3: Clean up dead dcalc Tcl tests (Comment 2)
Task 4: Fix liberty_wireload.tcl (Comment 6)
Task 5: Rename liberty_ccsn_ecsm.tcl (Comment 7)
Task 6: Fix liberty_sky130_corners.tcl (Comment 8)
Task 7: Fix test/regression for verilog_specify (Comment 12)
Task 8: Clean up all module CMakeLists.txt (Comment 13)
---
Task 9: Expand short C++ tests (Comment 10) — DEFERRED
Task 10: Add incremental timing C++ tests (Comment 5) — DEFERRED
Tasks 1-3 can be done in parallel (independent modules). Tasks 4-6 can be done in parallel (independent liberty test files). Task 7 is independent. Task 8 depends on Tasks 1-6 (CMakeLists.txt should reflect final test list).