@@ -65,47 +65,36 @@ def __check_ast(tmpdir, code):
6565 assert __get_debug_section ('##AST' , stdout1 ) == __get_debug_section ('##AST' , stdout2 )
6666
6767
68- @pytest .mark .skip () # FIXME: broken when clang json support was added
6968def test_symbol_database_1 (tmpdir ):
7069 __check_symbol_database (tmpdir , 'int main(){return 0;}' )
7170
72- @pytest .mark .skip () # FIXME: broken when clang json support was added
7371def test_symbol_database_2 (tmpdir ):
7472 __check_symbol_database (tmpdir , 'struct Foo { void f(); }; void Foo::f() {}' )
7573
76- @pytest .mark .skip () # FIXME: broken when clang json support was added
7774def test_symbol_database_3 (tmpdir ):
7875 __check_symbol_database (tmpdir , 'struct Fred { int a; }; int b; void f(int c, int d) { int e; }' )
7976
80- @pytest .mark .skip () # FIXME: broken when clang json support was added
8177def test_symbol_database_4 (tmpdir ):
8278 __check_symbol_database (tmpdir , 'void f(const int x) {}' )
8379
84- @pytest .mark .skip () # FIXME: broken when clang json support was added
8580def test_symbol_database_5 (tmpdir ):
8681 __check_symbol_database (tmpdir , 'void f(int);' )
8782
88- @pytest .mark .skip () # FIXME: broken when clang json support was added
8983def test_symbol_database_6 (tmpdir ):
9084 __check_symbol_database (tmpdir , 'inline static int foo(int x) { return x; }' )
9185
92- @pytest .mark .skip () # FIXME: broken when clang json support was added
9386def test_symbol_database_7 (tmpdir ):
9487 __check_symbol_database (tmpdir , 'struct S {int x;}; void f(struct S *s) {}' )
9588
96- @pytest .mark .skip () # FIXME: broken when clang json support was added
9789def test_symbol_database_class_access_1 (tmpdir ):
9890 __check_symbol_database (tmpdir , 'class Fred { void foo ( ) {} } ;' )
9991
100- @pytest .mark .skip () # FIXME: broken when clang json support was added
10192def test_symbol_database_class_access_2 (tmpdir ):
10293 __check_symbol_database (tmpdir , 'class Fred { protected: void foo ( ) {} } ;' )
10394
104- @pytest .mark .skip () # FIXME: broken when clang json support was added
10595def test_symbol_database_class_access_3 (tmpdir ):
10696 __check_symbol_database (tmpdir , 'class Fred { public: void foo ( ) {} } ;' )
10797
108- @pytest .mark .skip () # FIXME: broken when clang json support was added
10998def test_symbol_database_operator (tmpdir ):
11099 __check_symbol_database (tmpdir , 'struct Fred { void operator=(int x); };' )
111100
@@ -173,106 +162,88 @@ def __test_cmd(tmp_path, file_name, extra_args, stdout_exp_1, content=''):
173162 assert stderr == ''
174163 assert stdout .splitlines () == [
175164 'Checking {} ...' .format (file_name ),
176- 'clang -fsyntax-only -Xclang -ast-dump -fno-color-diagnostics {}{}' .format (stdout_exp_1 , file_name )
165+ 'clang -fsyntax-only -Xclang -ast-dump=json -fno-color-diagnostics {}{}' .format (stdout_exp_1 , file_name )
177166 ]
178167
179168
180- @pytest .mark .skip () # FIXME: broken when clang json support was added
181169def test_cmd_c (tmp_path ):
182170 __test_cmd (tmp_path , 'test.c' , [], '-x c' )
183171
184172
185- @pytest .mark .skip () # FIXME: broken when clang json support was added
186173def test_cmd_cpp (tmp_path ):
187174 __test_cmd (tmp_path , 'test.cpp' , [], '-x c++' )
188175
189176
190177# files with unknown extensions are treated as C++
191- @pytest .mark .skip () # FIXME: broken when clang json support was added
192178def test_cmd_unk (tmp_path ):
193179 __test_cmd (tmp_path , 'test.cplusplus' , [], '-x c++' )
194180
195181
196182# headers are treated as C by default
197- @pytest .mark .skip () # FIXME: broken when clang json support was added
198183def test_cmd_hdr (tmp_path ):
199184 __test_cmd (tmp_path , 'test.h' , [], '-x c' )
200185
201186
202- @pytest .mark .skip () # FIXME: broken when clang json support was added
203187def test_cmd_hdr_probe (tmp_path ):
204188 __test_cmd (tmp_path , 'test.h' , ['--cpp-header-probe' ], '-x c++' , '// -*- C++ -*-' )
205189
206190
207- @pytest .mark .skip () # FIXME: broken when clang json support was added
208191def test_cmd_inc (tmp_path ):
209192 inc_path = tmp_path / 'inc'
210193 os .makedirs (inc_path )
211194 __test_cmd (tmp_path , 'test.cpp' ,['-Iinc' ], '-x c++ -Iinc/' )
212195
213196
214- @pytest .mark .skip () # FIXME: broken when clang json support was added
215197def test_cmd_def (tmp_path ):
216198 __test_cmd (tmp_path , 'test.cpp' ,['-DDEF' ], '-x c++ -DDEF=1' )
217199
218200
219- @pytest .mark .skip () # FIXME: broken when clang json support was added
220201def test_cmd_include (tmp_path ):
221202 inc_file = tmp_path / 'inc.h'
222203 with open (inc_file , 'wt' ):
223204 pass
224205 __test_cmd (tmp_path , 'test.cpp' ,['--include=inc.h' ], '-x c++ --include inc.h' )
225206
226207
227- @pytest .mark .skip () # FIXME: broken when clang json support was added
228208def test_cmd_enforce_c (tmp_path ): # #13128
229209 __test_cmd (tmp_path , 'test.cpp' ,['-x' , 'c' ], '-x c' )
230210
231211
232- @pytest .mark .skip () # FIXME: broken when clang json support was added
233212def test_cmd_enforce_cpp (tmp_path ): # #13128
234213 __test_cmd (tmp_path , 'test.c' ,['-x' , 'c++' ], '-x c++' )
235214
236215
237- @pytest .mark .skip () # FIXME: broken when clang json support was added
238216def test_cmd_std_c (tmp_path ): # #13129
239217 __test_cmd (tmp_path , 'test.cpp' ,['--std=c89' , '--std=c++14' ], '-x c++ -std=c++14' )
240218
241219
242220# TODO: remove when we inject the build-dir into all tests
243- @pytest .mark .skip () # FIXME: broken when clang json support was added
244221def test_cmd_std_c_builddir (tmp_path ): # #13129
245222 build_dir = tmp_path / 'b1'
246223 os .makedirs (build_dir )
247224 __test_cmd (tmp_path , 'test.cpp' ,['--std=c89' , '--std=c++14' , '--cppcheck-build-dir={}' .format (build_dir )], '-x c++ -std=c++14' )
248225
249226
250- @pytest .mark .skip () # FIXME: broken when clang json support was added
251227def test_cmd_std_cpp (tmp_path ): # #13129
252228 __test_cmd (tmp_path , 'test.c' ,['--std=c89' , '--std=c++14' ], '-x c -std=c89' )
253229
254230
255- @pytest .mark .skip () # FIXME: broken when clang json support was added
256231def test_cmd_std_c_enforce (tmp_path ): # #13128/#13129
257232 __test_cmd (tmp_path , 'test.cpp' ,['--language=c' , '--std=c89' , '--std=c++14' ], '-x c -std=c89' )
258233
259234
260- @pytest .mark .skip () # FIXME: broken when clang json support was added
261235def test_cmd_std_cpp_enforce (tmp_path ): # #13128/#13129
262236 __test_cmd (tmp_path , 'test.c' ,['--language=c++' , '--std=c89' , '--std=c++14' ], '-x c++ -std=c++14' )
263237
264238
265- @pytest .mark .skip () # FIXME: broken when clang json support was added
266239def test_cmd_std_c_enforce_alias (tmp_path ): # #13128/#13129/#13130
267240 __test_cmd (tmp_path , 'test.c' ,['--language=c' , '--std=gnu99' , '--std=gnu++11' ], '-x c -std=gnu99' )
268241
269242
270- @pytest .mark .skip () # FIXME: broken when clang json support was added
271243def test_cmd_std_c_enforce_alias_2 (tmp_path ): # #13128/#13129/#13130
272244 __test_cmd (tmp_path , 'test.c' ,['--language=c' , '--std=iso9899:1999' , '--std=gnu++11' ], '-x c -std=iso9899:1999' )
273245
274246
275- @pytest .mark .skip () # FIXME: broken when clang json support was added
276247def test_cmd_std_cpp_enforce_alias (tmp_path ): # #13128/#13129/#13130
277248 __test_cmd (tmp_path , 'test.c' ,['--language=c++' , '--std=gnu99' , '--std=gnu++11' ], '-x c++ -std=gnu++11' )
278249
@@ -300,7 +271,6 @@ def test_debug_clang_output(tmp_path):
300271 assert stdout .find (str (test_file )) != - 1 , stdout
301272
302273
303- @pytest .mark .skip () # FIXME: broken when clang json support was added
304274def test_debug_clang_output_failure_exitcode (tmp_path ):
305275 # the given code will cause clang to fail with an exitcode
306276 #
@@ -332,6 +302,6 @@ def test_debug_clang_output_failure_exitcode(tmp_path):
332302 stderr_lines = stderr .splitlines ()
333303 assert len (stderr_lines ) > 5 , stderr_lines
334304 assert (stderr_lines [0 ] ==
335- "Failed to execute 'clang -fsyntax-only -Xclang -ast-dump -fno-color-diagnostics -x c {} 2>&1' - (exitcode: 1 / output: {}:3:12: error: indirection requires pointer operand ('int' invalid)" .format (test_file , test_file ))
305+ "Failed to execute 'clang -fsyntax-only -Xclang -ast-dump=json -fno-color-diagnostics -x c {} 2>&1' - (exitcode: 1 / output: {}:3:12: error: indirection requires pointer operand ('int' invalid)" .format (test_file , test_file ))
336306 assert stdout .find ('TranslationUnitDecl' ) != - 1 , stdout
337307 assert stdout .find (str (test_file )) != - 1 , stdout
0 commit comments