diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /src/fmt/test/test-main.cc | |
parent | Initial commit. (diff) | |
download | ceph-b26c4052f3542036551aa9dec9caa4226e456195.tar.xz ceph-b26c4052f3542036551aa9dec9caa4226e456195.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/fmt/test/test-main.cc')
-rw-r--r-- | src/fmt/test/test-main.cc | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/fmt/test/test-main.cc b/src/fmt/test/test-main.cc new file mode 100644 index 000000000..39d2789d3 --- /dev/null +++ b/src/fmt/test/test-main.cc @@ -0,0 +1,43 @@ +// Formatting library for C++ - test main function. +// +// Copyright (c) 2012 - present, Victor Zverovich +// All rights reserved. +// +// For the license information refer to format.h. + +#include <cstdlib> + +#include "gtest/gtest.h" + +#ifdef _WIN32 +# include <windows.h> +#endif + +#ifdef _MSC_VER +# include <crtdbg.h> +#endif + +int main(int argc, char** argv) { +#ifdef _WIN32 + // Don't display any error dialogs. This also suppresses message boxes + // on assertion failures in MinGW where _set_error_mode/CrtSetReportMode + // doesn't help. + SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | + SEM_NOOPENFILEERRORBOX); +#endif +#ifdef _MSC_VER + // Disable message boxes on assertion failures. + _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); + _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); + _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); + _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); +#endif + try { + testing::InitGoogleTest(&argc, argv); + testing::FLAGS_gtest_death_test_style = "threadsafe"; + return RUN_ALL_TESTS(); + } catch (...) { + // Catch all exceptions to make Coverity happy. + } + return EXIT_FAILURE; +} |