Skip to content

test: Check metrics cleanup and move antenna test pin - #12145

Open
jhkim-pii wants to merge 3 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:coverity-fix-pr11742
Open

jhkim-pii wants to merge 3 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:coverity-fix-pr11742

Conversation

@jhkim-pii

Copy link
Copy Markdown
Contributor

Coverity Defect Log

** CID 1688344:       Error handling issues  (CHECKED_RETURN)
/src/tst/src/logger_checks.cpp: 30           in tst::MetricsCapture::~MetricsCapture()()


_____________________________________________________________________________________________
*** CID 1688344:         Error handling issues  (CHECKED_RETURN)
/src/tst/src/logger_checks.cpp: 30             in tst::MetricsCapture::~MetricsCapture()()
24       logger_.addMetricsSink(path_.c_str());
25     }
26     
27     MetricsCapture::~MetricsCapture()
28     {
29       logger_.removeMetricsSink(path_.c_str());
>>>     CID 1688344:         Error handling issues  (CHECKED_RETURN)
>>>     Calling "remove(this->path_.c_str())" without checking return value. This library function may fail and return an error code.
30       std::remove(path_.c_str());
31     }
32     
33     std::optional<std::string> MetricsCapture::value(std::string_view name)
34     {
35       // Removing the sink flushes the recorded metrics to it.

** CID 1688333:       Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)


_____________________________________________________________________________________________
*** CID 1688333:         Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/src/ant/test/cpp/TestAntennaReport.cpp: 67             in ant::test::<unnamed>::AntennaReportTest_Format_Test::TestBody()()
61       cut.layer = stack_.cut(1);
62       cut.par = {.actual = 0.14, .required = 0.1, .violated = true};
63       cut.car = {.actual = 0.25, .required = 0, .violated = false};
64       cut.violated = true;
65       pin.layers.push_back(cut);
66     
>>>     CID 1688333:         Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
>>>     "pin" is copied and then passed-by-reference as parameter to STL insertion function "push_back", when it could be moved instead.
67       net_check.pins.push_back(pin);
68     
69       // Unflagged ratios keep a trailing space after the rule name.
70       const std::string expected
71           = "Net: n1\n"
72             "  Pin:   u1/A (GATE)\n"

Solution

CID Defect type Resolution
1688344 CHECKED_RETURN Check metrics file removal, tolerate an absent file, and fail the test on other cleanup errors.
1688333 COPY_INSTEAD_OF_MOVE Move the completed PinCheck into the report collection.

Related

Check metrics file removal in the shared test helper so unexpected cleanup failures fail the test while an absent file remains harmless. Move the completed antenna PinCheck into its collection to avoid an unnecessary deep copy. These address Coverity CIDs 1688344 and 1688333 introduced by the antenna C++ test PR.

Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
@jhkim-pii jhkim-pii self-assigned this Nov 6, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request optimizes pin handling in TestAntennaReport.cpp using std::move and adds error checking for file removal in logger_checks.cpp. The review feedback recommends replacing the C-style std::remove and errno checks with modern C++20 std::filesystem::remove and std::error_code for cleaner and more idiomatic error handling.

Comment thread src/tst/src/logger_checks.cpp Resolved
Comment thread src/tst/src/logger_checks.cpp Resolved
Use the error-code overload of filesystem::remove in MetricsCapture.
Allow an absent metrics file while reporting other cleanup errors with
system details, and remove the unused C-style removal headers.

Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
@github-actions github-actions Bot added size/S and removed size/XS labels Nov 6, 2026
Bring in master at 4ba43e1, including the current sv-elab dependency.
This removes the stale sv-lang archive dependency from the test PR.
Preserve the metrics cleanup and antenna test changes after the merge.

Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
@jhkim-pii
jhkim-pii marked this pull request as ready for review November 6, 2026 06:13
@jhkim-pii
jhkim-pii requested review from a team as code owners November 6, 2026 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant