1 /*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the root directory of this source tree.
7 */
8
9 #include <gtest/gtest.h>
10
11 #include <executorch/runtime/platform/platform.h>
12 #include <executorch/test/utils/DeathTest.h>
13
TEST(ExecutorPalTest,UninitializedPalDeath)14 TEST(ExecutorPalTest, UninitializedPalDeath) {
15 // Check for assertion failure on debug builds.
16
17 #ifndef NDEBUG
18
19 ET_EXPECT_DEATH({ et_pal_current_ticks(); }, "");
20
21 ET_EXPECT_DEATH(
22 {
23 et_pal_emit_log_message(
24 0, et_pal_log_level_t::kFatal, "", "", 0, "", 0);
25 },
26 "");
27
28 #endif // !defined(NDEBUG)
29 }
30
31 /// Override the default weak main declaration.
main(int argc,char ** argv)32 int main(int argc, char** argv) {
33 ::testing::InitGoogleTest(&argc, argv);
34 // Purposefully do not initialize the PAL.
35 return RUN_ALL_TESTS();
36 }
37