xinguai / googletest

Automatically exported from code.google.com/p/googletest
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

close() function is not declared properly on HP-UX when using death tests #174

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compile any test case using death test asserts (eq. EXPECT_EXIT()) on 
HP-UX

What is the expected output? What do you see instead?

The following error occurs:

gtest-1.3.0/include/gtest/internal/gtest-death-test-internal.h", line 209: 
error #2020: 
          identifier "close" is undefined
        close(status_fd_);

What version of the product are you using? On what operating system?

gtest 1.3.0

uname -a
HP-UX B.11.31 U ia64 0383467329 unlimited-user license

aCC -V
aCC: HP C/aC++ B3910B A.06.22 [Nov 14 2008]

Please provide any additional information below.

The <unistd.h> should be included explicitly. The patch below solves this 
problem:

==== gtest-1.3.0/include/gtest/internal/gtest-port.h#1 - gtest-
1.3.0/include/gtest/internal/gtest-port.h ====
@@ -379,11 +382,16 @@
 #if GTEST_HAS_STD_STRING && (GTEST_OS_LINUX || \
                              GTEST_OS_MAC || \
                              GTEST_OS_CYGWIN || \
                              (GTEST_OS_WINDOWS && _MSC_VER >= 1400))
 #define GTEST_HAS_DEATH_TEST 1
 #include <vector>
 #endif

+#ifndef _MSC_VER
+#include <unistd.h>
+#endif
+
 // Determines whether to support value-parameterized tests.

 #if defined(__GNUC__) || (_MSC_VER >= 1400)

Original issue reported on code.google.com by ade...@gmail.com on 29 Jul 2009 at 2:52

GoogleCodeExporter commented 9 years ago

Original comment by zhanyong...@gmail.com on 16 Sep 2009 at 6:07

GoogleCodeExporter commented 9 years ago
I think this is fixed in 1.5.0?

Original comment by w...@google.com on 5 Jun 2010 at 6:47

GoogleCodeExporter commented 9 years ago
Seems to be. Unfortunately I cannot re-test it on HP-UX at the moment. 

Original comment by ade...@gmail.com on 5 Jun 2010 at 12:56