1//===-- scudo_unit_test.h ---------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "platform.h"
10
11#if SCUDO_FUCHSIA
12#include <zxtest/zxtest.h>
13using Test = ::zxtest::Test;
14#else
15#include "gtest/gtest.h"
16using Test = ::testing::Test;
17#endif
18
19// If EXPECT_DEATH isn't defined, make it a no-op.
20#ifndef EXPECT_DEATH
21// If ASSERT_DEATH is defined, make EXPECT_DEATH a wrapper to it.
22#ifdef ASSERT_DEATH
23#define EXPECT_DEATH(X, Y) ASSERT_DEATH(([&] { X; }), "")
24#else
25#define EXPECT_DEATH(X, Y) \
26 do { \
27 } while (0)
28#endif // ASSERT_DEATH
29#endif // EXPECT_DEATH
30
31// If EXPECT_STREQ isn't defined, define our own simple one.
32#ifndef EXPECT_STREQ
33#define EXPECT_STREQ(X, Y) EXPECT_EQ(strcmp(X, Y), 0)
34#endif
35
36#if SCUDO_FUCHSIA
37#define SKIP_ON_FUCHSIA(T) DISABLED_##T
38#else
39#define SKIP_ON_FUCHSIA(T) T
40#endif
41
42#if SCUDO_DEBUG
43#define SKIP_NO_DEBUG(T) T
44#else
45#define SKIP_NO_DEBUG(T) DISABLED_##T
46#endif
47
48#if SCUDO_FUCHSIA
49// The zxtest library provides a default main function that does the same thing
50// for Fuchsia builds.
51#define SCUDO_NO_TEST_MAIN
52#endif
53
54extern bool UseQuarantine;
55

source code of compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h