@@ -2539,4 +2539,67 @@ def test_dump_check_config(tmp_path): # #13432
25392539 assert stderr == ''
25402540
25412541 # no dump file should have been generated
2542- assert not os .path .exists (str (test_file ) + '.dump' )
2542+ assert not os .path .exists (str (test_file ) + '.dump' )
2543+
2544+
2545+ # TODO: remove all overrides when fully fixed
2546+ def __test_inline_suppr (tmp_path , extra_args ): # #13087
2547+ test_file = tmp_path / 'test.c'
2548+ with open (test_file , 'wt' ) as f :
2549+ f .write ("""
2550+ void f() {
2551+ // cppcheck-suppress memleak
2552+ }
2553+ """ )
2554+
2555+ args = [
2556+ '-q' ,
2557+ '--template=simple' ,
2558+ '--enable=information' ,
2559+ '--inline-suppr' ,
2560+ str (test_file )
2561+ ]
2562+
2563+ args += extra_args
2564+
2565+ exitcode , stdout , stderr , = cppcheck (args )
2566+ assert exitcode == 0 , stdout
2567+ assert stdout == ''
2568+ assert stderr .splitlines () == [
2569+ '{}:4:0: information: Unmatched suppression: memleak [unmatchedSuppression]' .format (test_file )
2570+ ]
2571+
2572+
2573+ def test_inline_suppr (tmp_path ):
2574+ __test_inline_suppr (tmp_path , ['-j1' ])
2575+
2576+
2577+ def test_inline_suppr_j (tmp_path ):
2578+ __test_inline_suppr (tmp_path , ['-j2' ])
2579+
2580+
2581+ def test_inline_suppr_builddir (tmp_path ):
2582+ build_dir = tmp_path / 'b1'
2583+ os .mkdir (build_dir )
2584+ __test_inline_suppr (tmp_path , ['--cppcheck-build-dir={}' .format (build_dir ), '-j1' ])
2585+
2586+
2587+ @pytest .mark .xfail (strict = True )
2588+ def test_inline_suppr_builddir_cached (tmp_path ):
2589+ build_dir = tmp_path / 'b1'
2590+ os .mkdir (build_dir )
2591+ __test_inline_suppr (tmp_path , ['--cppcheck-build-dir={}' .format (build_dir ), '-j1' ])
2592+ __test_inline_suppr (tmp_path , ['--cppcheck-build-dir={}' .format (build_dir ), '-j1' ])
2593+
2594+
2595+ def test_inline_suppr_builddir_j (tmp_path ):
2596+ build_dir = tmp_path / 'b1'
2597+ os .mkdir (build_dir )
2598+ __test_inline_suppr (tmp_path , ['--cppcheck-build-dir={}' .format (build_dir ), '-j2' ])
2599+
2600+
2601+ def test_inline_suppr_builddir_j_cached (tmp_path ):
2602+ build_dir = tmp_path / 'b1'
2603+ os .mkdir (build_dir )
2604+ __test_inline_suppr (tmp_path , ['--cppcheck-build-dir={}' .format (build_dir ), '-j2' ])
2605+ __test_inline_suppr (tmp_path , ['--cppcheck-build-dir={}' .format (build_dir ), '-j2' ])
0 commit comments