Skip to content

[feat] Add memory safety reporter script - #4962

Open
gulyasgergely902 wants to merge 1 commit into
Ericsson:masterfrom
gulyasgergely902:add-memory-safety-report-script
Open

[feat] Add memory safety reporter script#4962
gulyasgergely902 wants to merge 1 commit into
Ericsson:masterfrom
gulyasgergely902:add-memory-safety-report-script

Conversation

@gulyasgergely902

Copy link
Copy Markdown
Collaborator

This change adds the new memory safety reporter script which collects all configs which were used for a given analysis.

@gulyasgergely902 gulyasgergely902 added this to the release 6.29.0 milestone Jul 14, 2026
@gulyasgergely902 gulyasgergely902 added the tools 🛠️ Meta-tag for all the additional tools supplied with CodeChecker: plist2html, tu_collector, etc. label Jul 14, 2026
@gulyasgergely902
gulyasgergely902 requested a review from dkrupp July 14, 2026 10:06
@gulyasgergely902
gulyasgergely902 force-pushed the add-memory-safety-report-script branch from b26bda3 to 2d690d6 Compare July 16, 2026 09:08
Comment thread scripts/memory_safety_reporter.py Outdated
@gulyasgergely902
gulyasgergely902 force-pushed the add-memory-safety-report-script branch 2 times, most recently from 21feff0 to 1e403e1 Compare July 21, 2026 10:07
@gulyasgergely902
gulyasgergely902 requested a review from bruntib July 21, 2026 10:08

@barnabasdomozi barnabasdomozi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you add a test case which uses this script?
In the future, flags for these CodeChecker commands could change and then this script could be broken by accident.

Comment thread tools/memory-safety-reporter/memory_safety_reporter.py
Comment thread tools/memory-safety-reporter/memory_safety_reporter.py
Comment thread tools/memory-safety-reporter/memory_safety_reporter.py
Comment thread scripts/memory_safety_reporter.py Outdated
@gulyasgergely902
gulyasgergely902 force-pushed the add-memory-safety-report-script branch 3 times, most recently from 10f70cb to b4cd671 Compare July 22, 2026 08:11

@barnabasdomozi barnabasdomozi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As mentioned in my other comment, please add a simple test case which is executed in the GitHub CI.

@gulyasgergely902
gulyasgergely902 force-pushed the add-memory-safety-report-script branch 11 times, most recently from 089d751 to d8d91bb Compare July 30, 2026 12:49

@barnabasdomozi barnabasdomozi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think creating a whole python package with setup.py and Makefile is unnecessary for this simple script. And I also think it's unnecessary to add Makefile targets to upload this to the PyPi registry.

Moreover, when building CodeChecker with
make venv and then make package, this new memory-safety-reporter command is not available for some reason.

As a simpler solution, I think it would suffice to add #!/usr/bin/env python3 to the top of the file, and then it could be executed as memory-safety-reporter.
An alternative would be to add this script as a CodeChecker subcommand, e.g. CodeChecker memory-safety-converter. I think this would make more sense and it would worth a discussion with the team.

As for the test cases, the tools/memory-safety-reporter/tests/functional/cmdline/test_files/ directory should be generated by the test case and not commited to this repository. Ideally, the test case should not include binary files like tools/memory-safety-reporter/tests/functional/cmdline/test_files/test-report/failed/xmltest.cpp_clangsa_382c4897e0fb3b0c4fe94ece86cee8ca.plist_CTU_compile_error.zip and should also not include development machine absolute paths like /local/test_projects/tinyxml2/xmltest.cpp.

@gulyasgergely902

gulyasgergely902 commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator Author

After a short meeting agreed to:

  • Use a simpler solution instead of the module approach since the script will not be imported by others.
  • Simplify the tests to use a simpler recreation of a report directory.

@gulyasgergely902
gulyasgergely902 force-pushed the add-memory-safety-report-script branch 4 times, most recently from f05ea91 to 5266e55 Compare August 10, 2026 08:57

@barnabasdomozi barnabasdomozi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Overall looks good to me, but I left a few comments.

Comment thread Makefile Outdated

package: package_dir_structure set_git_commit_template package_gerrit_skiplist
package_memory_safety_reporter: package_dir_structure
cp -p tools/memory-safety-reporter/memory_safety_reporter.py $(CC_BUILD_BIN_DIR)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Minor suggestion:
I think it would be more clean if we copy this python file to the bin folder and name it memor_safety_reporter (without the .py).

This way, users can just call it by typing memory_safety_reporter.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please remove these large .plist and .plist.bak files from this patch. As an example, this file is 4500 lines long.

I think we should keep these test cases as small as possible with only few plists files that are below 100 lines.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I've created an even smaller report by analyzing a single cpp file. This contains only the necessary files to test the script.

@gulyasgergely902
gulyasgergely902 force-pushed the add-memory-safety-report-script branch 2 times, most recently from 7bce7de to a6f1d27 Compare August 12, 2026 10:39
@gulyasgergely902
gulyasgergely902 force-pushed the add-memory-safety-report-script branch 2 times, most recently from 240073a to 44b0ca7 Compare August 12, 2026 12:40
This change adds the new memory safety reporter script which collects
all configs which were used for a given analysis.
@gulyasgergely902
gulyasgergely902 force-pushed the add-memory-safety-report-script branch from 44b0ca7 to 09e5f09 Compare August 12, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tools 🛠️ Meta-tag for all the additional tools supplied with CodeChecker: plist2html, tu_collector, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants