3
3
4
4
import os
5
5
import json
6
+ import sys
7
+ import pytest
6
8
from testutils import cppcheck
7
9
8
10
__script_dir = os .path .dirname (os .path .abspath (__file__ ))
@@ -111,7 +113,12 @@ def test_unused_functions_compdb_j(tmpdir):
111
113
def test_unused_functions_builddir (tmpdir ):
112
114
build_dir = os .path .join (tmpdir , 'b1' )
113
115
os .mkdir (build_dir )
114
- ret , stdout , stderr = cppcheck (['-q' , '--template=simple' , '--enable=unusedFunction' , '--inline-suppr' , '-j1' , '--cppcheck-build-dir={}' .format (build_dir ), __project_dir ])
116
+ ret , stdout , stderr = cppcheck (['-q' ,
117
+ '--template=simple' ,
118
+ '--enable=unusedFunction' ,
119
+ '--inline-suppr' ,
120
+ '--cppcheck-build-dir={}' .format (build_dir ),
121
+ __project_dir ])
115
122
assert stdout .splitlines () == []
116
123
assert stderr .splitlines () == [
117
124
"{}3.c:3:0: style: The function 'f3_3' is never used. [unusedFunction]" .format (__project_dir_sep )
@@ -120,10 +127,18 @@ def test_unused_functions_builddir(tmpdir):
120
127
121
128
122
129
# TODO: only f3_3 is unused
123
- def test_unused_functions_builddir_j (tmpdir ):
130
+ @pytest .mark .skipif (sys .platform == 'win32' , reason = 'ProcessExecutor not available on Windows' )
131
+ def test_unused_functions_builddir_j_process (tmpdir ):
124
132
build_dir = os .path .join (tmpdir , 'b1' )
125
133
os .mkdir (build_dir )
126
- ret , stdout , stderr = cppcheck (['-q' , '--template=simple' , '--enable=unusedFunction' , '--inline-suppr' , '-j2' , '--cppcheck-build-dir={}' .format (build_dir ), __project_dir ])
134
+ ret , stdout , stderr = cppcheck (['-q' ,
135
+ '--template=simple' ,
136
+ '--enable=unusedFunction' ,
137
+ '--inline-suppr' ,
138
+ '-j2' ,
139
+ '--executor=process' ,
140
+ '--cppcheck-build-dir={}' .format (build_dir ),
141
+ __project_dir ])
127
142
assert stdout .splitlines () == []
128
143
assert stderr .splitlines () == [
129
144
"{}1.c:4:0: style: The function 'f1' is never used. [unusedFunction]" .format (__project_dir_sep ),
@@ -142,8 +157,7 @@ def test_unused_functions_builddir_project(tmpdir):
142
157
'--enable=unusedFunction' ,
143
158
'--inline-suppr' ,
144
159
'--project={}' .format (os .path .join (__project_dir , 'unusedFunction.cppcheck' )),
145
- '--cppcheck-build-dir={}' .format (build_dir ),
146
- '-j1' ])
160
+ '--cppcheck-build-dir={}' .format (build_dir )])
147
161
assert stdout .splitlines () == []
148
162
assert stderr .splitlines () == [
149
163
"{}3.c:3:0: style: The function 'f3_3' is never used. [unusedFunction]" .format (__project_dir_sep )
@@ -152,7 +166,8 @@ def test_unused_functions_builddir_project(tmpdir):
152
166
153
167
154
168
# TODO: only f3_3 is unused
155
- def test_unused_functions_builddir_project_j (tmpdir ):
169
+ @pytest .mark .skipif (sys .platform == 'win32' , reason = 'ProcessExecutor not available on Windows' )
170
+ def test_unused_functions_builddir_project_j_process (tmpdir ):
156
171
build_dir = os .path .join (tmpdir , 'b1' )
157
172
os .mkdir (build_dir )
158
173
ret , stdout , stderr = cppcheck (['-q' ,
@@ -161,7 +176,8 @@ def test_unused_functions_builddir_project_j(tmpdir):
161
176
'--inline-suppr' ,
162
177
'--project={}' .format (os .path .join (__project_dir , 'unusedFunction.cppcheck' )),
163
178
'--cppcheck-build-dir={}' .format (build_dir ),
164
- '-j2' ])
179
+ '-j2' ,
180
+ '--executor=process' ])
165
181
assert stdout .splitlines () == []
166
182
assert stderr .splitlines () == [
167
183
"{}1.c:4:0: style: The function 'f1' is never used. [unusedFunction]" .format (__project_dir_sep ),
@@ -182,7 +198,6 @@ def test_unused_functions_builddir_compdb(tmpdir):
182
198
'--inline-suppr' ,
183
199
'--project={}' .format (compdb_file ),
184
200
'--cppcheck-build-dir={}' .format (build_dir ),
185
- '-j1'
186
201
])
187
202
assert stdout .splitlines () == []
188
203
assert stderr .splitlines () == [
@@ -192,7 +207,8 @@ def test_unused_functions_builddir_compdb(tmpdir):
192
207
193
208
194
209
# TODO: only f3_3 is unused
195
- def test_unused_functions_builddir_compdb_j (tmpdir ):
210
+ @pytest .mark .skipif (sys .platform == 'win32' , reason = 'ProcessExecutor not available on Windows' )
211
+ def test_unused_functions_builddir_compdb_j_process (tmpdir ):
196
212
compdb_file = __create_compdb (tmpdir , __project_dir )
197
213
build_dir = os .path .join (tmpdir , 'b1' )
198
214
os .mkdir (build_dir )
@@ -202,7 +218,8 @@ def test_unused_functions_builddir_compdb_j(tmpdir):
202
218
'--inline-suppr' ,
203
219
'--project={}' .format (compdb_file ),
204
220
'--cppcheck-build-dir={}' .format (build_dir ),
205
- '-j2'
221
+ '-j2' ,
222
+ '--executor=process'
206
223
])
207
224
assert stdout .splitlines () == []
208
225
assert stderr .splitlines () == [
0 commit comments