[llvm-commits] [Patch Proposal] fix unittests on mingw
NAKAMURA Takumi
geek4civic at gmail.com
Mon Aug 9 10:23:06 PDT 2010
Good midnight, everyone.
Their patches make "make unittests" fine on mingw.
* r110166-unittests-RDYNAMIC.diff.txt
On cygwin/mingw, this redefines $RDYNAMIC and suppress $RPATH.
TODO: it should be detected by autoconf.
This enables exporting symbols from Executable.EXE.
(eg. unittests/JIT)
* r106620-unittests-mingw-EXPECT_DEATH.diff.txt
gtest death test aborts with a desktop dialog on Windows 7.
I had to suppress death tests on mingw.
r84355-unittests-workaround-msvcrt.diff.txt
This is workaround for PR6745 and PR7668.
http://llvm.org/bugs/show_bug.cgi?id=6745
(When the issue is resolved, we can meet failure by this patch.
Then we have to revert it.)
...oyasuminasai...Takumi
-------------- next part --------------
diff --git a/unittests/Support/raw_ostream_test.cpp b/unittests/Support/raw_ostream_test.cpp
index 2b797b4..1b280dd 100644
--- a/unittests/Support/raw_ostream_test.cpp
+++ b/unittests/Support/raw_ostream_test.cpp
@@ -66,7 +66,11 @@ TEST(raw_ostreamTest, Types_Buffered) {
EXPECT_EQ("-257257257235709", printToString(-257257257235709LL));
// Double
+#ifdef _WIN32
+ EXPECT_EQ("1.100000e+000", printToString(1.1));
+#else
EXPECT_EQ("1.100000e+00", printToString(1.1));
+#endif
// void*
EXPECT_EQ("0x0", printToString((void*) 0));
@@ -97,7 +101,11 @@ TEST(raw_ostreamTest, Types_Unbuffered) {
EXPECT_EQ("-257257257235709", printToStringUnbuffered(-257257257235709LL));
// Double
+#ifdef _WIN32
+ EXPECT_EQ("1.100000e+000", printToStringUnbuffered(1.1));
+#else
EXPECT_EQ("1.100000e+00", printToStringUnbuffered(1.1));
+#endif
// void*
EXPECT_EQ("0x0", printToStringUnbuffered((void*) 0));
-------------- next part --------------
diff --git a/utils/unittest/googletest/include/gtest/internal/gtest-port.h b/utils/unittest/googletest/include/gtest/internal/gtest-port.h
index 9683271..a77d211 100644
--- a/utils/unittest/googletest/include/gtest/internal/gtest-port.h
+++ b/utils/unittest/googletest/include/gtest/internal/gtest-port.h
@@ -488,7 +488,7 @@
// pops up a dialog window that cannot be suppressed programmatically.
#if (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
(GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \
- GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX)
+ GTEST_OS_AIX)
#define GTEST_HAS_DEATH_TEST 1
#include <vector> // NOLINT
#endif
-------------- next part --------------
diff --git a/Makefile.config.in b/Makefile.config.in
index 5ebd803..13b8723 100644
--- a/Makefile.config.in
+++ b/Makefile.config.in
@@ -209,12 +209,20 @@ LLVMCC_OPTION := @LLVMCC_OPTION@
# object files.
OBJ_ROOT := .
+ifneq (,$(filter $(HOST_OS), Cygwin MingW))
+
+RDYNAMIC := -Wl,--export-all-symbols
+
+else
+
# What to pass as rpath flag to g++
RPATH := @RPATH@
# What to pass as -rdynamic flag to g++
RDYNAMIC := @RDYNAMIC@
+endif
+
# These are options that can either be enabled here, or can be enabled on the
# make command line (ie, make ENABLE_PROFILING=1):
diff --git a/unittests/Makefile.unittest b/unittests/Makefile.unittest
index 2a701a0..29da761 100644
--- a/unittests/Makefile.unittest
+++ b/unittests/Makefile.unittest
@@ -35,9 +35,11 @@ endif
TESTLIBS = -lGoogleTest -lUnitTestMain
ifeq ($(ENABLE_SHARED), 1)
- # Add the absolute path to the dynamic library. This is ok because
- # we'll never install unittests.
- LD.Flags += $(RPATH) -Wl,$(LibDir)
+ ifneq (,$(RPATH))
+ # Add the absolute path to the dynamic library. This is ok because
+ # we'll never install unittests.
+ LD.Flags += $(RPATH) -Wl,$(LibDir)
+ endif
# Also set {DYLD,LD}_LIBRARY_PATH because OSX ignores the rpath most
# of the time.
Run.Shared := $(SHLIBPATH_VAR)="$(LibDir)$${$(SHLIBPATH_VAR):+:}$$$(SHLIBPATH_VAR)"
More information about the llvm-commits
mailing list