diff --git a/test/cli/testutils.py b/test/cli/testutils.py index 86fe66e3f44..89f3858715e 100644 --- a/test/cli/testutils.py +++ b/test/cli/testutils.py @@ -152,7 +152,10 @@ def cppcheck_ex(args, env=None, remove_checkers_report=True, cwd=None, cppcheck_ exe = cppcheck_exe if cppcheck_exe else __lookup_cppcheck_exe() assert exe is not None, 'no cppcheck binary found' - if 'TEST_CPPCHECK_INJECT_J' in os.environ: + # do not inject arguments for calls with exclusive options + has_exclusive = bool({'--doc', '--errorlist', '-h', '--help', '--version'} & set(args)) + + if not has_exclusive and ('TEST_CPPCHECK_INJECT_J' in os.environ): found_j = False for arg in args: if arg.startswith('-j'): @@ -162,7 +165,7 @@ def cppcheck_ex(args, env=None, remove_checkers_report=True, cwd=None, cppcheck_ arg_j = '-j' + str(os.environ['TEST_CPPCHECK_INJECT_J']) args.append(arg_j) - if 'TEST_CPPCHECK_INJECT_CLANG' in os.environ: + if not has_exclusive and ('TEST_CPPCHECK_INJECT_CLANG' in os.environ): found_clang = False for arg in args: if arg.startswith('--clang'): @@ -172,7 +175,7 @@ def cppcheck_ex(args, env=None, remove_checkers_report=True, cwd=None, cppcheck_ arg_clang = '--clang=' + str(os.environ['TEST_CPPCHECK_INJECT_CLANG']) args.append(arg_clang) - if 'TEST_CPPCHECK_INJECT_EXECUTOR' in os.environ: + if not has_exclusive and ('TEST_CPPCHECK_INJECT_EXECUTOR' in os.environ): found_jn = False found_executor = False for arg in args: