summaryrefslogtreecommitdiffstats
path: root/src/fmt/test/test-main.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/fmt/test/test-main.cc
parentInitial commit. (diff)
downloadceph-6d07fdb6bb33b1af39833b850bb6cf8af79fe293.tar.xz
ceph-6d07fdb6bb33b1af39833b850bb6cf8af79fe293.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
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.cc43
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..8db257d60
--- /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.h"
+
+#ifdef _WIN32
+# include <windows.h>
+#endif
+
+#ifdef _MSC_VER
+# include <crtdbg.h>
+#else
+# define _CrtSetReportFile(a, b)
+# define _CrtSetReportMode(a, b)
+#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
+ // 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);
+ try {
+ testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+ } catch (...) {
+ // Catch all exceptions to make Coverity happy.
+ }
+ return EXIT_FAILURE;
+}