|
| 1 | +/** |
| 2 | + * @file |
| 3 | + * @author Alexander Van Craen |
| 4 | + * @author Marcel Breyer |
| 5 | + * @copyright 2018-today The PLSSVM project - All Rights Reserved |
| 6 | + * @license This file is part of the PLSSVM project which is released under the MIT license. |
| 7 | + * See the LICENSE.md file in the project root for full license information. |
| 8 | + * |
| 9 | + * @brief Contains the googletest main function. Sets the DeathTest to "threadsafe" execution instead of "fast". |
| 10 | + */ |
| 11 | + |
| 12 | +#include "plssvm/environment.hpp" // plssvm::environment::scope_guard |
| 13 | + |
| 14 | +#include "gtest/gtest.h" // RUN_ALL_TESTS, ::testing::{InitGoogleTest, GTEST_FLAG},GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST definitions |
| 15 | + |
| 16 | +#include <cstdlib> // std::atexit |
| 17 | + |
| 18 | +// Workaround as HPX runtime not working properly with Google Test |
| 19 | +// Run the entire main function in HPX runtime |
| 20 | +#include <hpx/hpx_main.hpp> |
| 21 | + |
| 22 | +// silence GTest warnings/test errors |
| 23 | + |
| 24 | +// generic CSVM tests |
| 25 | +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GenericCSVM); |
| 26 | +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GenericCSVMKernelFunction); |
| 27 | +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GenericCSVMSolver); |
| 28 | +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GenericCSVMSolverKernelFunction); |
| 29 | +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GenericCSVMKernelFunctionClassification); |
| 30 | +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GenericCSVMSolverKernelFunctionClassification); |
| 31 | +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GenericCSVMDeathTest); |
| 32 | +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GenericCSVMSolverDeathTest); |
| 33 | +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GenericCSVMKernelFunctionDeathTest); |
| 34 | +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GenericCSVMSolverKernelFunctionDeathTest); |
| 35 | +// generic GPU CSVM tests |
| 36 | +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GenericGPUCSVM); |
| 37 | +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GenericGPUCSVMKernelFunction); |
| 38 | +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GenericGPUCSVMDeathTest); |
| 39 | +// pinned memory tests |
| 40 | +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(PinnedMemory); |
| 41 | +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(PinnedMemoryLayout); |
| 42 | +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(PinnedMemoryDeathTest); |
| 43 | +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(PinnedMemoryLayoutDeathTest); |
| 44 | +// device pointer tests |
| 45 | +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DevicePtr); |
| 46 | +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DevicePtrLayout); |
| 47 | +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DevicePtrDeathTest); |
| 48 | +// exception tests |
| 49 | +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(Exception); |
| 50 | + |
| 51 | +int main(int argc, char **argv) { |
| 52 | + ::testing::InitGoogleTest(&argc, argv); |
| 53 | + |
| 54 | + // prevent problems with fork() in the presence of multiple threads |
| 55 | + // https://github.com/google/googletest/blob/main/docs/advanced.md#death-tests-and-threads |
| 56 | + // NOTE: may reduce performance of the (death) tests |
| 57 | +#if !defined(_WIN32) |
| 58 | + ::testing::GTEST_FLAG(death_test_style) = "threadsafe"; |
| 59 | +#endif |
| 60 | + return RUN_ALL_TESTS(); |
| 61 | +} |
0 commit comments