2021-12-17 16:58:55 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021, the SerenityOS developers.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <LibTest/TestCase.h>
|
|
|
|
|
2021-12-17 17:12:47 +00:00
|
|
|
#include <signal.h>
|
2021-12-17 16:58:55 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
TEST_CASE(_abort)
|
|
|
|
{
|
|
|
|
EXPECT_CRASH("This should _abort", [] {
|
|
|
|
_abort();
|
|
|
|
return Test::Crash::Failure::DidNotCrash;
|
|
|
|
});
|
2021-12-17 17:12:47 +00:00
|
|
|
EXPECT_CRASH_WITH_SIGNAL("This should _abort with SIGILL signal", SIGILL, [] {
|
|
|
|
_abort();
|
|
|
|
return Test::Crash::Failure::DidNotCrash;
|
|
|
|
});
|
2021-12-17 16:58:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_CASE(abort)
|
|
|
|
{
|
|
|
|
EXPECT_CRASH("This should abort", [] {
|
|
|
|
abort();
|
|
|
|
return Test::Crash::Failure::DidNotCrash;
|
|
|
|
});
|
2021-12-17 17:12:47 +00:00
|
|
|
EXPECT_CRASH_WITH_SIGNAL("This should abort with SIGABRT signal", SIGABRT, [] {
|
|
|
|
abort();
|
|
|
|
return Test::Crash::Failure::DidNotCrash;
|
|
|
|
});
|
2021-12-17 16:58:55 +00:00
|
|
|
}
|