Skip to content

Commit 17174a8

Browse files
committed
Makefile: Verify demo run for target test-suite
When running make with default target all, we run test targets testcpybuilder, testdejagnu, test-suite and testcpychecker, but none of those excercises gcc-with-cpychecker. Add a target testdemo, which runs the demo target (which excercises gcc-with-cpychecker) and verifies the output, and add testdemo to target all.
1 parent e08233f commit 17174a8

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

Makefile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,26 @@ debug: plugin
290290
demo: plugin
291291
$(INVOCATION_ENV_VARS) $(srcdir)./gcc-with-cpychecker -c $(PYTHON_INCLUDES) demo.c
292292

293+
# Run 'demo', and verify the output.
294+
testdemo: DEMO_REF=$(shell \
295+
if [ $$(./print-gcc-version) -ge 7000 ]; then \
296+
echo demo.expected.no-refcounts; \
297+
else \
298+
echo demo.expected; \
299+
fi)
300+
testdemo: plugin print-gcc-version
301+
$(MAKE) demo > demo.out 2> demo.err
302+
egrep '^demo.c:( In function |[0-9][0-9]*:[0-9][0-9]*: warning:)' \
303+
demo.err \
304+
| sed 's/:[0-9][0-9]*: warning:/:: warning:/;s/ \[enabled by default\]//' \
305+
> demo.filtered
306+
diff $(DEMO_REF) demo.filtered
307+
rm demo.out demo.err demo.filtered
308+
293309
json-examples: plugin
294310
$(INVOCATION_ENV_VARS) $(srcdir)./gcc-with-cpychecker -I/usr/include/python2.7 -c libcpychecker_html/test/example1/bug.c
295311

296-
test-suite: plugin print-gcc-version testdejagnu
312+
test-suite: plugin print-gcc-version testdejagnu testdemo
297313
$(INVOCATION_ENV_VARS) $(PYTHON) run-test-suite.py
298314

299315
show-ssa: plugin

demo.expected

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
demo.c: In function ‘socket_htons’:
2+
demo.c:36:: warning: Mismatching type in call to PyArg_ParseTuple with format code "i:htons"
3+
demo.c: In function ‘not_enough_varargs’:
4+
demo.c:46:: warning: Not enough arguments in call to PyArg_ParseTuple with format string "i"
5+
demo.c: In function ‘too_many_varargs’:
6+
demo.c:56:: warning: Too many arguments in call to PyArg_ParseTuple with format string "i"
7+
demo.c: In function ‘kwargs_example’:
8+
demo.c:68:: warning: Mismatching type in call to PyArg_ParseTupleAndKeywords with format code "(ff):kwargs_example"
9+
demo.c:68:: warning: Mismatching type in call to PyArg_ParseTupleAndKeywords with format code "(ff):kwargs_example"
10+
demo.c: In function ‘buggy_converter’:
11+
demo.c:82:: warning: Mismatching type in call to PyArg_ParseTuple with format code "O&"
12+
demo.c: In function ‘make_a_list_of_random_ints_badly’:
13+
demo.c:96:: warning: Mismatching type in call to PyArg_ParseTuple with format code "i"
14+
demo.c:104:: warning: calling PyList_Append with NULL as argument 1 (list) at demo.c:104

demo.expected.no-refcounts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
demo.c: In function ‘socket_htons’:
2+
demo.c:36:: warning: Mismatching type in call to PyArg_ParseTuple with format code "i:htons"
3+
demo.c: In function ‘not_enough_varargs’:
4+
demo.c:46:: warning: Not enough arguments in call to PyArg_ParseTuple with format string "i"
5+
demo.c: In function ‘too_many_varargs’:
6+
demo.c:56:: warning: Too many arguments in call to PyArg_ParseTuple with format string "i"
7+
demo.c: In function ‘kwargs_example’:
8+
demo.c:68:: warning: Mismatching type in call to PyArg_ParseTupleAndKeywords with format code "(ff):kwargs_example"
9+
demo.c:68:: warning: Mismatching type in call to PyArg_ParseTupleAndKeywords with format code "(ff):kwargs_example"
10+
demo.c: In function ‘buggy_converter’:
11+
demo.c:82:: warning: Mismatching type in call to PyArg_ParseTuple with format code "O&"
12+
demo.c: In function ‘make_a_list_of_random_ints_badly’:
13+
demo.c:96:: warning: Mismatching type in call to PyArg_ParseTuple with format code "i"

0 commit comments

Comments
 (0)