Skip to content

Commit 3e84506

Browse files
committed
test/cli/testutils.py: added environment variable TEST_CPPCHECK_INJECT_EXECUTOR to inject --executor into cppcheck execution
1 parent f465dc5 commit 3e84506

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/cli/testutils.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,21 @@ def cppcheck(args, env=None, remove_checkers_report=True, cwd=None, cppcheck_exe
8787
arg_j = '-j' + str(os.environ['TEST_CPPCHECK_INJECT_J'])
8888
args.append(arg_j)
8989

90+
if 'TEST_CPPCHECK_INJECT_EXECUTOR' in os.environ:
91+
found_jn = False
92+
found_executor = False
93+
for arg in args:
94+
if arg.startswith('-j') and arg != '-j1':
95+
found_jn = True
96+
continue
97+
if arg.startswith('--executor'):
98+
found_executor = True
99+
continue
100+
# only add '--executor' if we are actually using multiple jobs
101+
if found_jn and not found_executor:
102+
arg_executor = '--executor=' + str(os.environ['TEST_CPPCHECK_INJECT_EXECUTOR'])
103+
args.append(arg_executor)
104+
90105
logging.info(exe + ' ' + ' '.join(args))
91106
p = subprocess.Popen([exe] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env, cwd=cwd)
92107
try:

0 commit comments

Comments
 (0)