From b89061d2a84fc3063998e3dd06dafdd1d3955466 Mon Sep 17 00:00:00 2001 From: bruntib Date: Mon, 6 Jan 2025 13:45:40 +0100 Subject: [PATCH] [test] Add tests for different report hashes There are some tests already which check if two reports with different annotations are considered different reports. Now we also check if two reports with different report hash are considered different. --- .../dynamic_results/test_dynamic_results.py | 19 +++---- ...idy_0212cbc2c7194b7a5d431a18ff51bb1c.plist | 52 +++++++++++++++++++ 2 files changed, 62 insertions(+), 9 deletions(-) diff --git a/web/tests/functional/dynamic_results/test_dynamic_results.py b/web/tests/functional/dynamic_results/test_dynamic_results.py index 2611155b14..66ce514c71 100644 --- a/web/tests/functional/dynamic_results/test_dynamic_results.py +++ b/web/tests/functional/dynamic_results/test_dynamic_results.py @@ -102,7 +102,7 @@ def test_sort_by_timestamp(self): results = self._cc_client.getRunResults( None, 500, 0, None, ReportFilter(), None, False) - self.assertEqual(len(results), 5) + self.assertEqual(len(results), 6) sort_timestamp = SortMode(SortType.TIMESTAMP, Order.ASC) @@ -119,7 +119,7 @@ def test_sort_by_timestamp(self): 'timestamp' not in results[i + 1].annotations: continue - self.assertLess( + self.assertLessEqual( results[i].annotations['timestamp'], results[i + 1].annotations['timestamp']) @@ -134,7 +134,7 @@ def test_filter_by_attribute(self): results = self._cc_client.getRunResults( None, 500, 0, None, testcase_filter, None, False) - self.assertEqual(len(results), 2) + self.assertEqual(len(results), 3) self.assertTrue(all(map( lambda report: report.annotations['testcase'] == 'TC-1', @@ -147,7 +147,7 @@ def test_filter_by_attribute(self): results = self._cc_client.getRunResults( None, 500, 0, None, testcase_filter, None, False) - self.assertEqual(len(results), 4) + self.assertEqual(len(results), 5) self.assertTrue(all(map( lambda report: report.annotations['testcase'].startswith('TC-'), @@ -160,7 +160,7 @@ def test_count_by_attribute(self): num = self._cc_client.getRunResultCount( None, ReportFilter(), None) - self.assertEqual(num, 5) + self.assertEqual(num, 6) testcase_filter = ReportFilter(annotations=[Pair( first='testcase', @@ -169,7 +169,7 @@ def test_count_by_attribute(self): num = self._cc_client.getRunResultCount( None, testcase_filter, None) - self.assertEqual(num, 2) + self.assertEqual(num, 3) def test_unique_path_hash(self): """Test that the unique path hash is calculated when two reports differ @@ -177,7 +177,8 @@ def test_unique_path_hash(self): results = self._cc_client.getRunResults( None, 500, 0, None, ReportFilter(), None, False) - # The main.c_lang-tidy.plist test file contains two - # bugprone-sizeof-expression reports that differ in their annotations. + # The main.c_lang-tidy.plist test file contains three + # bugprone-sizeof-expression reports. Two of them differ in their + # annotations two other differ in their report hash. # They should be considered as different reports. - self.assertEqual(len(results), 5) + self.assertEqual(len(results), 6) diff --git a/web/tests/projects/dynamic/main.c_clang-tidy_0212cbc2c7194b7a5d431a18ff51bb1c.plist b/web/tests/projects/dynamic/main.c_clang-tidy_0212cbc2c7194b7a5d431a18ff51bb1c.plist index 20ec7d713f..b5b98f2682 100644 --- a/web/tests/projects/dynamic/main.c_clang-tidy_0212cbc2c7194b7a5d431a18ff51bb1c.plist +++ b/web/tests/projects/dynamic/main.c_clang-tidy_0212cbc2c7194b7a5d431a18ff51bb1c.plist @@ -52,6 +52,58 @@ + + + category + bugprone + check_name + bugprone-sizeof-expression + description + suspicious usage of 'sizeof(K)'; did you mean 'K'? + issue_hash_content_of_line_in_context + 11111111111111111111111111111111 + report-annotation + + timestamp + 2000-01-01 09:01 + testcase + TS-1 + testcase + TC-1 + + location + + col + 3 + file + 0 + line + 7 + + path + + + depth + 0 + kind + event + location + + col + 3 + file + 0 + line + 7 + + message + suspicious usage of 'sizeof(K)'; did you mean 'K'? + + + + category bugprone