Skip to content

Commit b046180

Browse files
committed
Add test
1 parent ab8907b commit b046180

5 files changed

Lines changed: 38 additions & 0 deletions

File tree

test/cli/inline-suppress_test.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,34 @@ def test_build_dir(tmpdir):
247247
assert stdout == ''
248248
assert ret == 0, stdout
249249

250+
def test_build_dir_threads_suppressions(tmpdir):
251+
args = [
252+
'-q',
253+
'--template=simple',
254+
'--cppcheck-build-dir={}'.format(tmpdir),
255+
'--enable=style',
256+
'--inline-suppr',
257+
'--executor=thread',
258+
'-j4',
259+
'reanalysis'
260+
]
261+
262+
ret, stdout, stderr = cppcheck(args, cwd=__script_dir)
263+
lines = stderr.splitlines()
264+
assert lines == []
265+
assert stdout == ''
266+
assert ret == 0, stdout
267+
268+
a1Path = os.path.join(tmpdir, 'd.a1')
269+
mtimeOld = os.path.getmtime(a1Path)
270+
271+
for i in range(1, 10):
272+
cppcheck(args, cwd=__script_dir)
273+
274+
mtimeNew = os.path.getmtime(a1Path)
275+
276+
assert mtimeOld == mtimeNew
277+
250278

251279
def __test_build_dir_unused_template(tmpdir, extra_args):
252280
args = [

test/cli/reanalysis/a.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
int main() {
2+
int i; // cppcheck-suppress unusedVariable
3+
}
4+

test/cli/reanalysis/b.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
int main() {}
2+

test/cli/reanalysis/c.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
int main() {}
2+

test/cli/reanalysis/d.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
int main() {}
2+

0 commit comments

Comments
 (0)