• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef LIBPANDABASE_TEST_UTILITIES_H
17 #define LIBPANDABASE_TEST_UTILITIES_H
18 
19 #include <gtest/gtest.h>
20 
21 // Death test under qemu is not compatible with 'threadsafe' death test style flag
22 // because in this mode after process clone() test is tried to be started from the very beginning
23 // via execv() with test binary and without qemu that cause 'exec format error'
24 // NOLINTBEGIN(cppcoreguidelines-macro-usage)
25 #ifdef PANDA_QEMU_BUILD
26 #define DEATH_TEST_F(test_fixture, test_name) TEST_F(test_fixture, DISABLED_##test_name)
27 #define DEATH_TEST_P(test_fixture, test_name) TEST_P(test_fixture, DISABLED_##test_name)
28 #define DEATH_TEST(test_fixture, test_name) TEST(test_fixture, DISABLED_##test_name)
29 #else
30 #define DEATH_TEST_F(test_fixture, test_name) TEST_F(test_fixture, test_name)
31 #define DEATH_TEST_P(test_fixture, test_name) TEST_P(test_fixture, test_name)
32 #define DEATH_TEST(test_fixture, test_name) TEST(test_fixture, test_name)
33 #endif
34 // NOLINTEND(cppcoreguidelines-macro-usage)
35 #endif /* LIBPANDABASE_TEST_UTILITIES_H */