@@ -32,54 +32,57 @@ def __call_process(arg):
3232
3333
3434def test_assert ():
35- _ , stdout , stderr = __call_process ('assert' )
35+ exitcode , stdout , stderr = __call_process ('assert' )
3636 if sys .platform == "darwin" :
3737 assert stderr .startswith ("Assertion failed: (false), function my_assert, file test-signalhandler.cpp, line " ), stderr
3838 else :
39- assert stderr .endswith ("test-signalhandler.cpp:34 : void my_assert(): Assertion `false' failed.\n " ), stderr
39+ assert stderr .endswith ("test-signalhandler.cpp:41 : void my_assert(): Assertion `false' failed.\n " ), stderr
4040 lines = stdout .splitlines ()
4141 assert lines [0 ] == 'Internal error: cppcheck received signal SIGABRT - abort or assertion'
42- # no stacktrace of MacOs
42+ # no stacktrace of macOS
4343 if sys .platform != "darwin" :
4444 assert lines [1 ] == 'Callstack:'
4545 assert lines [2 ].endswith ('my_abort()' ), lines [2 ] # TODO: wrong function
4646 assert lines [len (lines )- 1 ] == 'Please report this to the cppcheck developers!'
47+ assert exitcode == - 6
4748
4849
4950def test_abort ():
50- _ , stdout , _ = __call_process ('abort' )
51+ exitcode , stdout , _ = __call_process ('abort' )
5152 lines = stdout .splitlines ()
5253 assert lines [0 ] == 'Internal error: cppcheck received signal SIGABRT - abort or assertion'
53- # no stacktrace on MaCos
54+ # no stacktrace on macOS
5455 if sys .platform != "darwin" :
5556 assert lines [1 ] == 'Callstack:'
5657 assert lines [2 ].endswith ('my_segv()' ), lines [2 ] # TODO: wrong function
5758 assert lines [len (lines )- 1 ] == 'Please report this to the cppcheck developers!'
59+ assert exitcode == - 6
5860
5961
6062def test_segv ():
61- _ , stdout , stderr = __call_process ('segv' )
63+ exitcode , stdout , stderr = __call_process ('segv' )
6264 assert stderr == ''
6365 lines = stdout .splitlines ()
6466 if sys .platform == "darwin" :
6567 assert lines [0 ] == 'Internal error: cppcheck received signal SIGSEGV - SEGV_MAPERR (at 0x0).'
6668 else :
6769 assert lines [0 ] == 'Internal error: cppcheck received signal SIGSEGV - SEGV_MAPERR (reading at 0x0).'
68- # no stacktrace on MacOS
70+ # no stacktrace on macOS
6971 if sys .platform != "darwin" :
7072 assert lines [1 ] == 'Callstack:'
7173 assert lines [2 ].endswith ('my_segv()' ), lines [2 ] # TODO: wrong function
7274 assert lines [len (lines )- 1 ] == 'Please report this to the cppcheck developers!'
75+ assert exitcode == - 11
7376
7477
75- # TODO: make this work
76- @pytest .mark .skip
78+ @pytest .mark .skipif (sys .platform == 'darwin' , reason = 'Cannot raise FPE on macOS' )
7779def test_fpe ():
78- _ , stdout , stderr = __call_process ('fpe' )
80+ exitcode , stdout , stderr = __call_process ('fpe' )
7981 assert stderr == ''
8082 lines = stdout .splitlines ()
81- assert lines [0 ].startswith ('Internal error: cppcheck received signal SIGFPE - FPE_FLTDIV (at 0x7f ' ), lines [0 ]
83+ assert lines [0 ].startswith ('Internal error: cppcheck received signal SIGFPE - FPE_FLTINV (at 0x ' ), lines [0 ]
8284 assert lines [0 ].endswith (').' ), lines [0 ]
8385 assert lines [1 ] == 'Callstack:'
84- assert lines [2 ].endswith ('my_fpe()' ), lines [2 ]
86+ assert lines [3 ].endswith ('my_fpe()' ), lines [2 ]
8587 assert lines [len (lines )- 1 ] == 'Please report this to the cppcheck developers!'
88+ assert exitcode == - 8
0 commit comments