Serenity Operating System
at master 34 lines 774 B view raw
1/* 2 * Copyright (c) 2021, the SerenityOS developers. 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#include <LibTest/TestCase.h> 8 9#include <signal.h> 10#include <stdlib.h> 11 12TEST_CASE(_abort) 13{ 14 EXPECT_CRASH("This should _abort", [] { 15 _abort(); 16 return Test::Crash::Failure::DidNotCrash; 17 }); 18 EXPECT_CRASH_WITH_SIGNAL("This should _abort with SIGILL signal", SIGILL, [] { 19 _abort(); 20 return Test::Crash::Failure::DidNotCrash; 21 }); 22} 23 24TEST_CASE(abort) 25{ 26 EXPECT_CRASH("This should abort", [] { 27 abort(); 28 return Test::Crash::Failure::DidNotCrash; 29 }); 30 EXPECT_CRASH_WITH_SIGNAL("This should abort with SIGABRT signal", SIGABRT, [] { 31 abort(); 32 return Test::Crash::Failure::DidNotCrash; 33 }); 34}