Beispiel #1
0
def test_debug_crash_segfault():
    """Verify that debug_crash crashes as intended."""
    caught = False

    def _handler(num, frame):
        """Temporary handler for segfault."""
        nonlocal caught
        caught = num == signal.SIGSEGV

    with _trapped_segv(_handler):
        # since we handle the segfault, execution will continue and run into
        # the "Segfault failed (wat.)" Exception
        with pytest.raises(Exception, match="Segfault failed"):
            utilcmds.debug_crash(typ='segfault')
        time.sleep(0.001)
    assert caught
Beispiel #2
0
def test_debug_crash_segfault():
    """Verify that debug_crash crashes as intended."""
    caught = False

    def _handler(num, frame):
        """Temporary handler for segfault."""
        nonlocal caught
        caught = num == signal.SIGSEGV

    with _trapped_segv(_handler):
        # since we handle the segfault, execution will continue and run into
        # the "Segfault failed (wat.)" Exception
        with pytest.raises(Exception, match="Segfault failed"):
            utilcmds.debug_crash(typ='segfault')
        time.sleep(0.001)
    assert caught
Beispiel #3
0
def test_debug_crash_exception():
    """Verify that debug_crash crashes as intended."""
    with pytest.raises(Exception, match="Forced crash"):
        utilcmds.debug_crash(typ='exception')
Beispiel #4
0
def test_debug_crash_exception():
    """Verify that debug_crash crashes as intended."""
    with pytest.raises(Exception, match="Forced crash"):
        utilcmds.debug_crash(typ='exception')
def test_debug_crash_exception():
    """Verify that debug_crash crashes as intended."""
    with pytest.raises(Exception) as excinfo:
        utilcmds.debug_crash(typ='exception')
    assert str(excinfo.value) == 'Forced crash'