forked from msys2/MINGW-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0012-Fix-building-windows-client-unit-tests-with-gcc.patch
95 lines (80 loc) · 3.96 KB
/
0012-Fix-building-windows-client-unit-tests-with-gcc.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
From 5314c78598a45acf2953e6b9f4c9168e180adcf9 Mon Sep 17 00:00:00 2001
From: Jon TURNEY <[email protected]>
Date: Tue, 11 Feb 2014 23:48:28 +0000
Subject: [PATCH 12/24] Fix building windows client unit-tests with gcc
- MinGW doesn't have _CrtSetReportMode
- Trying to call PureVirtual() on a base class object give a linker error
(Presumably gcc can see that base class will be used for virtual function call,
so requires an implementation (which is prohibited because it's pure virtual)
at link time.)
XXX: crash_generatation_app manages to contain a pure virtual call without
tripping over this, so look how it does that...
Signed-off-by: Jon TURNEY <[email protected]>
---
src/client/windows/unittests/exception_handler_death_test.cc | 6 +++++-
src/client/windows/unittests/exception_handler_test.cc | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/client/windows/unittests/exception_handler_death_test.cc b/src/client/windows/unittests/exception_handler_death_test.cc
index 079ca3d..e9f605e 100644
--- a/src/client/windows/unittests/exception_handler_death_test.cc
+++ b/src/client/windows/unittests/exception_handler_death_test.cc
@@ -242,8 +242,10 @@ TEST_F(ExceptionHandlerDeathTest, InvalidParameterTest) {
ExceptionHandler handler(temp_path_, NULL, NULL, NULL,
ExceptionHandler::HANDLER_INVALID_PARAMETER);
+#ifdef _MSC_VER
// Disable the message box for assertions
_CrtSetReportMode(_CRT_ASSERT, 0);
+#endif
// Call with a bad argument. The invalid parameter will be swallowed
// and a dump will be generated, the process will exit(0).
@@ -255,7 +257,7 @@ struct PureVirtualCallBase {
PureVirtualCallBase() {
// We have to reinterpret so the linker doesn't get confused because the
// method isn't defined.
- reinterpret_cast<PureVirtualCallBase*>(this)->PureFunction();
+ reinterpret_cast<PureVirtualCallBase*>(0)->PureFunction();
}
virtual ~PureVirtualCallBase() {}
virtual void PureFunction() const = 0;
@@ -276,8 +278,10 @@ TEST_F(ExceptionHandlerDeathTest, PureVirtualCallTest) {
ExceptionHandler handler(temp_path_, NULL, NULL, NULL,
ExceptionHandler::HANDLER_PURECALL);
+#ifdef _MSC_VER
// Disable the message box for assertions
_CrtSetReportMode(_CRT_ASSERT, 0);
+#endif
// Calls a pure virtual function.
EXPECT_EXIT(DoCrashPureVirtualCall(), ::testing::ExitedWithCode(0), "");
diff --git a/src/client/windows/unittests/exception_handler_test.cc b/src/client/windows/unittests/exception_handler_test.cc
index 5527532..a482379 100644
--- a/src/client/windows/unittests/exception_handler_test.cc
+++ b/src/client/windows/unittests/exception_handler_test.cc
@@ -180,8 +180,10 @@ void ExceptionHandlerTest::DoCrashInvalidParameter() {
google_breakpad::ExceptionHandler::HANDLER_INVALID_PARAMETER,
kFullDumpType, kPipeName, NULL);
+#ifdef _MSC_VER
// Disable the message box for assertions
_CrtSetReportMode(_CRT_ASSERT, 0);
+#endif
// Although this is executing in the child process of the death test,
// if it's not true we'll still get an error rather than the crash
@@ -195,7 +197,7 @@ struct PureVirtualCallBase {
PureVirtualCallBase() {
// We have to reinterpret so the linker doesn't get confused because the
// method isn't defined.
- reinterpret_cast<PureVirtualCallBase*>(this)->PureFunction();
+ reinterpret_cast<PureVirtualCallBase*>(0)->PureFunction();
}
virtual ~PureVirtualCallBase() {}
virtual void PureFunction() const = 0;
@@ -212,8 +214,10 @@ void ExceptionHandlerTest::DoCrashPureVirtualCall() {
google_breakpad::ExceptionHandler::HANDLER_PURECALL,
kFullDumpType, kPipeName, NULL);
+#ifdef _MSC_VER
// Disable the message box for assertions
_CrtSetReportMode(_CRT_ASSERT, 0);
+#endif
// Although this is executing in the child process of the death test,
// if it's not true we'll still get an error rather than the crash
--
2.1.1