Skip to content

Commit c1fb2f3

Browse files
authored
feat: add more clang versions for testing (#72)
* feat: add more clang versions for testing * chore: update .clang-tidy * chore: update .clang-format and install headers * chore: update .clang-format * chore: install libc6-dev for testing * chore: continue-on-error: true * chore: update failed test results * chore: test more clang versiion * revert changes * remove unknown key AnalyzeTemporaryDtors * revert changes of test.yml
1 parent 863f282 commit c1fb2f3

File tree

5 files changed

+47
-2
lines changed

5 files changed

+47
-2
lines changed

testing/.clang-tidy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,performance-*,bugprone-*,clang-analyzer-*,mpi-*,misc-*,readability-*'
33
WarningsAsErrors: ''
44
HeaderFilterRegex: ''
5-
AnalyzeTemporaryDtors: false
65
FormatStyle: 'file'
76
CheckOptions:
87
- key: bugprone-argument-comment.CommentBoolLiterals

testing/pre-commit-config-version.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,31 @@ repos:
66
args: [--style=file, --version=16] # to load .clang-format
77
- id: clang-tidy
88
args: [--checks=.clang-tidy, --version=16] # path/to/.clang-tidy
9+
- repo: .
10+
rev: HEAD
11+
hooks:
12+
- id: clang-format
13+
args: [--style=file, --version=17]
14+
- id: clang-tidy
15+
args: [--checks=.clang-tidy, --version=17]
16+
- repo: .
17+
rev: HEAD
18+
hooks:
19+
- id: clang-format
20+
args: [--style=file, --version=18]
21+
- id: clang-tidy
22+
args: [--checks=.clang-tidy, --version=18]
23+
- repo: .
24+
rev: HEAD
25+
hooks:
26+
- id: clang-format
27+
args: [--style=file, --version=19]
28+
- id: clang-tidy
29+
args: [--checks=.clang-tidy, --version=19]
30+
- repo: .
31+
rev: HEAD
32+
hooks:
33+
- id: clang-format
34+
args: [--style=file, --version=20]
35+
- id: clang-tidy
36+
args: [--checks=.clang-tidy, --version=20]

testing/run.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ done
99

1010
failed_cases=`grep -c "Failed" result.txt`
1111

12-
if [ $failed_cases -eq 4 ]; then
12+
echo $failed_cases " cases failed."
13+
14+
if [ $failed_cases -eq 9 ]; then
1315
echo "=============================="
1416
echo "Test cpp-linter-hooks success."
1517
echo "=============================="

tests/test_clang_format.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
('args', 'expected_retval'), (
99
(['--style=Google'], (0, "")),
1010
(['--style=Google', '--version=16'], (0, "")),
11+
(['--style=Google', '--version=17'], (0, "")),
12+
(['--style=Google', '--version=18'], (0, "")),
13+
(['--style=Google', '--version=19'], (0, "")),
14+
(['--style=Google', '--version=20'], (0, "")),
1115
),
1216
)
1317
def test_run_clang_format_valid(args, expected_retval, tmp_path):
@@ -23,6 +27,10 @@ def test_run_clang_format_valid(args, expected_retval, tmp_path):
2327
('args', 'expected_retval'), (
2428
(['--style=Google',], 1),
2529
(['--style=Google', '--version=16'], 1),
30+
(['--style=Google', '--version=17'], 1),
31+
(['--style=Google', '--version=18'], 1),
32+
(['--style=Google', '--version=19'], 1),
33+
(['--style=Google', '--version=20'], 1),
2634
),
2735
)
2836
def test_run_clang_format_invalid(args, expected_retval, tmp_path):

tests/test_clang_tidy.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ def generate_compilation_database():
1616
('args', 'expected_retval'), (
1717
(['--checks="boost-*"'], 1),
1818
(['--checks="boost-*"', '--version=16'], 1),
19+
(['--checks="boost-*"', '--version=17'], 1),
20+
(['--checks="boost-*"', '--version=18'], 1),
21+
(['--checks="boost-*"', '--version=19'], 1),
22+
(['--checks="boost-*"', '--version=20'], 1),
1923
),
2024
)
2125
def test_run_clang_tidy_valid(args, expected_retval):
@@ -31,6 +35,10 @@ def test_run_clang_tidy_valid(args, expected_retval):
3135
('args', 'expected_retval'), (
3236
(['--checks="boost-*"'], 1),
3337
(['--checks="boost-*"', '--version=16'], 1),
38+
(['--checks="boost-*"', '--version=17'], 1),
39+
(['--checks="boost-*"', '--version=18'], 1),
40+
(['--checks="boost-*"', '--version=19'], 1),
41+
(['--checks="boost-*"', '--version=20'], 1),
3442
),
3543
)
3644
def test_run_clang_tidy_invalid(args, expected_retval, tmp_path):

0 commit comments

Comments
 (0)