mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-22 09:21:57 -05:00
eabf37da29
__builtin_trap() gets compiled to a breakpoint instruction on riscv64 GCC, aarch64 GCC, and aarch64 Clang.
30 lines
615 B
C++
30 lines
615 B
C++
/*
|
|
* Copyright (c) 2021, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibTest/TestCase.h>
|
|
|
|
#include <signal.h>
|
|
#include <stdlib.h>
|
|
|
|
TEST_CASE(_abort)
|
|
{
|
|
EXPECT_CRASH("This should _abort", [] {
|
|
_abort();
|
|
return Test::Crash::Failure::DidNotCrash;
|
|
});
|
|
}
|
|
|
|
TEST_CASE(abort)
|
|
{
|
|
EXPECT_CRASH("This should abort", [] {
|
|
abort();
|
|
return Test::Crash::Failure::DidNotCrash;
|
|
});
|
|
EXPECT_CRASH_WITH_SIGNAL("This should abort with SIGABRT signal", SIGABRT, [] {
|
|
abort();
|
|
return Test::Crash::Failure::DidNotCrash;
|
|
});
|
|
}
|