PATCH: add support for minix

18 views
Skip to first unread message

CvR

unread,
Jul 12, 2010, 10:01:57 AM7/12/10
to Google C++ Testing Framework
Hi,

The attached patch adds support for the Minix 3 operating system
(www.minix3.org). It #defines GTEST_OS_MINIX if compiled on a Minix
system, and uses that macro to fix two Minix 3 issues.

These patches were originally against the llvm variant of google test,
but I was asked there to submit them here.

Index: include/gtest/internal/gtest-port.h
===================================================================
--- include/gtest/internal/gtest-port.h (revision 443)
+++ include/gtest/internal/gtest-port.h (working copy)
@@ -219,10 +219,12 @@
#define GTEST_OS_SOLARIS 1
#elif defined(_AIX)
#define GTEST_OS_AIX 1
+#elif defined(__minix)
+#define GTEST_OS_MINIX 1
#endif // __CYGWIN__

#if GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC ||
GTEST_OS_SYMBIAN || \
- GTEST_OS_SOLARIS || GTEST_OS_AIX
+ GTEST_OS_SOLARIS || GTEST_OS_AIX || GTEST_OS_MINIX

// On some platforms, <regex.h> needs someone to define size_t, and
// won't compile otherwise. We can #include it here as we already
@@ -311,7 +313,9 @@
// Cygwin 1.5 and below doesn't support ::std::wstring.
// Cygwin 1.7 might add wstring support; this should be updated when
clear.
// Solaris' libc++ doesn't support it either.
-#define GTEST_HAS_STD_WSTRING (!(GTEST_OS_CYGWIN ||
GTEST_OS_SOLARIS))
+// Minix currently doesn't support it either.
+#define GTEST_HAS_STD_WSTRING (!(GTEST_OS_CYGWIN || GTEST_OS_SOLARIS
\
+ || GTEST_OS_MINIX))

#endif // GTEST_HAS_STD_WSTRING


--
Kees

Zhanyong Wan (λx.x x)

unread,
Jul 12, 2010, 4:39:52 PM7/12/10
to CvR, Google C++ Testing Framework
Thanks for contributing!

Would you mind signing a Contributor License Agreement s.t. we can use
this patch?

The instructions are at
http://code.google.com/p/googletest/wiki/GoogleTestDevGuide#Contributor_License_Agreements
- thanks!

--
Zhanyong

Vlad Losev

unread,
Jul 12, 2010, 6:27:51 PM7/12/10
to Zhanyong Wan (λx.x x), CvR, Google C++ Testing Framework
Actually, we had a number of similar OS support patches recently. Each one consists of little more than sniffing the OS and then enabling or disabling certain gtest features based on it. IMO, instead of providing cases for all those OSes we need a more general feature-based approach.

In particular for Minix/Haiku we need to create the explicit feature for POSIX regex support (GTEST_HAS_POSIX_RE), make it user-overridable, and publish it.

With this change users will be able to build gtest on OSes such as Haiku and Minix by setting CPPFLAGS="-DGTEST_HAS_POSIX_RE=1 -DGTEST_HAS_STD_WSTRING=0" in their environment or command line. In the future, even that can be automated with appropriate changes to the CMake/Autoconf build scripts.

Regards,
Vlad

2010/7/12 Zhanyong Wan (λx.x x) <w...@google.com>

Kees van Reeuwijk

unread,
Jul 14, 2010, 8:58:45 AM7/14/10
to Vlad Losev, Zhanyong Wan (λx.x x), Google C++ Testing Framework

On 13 Jul 2010, at 00:27, Vlad Losev wrote:

> Actually, we had a number of similar OS support patches recently. Each one consists of little more than sniffing the OS and then enabling or disabling certain gtest features based on it. IMO, instead of providing cases for all those OSes we need a more general feature-based approach.
>
> In particular for Minix/Haiku we need to create the explicit feature for POSIX regex support (GTEST_HAS_POSIX_RE), make it user-overridable, and publish it.
>
> With this change users will be able to build gtest on OSes such as Haiku and Minix by setting CPPFLAGS="-DGTEST_HAS_POSIX_RE=1 -DGTEST_HAS_STD_WSTRING=0" in their environment or command line. In the future, even that can be automated with appropriate changes to the CMake/Autoconf build scripts.

I would vastly prefer that solution, if only because that way I wouldn't have to sign a license agreement just to add three lines of code to your repository. :-)

A better reason is that things change: Minix may well get good enough support for wstring in the near future, and that POSIX_RE thing may also be easily solvable.

--
Dr. Ir. Kees van Reeuwijk, Vrije Universiteit Amsterdam

Vlad Losev

unread,
Jul 14, 2010, 12:03:38 PM7/14/10
to Kees van Reeuwijk, Zhanyong Wan (λx.x x), Google C++ Testing Framework


2010/7/14 Kees van Reeuwijk <reeu...@few.vu.nl>
What happens if you build gtest with only -DGTEST_HAS_STD_WSTRING=0? If  you get any build errors, can you please post them? 


--
Dr. Ir. Kees van Reeuwijk, Vrije Universiteit Amsterdam

Thanks,
Vlad

Vlad Losev

unread,
Jul 22, 2010, 5:10:11 PM7/22/10
to Kees van Reeuwijk, Zhanyong Wan (λx.x x), Google C++ Testing Framework
I have submitted a fix to SVN, in revision 448. Please let me know if it (together with -DGTEST_HAS_STD_WSTRING=0) works for you.

2010/7/14 Kees van Reeuwijk <reeu...@few.vu.nl>
Reply all
Reply to author
Forward
0 new messages