Files
android_external_libcxx/test/libcxx/debug/debug_abort.pass.cpp
Eric Fiselier cd4ab9c404 Fix test failures when using modules.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294353 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-07 21:20:31 +00:00

34 lines
805 B
C++

// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// MODULES_DEFINES: _LIBCPP_DEBUG=0
// Test that the default debug handler aborts the program.
#define _LIBCPP_DEBUG 0
#include <csignal>
#include <cstdlib>
#include <__debug>
void signal_handler(int signal)
{
if (signal == SIGABRT)
std::_Exit(EXIT_SUCCESS);
std::_Exit(EXIT_FAILURE);
}
int main()
{
if (std::signal(SIGABRT, signal_handler) != SIG_ERR)
_LIBCPP_ASSERT(false, "foo");
return EXIT_FAILURE;
}