Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def parse_sanitizer_message(
stack_traces, events, line = self.parse_stack_trace(it, line)

message = match.group('message').strip()
checker_name = None
for check, patterns in self.checks.items():
if any(pattern.search(message) for pattern in patterns):
checker_name = f"{self.checker_name}.{check}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ def test_ubsan1(self):
self.__check_analyzer_result('ubsan1.out', 'ubsan1.cpp_ubsan.plist',
['files/ubsan1.cpp'], 'ubsan1.plist')

def test_ubsan1_nonmatching_msg(self):
"""
Test for the test_ubsan1_nonmatching_msg.plist file, where the reported
error message doesn't match any of the checkers we recognize.
"""
self.maxDiff = None
self.__check_analyzer_result(
'ubsan1_nonmatching_msg.out', 'ubsan1.cpp_ubsan.plist',
['files/ubsan1.cpp'], 'ubsan1_nonmatching_msg.plist')

def test_ubsan2(self):
""" Test for the ubsan2.plist file. """
self.__check_analyzer_result('ubsan2.out', 'ubsan2.cpp_ubsan.plist',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
files/ubsan1.cpp:4:5: runtime error: This is not an actual error message, just tests whether we crash on a msg we don't associate with a checker.
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>diagnostics</key>
<array>
<dict>
<key>category</key>
<string>unknown</string>
<key>check_name</key>
<string>UndefinedBehaviorSanitizer</string>
Comment on lines +10 to +11
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.

How can this be that, if it was supposedly initialised to None?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The idea is that when checker_name is None, we fall back to a default checker name later down the road, which is the name of the sanitizer.

<key>description</key>
<string>This is not an actual error message, just tests whether we crash on a msg we don't associate with a checker.</string>
<key>issue_hash_content_of_line_in_context</key>
<string>253cc81796d3eccc4c6fa0c4ade5bb53</string>
<key>location</key>
<dict>
<key>col</key>
<integer>5</integer>
<key>file</key>
<integer>0</integer>
<key>line</key>
<integer>4</integer>
</dict>
<key>path</key>
<array>
<dict>
<key>depth</key>
<integer>0</integer>
<key>kind</key>
<string>event</string>
<key>location</key>
<dict>
<key>col</key>
<integer>5</integer>
<key>file</key>
<integer>0</integer>
<key>line</key>
<integer>4</integer>
</dict>
<key>message</key>
<string>This is not an actual error message, just tests whether we crash on a msg we don't associate with a checker.</string>
</dict>
</array>
<key>type</key>
<string>ubsan</string>
</dict>
</array>
<key>files</key>
<array>
<string>files/ubsan1.cpp</string>
</array>
<key>metadata</key>
<dict>
<key>analyzer</key>
<dict>
<key>name</key>
<string>ubsan</string>
</dict>
<key>generated_by</key>
<dict>
<key>name</key>
<string>report-converter</string>
<key>version</key>
<string>x.y.z</string>
</dict>
</dict>
</dict>
</plist>