xref: /openbsd-src/gnu/llvm/compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h (revision d89ec533011f513df1010f142a111086a0785f09)
13cab2bb3Spatrick //===-- scudo_unit_test.h ---------------------------------------*- C++ -*-===//
23cab2bb3Spatrick //
33cab2bb3Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
43cab2bb3Spatrick // See https://llvm.org/LICENSE.txt for license information.
53cab2bb3Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
63cab2bb3Spatrick //
73cab2bb3Spatrick //===----------------------------------------------------------------------===//
83cab2bb3Spatrick 
93cab2bb3Spatrick #include "platform.h"
103cab2bb3Spatrick 
113cab2bb3Spatrick #if SCUDO_FUCHSIA
123cab2bb3Spatrick #include <zxtest/zxtest.h>
13*d89ec533Spatrick using Test = ::zxtest::Test;
143cab2bb3Spatrick #else
153cab2bb3Spatrick #include "gtest/gtest.h"
16*d89ec533Spatrick using Test = ::testing::Test;
173cab2bb3Spatrick #endif
183cab2bb3Spatrick 
193cab2bb3Spatrick // If EXPECT_DEATH isn't defined, make it a no-op.
203cab2bb3Spatrick #ifndef EXPECT_DEATH
21*d89ec533Spatrick // If ASSERT_DEATH is defined, make EXPECT_DEATH a wrapper to it.
22*d89ec533Spatrick #ifdef ASSERT_DEATH
23*d89ec533Spatrick #define EXPECT_DEATH(X, Y) ASSERT_DEATH(([&] { X; }), "")
24*d89ec533Spatrick #else
253cab2bb3Spatrick #define EXPECT_DEATH(X, Y)                                                     \
263cab2bb3Spatrick   do {                                                                         \
273cab2bb3Spatrick   } while (0)
28*d89ec533Spatrick #endif // ASSERT_DEATH
29*d89ec533Spatrick #endif // EXPECT_DEATH
303cab2bb3Spatrick 
313cab2bb3Spatrick // If EXPECT_STREQ isn't defined, define our own simple one.
323cab2bb3Spatrick #ifndef EXPECT_STREQ
333cab2bb3Spatrick #define EXPECT_STREQ(X, Y) EXPECT_EQ(strcmp(X, Y), 0)
343cab2bb3Spatrick #endif
353cab2bb3Spatrick 
36*d89ec533Spatrick #if SCUDO_FUCHSIA
37*d89ec533Spatrick #define SKIP_ON_FUCHSIA(T) DISABLED_##T
38*d89ec533Spatrick #else
39*d89ec533Spatrick #define SKIP_ON_FUCHSIA(T) T
40*d89ec533Spatrick #endif
41*d89ec533Spatrick 
42*d89ec533Spatrick #if SCUDO_DEBUG
43*d89ec533Spatrick #define SKIP_NO_DEBUG(T) T
44*d89ec533Spatrick #else
45*d89ec533Spatrick #define SKIP_NO_DEBUG(T) DISABLED_##T
46*d89ec533Spatrick #endif
47*d89ec533Spatrick 
483cab2bb3Spatrick extern bool UseQuarantine;
49