@@ -32,31 +32,43 @@ def _call_process(arg):
3232
3333def test_assert ():
3434 exitcode , stdout , stderr = _call_process ('assert' )
35- assert stderr .endswith ("test-signalhandler.cpp:32: void my_assert(): Assertion `false' failed.\n " ), stderr
35+ if sys .platform == "darwin" :
36+ assert stderr .startswith ("Assertion failed: (false), function my_assert, file test-signalhandler.cpp, line " ), stderr
37+ else :
38+ assert stderr .endswith ("test-signalhandler.cpp:32: void my_assert(): Assertion `false' failed.\n " ), stderr
3639 lines = stdout .splitlines ()
3740 assert lines [0 ] == 'Internal error: cppcheck received signal SIGABRT - abort or assertion'
38- assert lines [1 ] == 'Callstack:'
39- assert lines [2 ].endswith ('my_abort()' ), lines [2 ] # TODO: wrong function
40- assert lines [len (lines )- 1 ] == 'Please report this to the cppcheck developers!'
41+ # no stacktrace of MacOs
42+ if sys .platform != "darwin" :
43+ assert lines [1 ] == 'Callstack:'
44+ assert lines [2 ].endswith ('my_abort()' ), lines [2 ] # TODO: wrong function
45+ assert lines [len (lines )- 1 ] == 'Please report this to the cppcheck developers!'
4146
4247
4348def test_abort ():
4449 exitcode , stdout , stderr = _call_process ('abort' )
4550 lines = stdout .splitlines ()
4651 assert lines [0 ] == 'Internal error: cppcheck received signal SIGABRT - abort or assertion'
47- assert lines [1 ] == 'Callstack:'
48- assert lines [2 ].endswith ('my_segv()' ), lines [2 ] # TODO: wrong function
49- assert lines [len (lines )- 1 ] == 'Please report this to the cppcheck developers!'
52+ # no stacktrace on MaCos
53+ if sys .platform != "darwin" :
54+ assert lines [1 ] == 'Callstack:'
55+ assert lines [2 ].endswith ('my_segv()' ), lines [2 ] # TODO: wrong function
56+ assert lines [len (lines )- 1 ] == 'Please report this to the cppcheck developers!'
5057
5158
5259def test_segv ():
5360 exitcode , stdout , stderr = _call_process ('segv' )
5461 assert stderr == ''
5562 lines = stdout .splitlines ()
56- assert lines [0 ] == 'Internal error: cppcheck received signal SIGSEGV - SEGV_MAPERR (reading at 0x0).'
57- assert lines [1 ] == 'Callstack:'
58- assert lines [2 ].endswith ('my_segv()' ), lines [2 ] # TODO: wrong function
59- assert lines [len (lines )- 1 ] == 'Please report this to the cppcheck developers!'
63+ if sys .platform == "darwin" :
64+ assert lines [0 ] == 'Internal error: cppcheck received signal SIGSEGV - SEGV_MAPERR (at 0x0).'
65+ else :
66+ assert lines [0 ] == 'Internal error: cppcheck received signal SIGSEGV - SEGV_MAPERR (reading at 0x0).'
67+ # no stacktrace on MacOS
68+ if sys .platform != "darwin" :
69+ assert lines [1 ] == 'Callstack:'
70+ assert lines [2 ].endswith ('my_segv()' ), lines [2 ] # TODO: wrong function
71+ assert lines [len (lines )- 1 ] == 'Please report this to the cppcheck developers!'
6072
6173
6274# TODO: make this work
0 commit comments