llvm-project/libc/test/src/stdlib/abort_test.cpp
Michael Jones c73c23f2a9 [libc][NFC] Add a death test API adaptation macro
Fuchsia's zxtest has a slightly different death test definition, and
this macro makes our death test API work on Fuchsia.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D95648
2021-02-01 19:19:04 +00:00

19 lines
698 B
C++

//===-- Unittests for abort -----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "include/signal.h"
#include "include/stdlib.h"
#include "src/stdlib/abort.h"
#include "utils/UnitTest/Test.h"
TEST(LlvmLibcStdlib, abort) {
// -1 matches against any signal, which is necessary for now until
// __llvm_libc::abort() unblocks SIGABRT.
EXPECT_DEATH([] { __llvm_libc::abort(); }, WITH_SIGNAL(-1));
}