@@ -32,7 +32,7 @@ def __call_process(arg):
32
32
33
33
34
34
def test_assert ():
35
- _ , stdout , stderr = __call_process ('assert' )
35
+ exitcode , stdout , stderr = __call_process ('assert' )
36
36
if sys .platform == "darwin" :
37
37
assert stderr .startswith ("Assertion failed: (false), function my_assert, file test-signalhandler.cpp, line " ), stderr
38
38
else :
@@ -44,21 +44,23 @@ def test_assert():
44
44
assert lines [1 ] == 'Callstack:'
45
45
assert lines [2 ].endswith ('my_abort()' ), lines [2 ] # TODO: wrong function
46
46
assert lines [len (lines )- 1 ] == 'Please report this to the cppcheck developers!'
47
+ assert exitcode == - 6
47
48
48
49
49
50
def test_abort ():
50
- _ , stdout , _ = __call_process ('abort' )
51
+ exitcode , stdout , _ = __call_process ('abort' )
51
52
lines = stdout .splitlines ()
52
53
assert lines [0 ] == 'Internal error: cppcheck received signal SIGABRT - abort or assertion'
53
54
# no stacktrace on macOS
54
55
if sys .platform != "darwin" :
55
56
assert lines [1 ] == 'Callstack:'
56
57
assert lines [2 ].endswith ('my_segv()' ), lines [2 ] # TODO: wrong function
57
58
assert lines [len (lines )- 1 ] == 'Please report this to the cppcheck developers!'
59
+ assert exitcode == - 6
58
60
59
61
60
62
def test_segv ():
61
- _ , stdout , stderr = __call_process ('segv' )
63
+ exitcode , stdout , stderr = __call_process ('segv' )
62
64
assert stderr == ''
63
65
lines = stdout .splitlines ()
64
66
if sys .platform == "darwin" :
@@ -70,15 +72,17 @@ def test_segv():
70
72
assert lines [1 ] == 'Callstack:'
71
73
assert lines [2 ].endswith ('my_segv()' ), lines [2 ] # TODO: wrong function
72
74
assert lines [len (lines )- 1 ] == 'Please report this to the cppcheck developers!'
75
+ assert exitcode == - 11
73
76
74
77
75
78
@pytest .mark .skipif (sys .platform == 'darwin' , reason = 'Cannot raise FPE on macOS' )
76
79
def test_fpe ():
77
- _ , stdout , stderr = __call_process ('fpe' )
80
+ exitcode , stdout , stderr = __call_process ('fpe' )
78
81
assert stderr == ''
79
82
lines = stdout .splitlines ()
80
83
assert lines [0 ].startswith ('Internal error: cppcheck received signal SIGFPE - FPE_FLTINV (at 0x' ), lines [0 ]
81
84
assert lines [0 ].endswith (').' ), lines [0 ]
82
85
assert lines [1 ] == 'Callstack:'
83
86
assert lines [3 ].endswith ('my_fpe()' ), lines [2 ]
84
87
assert lines [len (lines )- 1 ] == 'Please report this to the cppcheck developers!'
88
+ assert exitcode == - 8
0 commit comments