From 92b6446da1211ad02571161849f4855134aca1a5 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Thu, 12 Jan 2023 13:28:42 -0800 Subject: UnitTests: Add custom main that calls RegisterMsgAlertHandler This prevents a failed assertion from hanging on the MSVC buildbots. --- Source/UnitTests/UnitTestsMain.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Source/UnitTests/UnitTestsMain.cpp (limited to 'Source/UnitTests/UnitTestsMain.cpp') diff --git a/Source/UnitTests/UnitTestsMain.cpp b/Source/UnitTests/UnitTestsMain.cpp new file mode 100644 index 0000000000..aa4df43f48 --- /dev/null +++ b/Source/UnitTests/UnitTestsMain.cpp @@ -0,0 +1,30 @@ +// Copyright 2023 Dolphin Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later +// Based on gtest_main.cc + +#include +#include + +#include "Common/MsgHandler.h" + +#include "gtest/gtest.h" + +namespace +{ +bool TestMsgHandler(const char* caption, const char* text, bool yes_no, Common::MsgType style) +{ + fmt::print(stderr, "{}\n", text); + ADD_FAILURE(); + // Return yes to any question (we don't need Dolphin to break on asserts) + return true; +} +} // namespace + +int main(int argc, char** argv) +{ + fmt::print(stderr, "Running main() from UnitTestsMain.cpp\n"); + Common::RegisterMsgAlertHandler(TestMsgHandler); + + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} -- cgit v1.2.3