test/hotspot/gtest/unittest.hpp
changeset 55049 4853b1ceb3d6
parent 53757 e31f39e088b7
child 55091 c58772f2dbce
--- a/test/hotspot/gtest/unittest.hpp	Mon May 27 14:34:58 2019 -0400
+++ b/test/hotspot/gtest/unittest.hpp	Mon May 27 19:46:34 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,8 +28,24 @@
 #include <stdio.h>
 
 #define GTEST_DONT_DEFINE_TEST 1
+
+// googlemock has ::testing::internal::Log function, so we need to temporary
+// undefine 'Log' from logging/log.hpp and define it back after gmock header
+// file is included. As SS compiler doesn't have push_/pop_macro pragmas and
+// log.hpp might have been already included, we have to copy-paste macro definition.
+#ifdef Log
+  #define UNDEFINED_Log
+  #undef Log
+#endif
+
+#include "gmock/gmock.h"
 #include "gtest/gtest.h"
 
+#ifdef UNDEFINED_Log
+  #define Log(...)  LogImpl<LOG_TAGS(__VA_ARGS__)> // copied from logging/log.hpp
+  #undef UNDEFINED_Log
+#endif
+
 // gtest/gtest.h includes assert.h which will define the assert macro, but hotspot has its
 // own standards incompatible assert macro that takes two parameters.
 // The workaround is to undef assert and then re-define it. The re-definition