The patch below should allow death tests on solaris.
Seems like issues 170 and 171 can be closed.
Tested with
$gcc -v
Reading specs from /usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/specs
Configured with:
/builds2/sfwnv-111a/usr/src/cmd/gcc/gcc-3.4.3/configure
--prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as
--with-ld=/usr/ccs/bin/ld --without-gnu-ld
--enable-languages=c,c++,f77,objc --enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-20050802)
$uname -a
SunOS 5.11 snv_111b i86pc i386 i86pc
-- didrik
Index: include/gtest/internal/gtest-port.h
===================================================================
--- include/gtest/internal/gtest-port.h (revision 336)
+++ include/gtest/internal/gtest-port.h (working copy)
@@ -461,7 +461,7 @@
// 3. abort() in a VC 7.1 application compiled as GUI in debug config
// pops up a dialog window that cannot be suppressed programmatically.
#if GTEST_HAS_STD_STRING && \
- (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_CYGWIN || \
+ (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
(GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || GTEST_OS_WINDOWS_MINGW)
#define GTEST_HAS_DEATH_TEST 1
#include <vector> // NOLINT
I have done 'make check' with gcc and Sun Studio.
With the four patches I sent yesterday, there's only one failure left
Traceback (most recent call last):
File "./test/gtest_output_test.py", line 282, in testOutput
self.assert_(normalized_golden == normalized_actual)
It fails since it is testing typed tests (which isn't supported).
If I enable typed tests, it still fails, since it basically depends
on a certain name mangling of types.
-- didrik
With gcc it asserts here
# We want the test to pass regardless of certain features being
# supported or not.
if CAN_GENERATE_GOLDEN_FILE:
self.assert_(golden == output)
The golden file is test/gtest_output_test_golden_lin.txt
Which is generated by gcc on linux I guess.
Running with gcc on solaris, the diff looks like this:
17c17
< [----------] 1 test from ATypedDeathTest/0, where TypeParam = i
---
> [----------] 1 test from ATypedDeathTest/0, where TypeParam = int
20c20
< [----------] 1 test from ATypedDeathTest/1, where TypeParam = d
---
> [----------] 1 test from ATypedDeathTest/1, where TypeParam = double
23c23
< [----------] 1 test from My/ATypeParamDeathTest/0, where TypeParam = i
---
> [----------] 1 test from My/ATypeParamDeathTest/0, where TypeParam = int
26c26
< [----------] 1 test from My/ATypeParamDeathTest/1, where TypeParam = d
---
.....
and some more similar diffs further down.
With Sun Studio (typed tests disabled) it asserts here:
self.assert_(normalized_golden == normalized_actual)
The diff is then (uncommented your debug code)
$diff ./test/_gtest_output_test_normalized_actual.txt
./test/_gtest_output_test_normalized_golden.txt
16a17,28
> [----------] 1 test from ATypedDeathTest/0, where TypeParam = int
> [ RUN ] ATypedDeathTest/0.ShouldRunFirst
> [ OK ] ATypedDeathTest/0.ShouldRunFirst
> [----------] 1 test from ATypedDeathTest/1, where TypeParam = double
> [ RUN ] ATypedDeathTest/1.ShouldRunFirst
> [ OK ] ATypedDeathTest/1.ShouldRunFirst
> [----------] 1 test from My/ATypeParamDeathTest/0, where TypeParam = int
> [ RUN ] My/ATypeParamDeathTest/0.ShouldRunFirst
> [ OK ] My/ATypeParamDeathTest/0.ShouldRunFirst
> [----------] 1 test from My/ATypeParamDeathTest/1, where TypeParam = double
> [ RUN ] My/ATypeParamDeathTest/1.ShouldRunFirst
> [ OK ] My/ATypeParamDeathTest/1.ShouldRunFirst
308a321,326
> [ RUN ] ExpectNonfatalFailureTest.FailsWhenStatementThrows
> (expecting a failure)
> gtest.cc:#: Failure
> Expected: 1 non-fatal failure
> Actual: 0 failures
> [ FAILED ] ExpectNonfatalFailureTest.FailsWhenStatementThrows
351a370,375
> [ RUN ] ExpectFatalFailureTest.FailsWhenStatementThrows
> (expecting a failure)
> gtest.cc:#: Failure
> Expected: 1 fatal failure
> Actual: 0 failures
> [ FAILED ] ExpectFatalFailureTest.FailsWhenStatementThrows
486a511
> [ FAILED ] ExpectNonfatalFailureTest.FailsWhenStatementThrows
490a516
> [ FAILED ] ExpectFatalFailureTest.FailsWhenStatementThrows
-- didrik
The non-test part of the code is expected to have 2 failures.
test/gtest_output_test_.cc:230: Failure
Value of: false
Actual: false
Expected: true
test/gtest_output_test_.cc:231: Failure
Value of: 3
Expected: 2
ADeathTest.
ShouldRunFirst
PassingTest.
PassingTest1
PassingTest2
FatalFailureTest.
FatalFailureInSubroutine
FatalFailureInNestedSubroutine
NonfatalFailureInSubroutine
LoggingTest.
InterleavingLoggingAndAssertions
SCOPED_TRACETest.
ObeysScopes
WorksInLoop
WorksInSubroutine
CanBeNested
CanBeRepeated
DisabledTestsWarningTest.
DISABLED_AlsoRunDisabledTestsFlagSuppressesWarning
NonFatalFailureInFixtureConstructorTest.
FailureInConstructor
FatalFailureInFixtureConstructorTest.
FailureInConstructor
NonFatalFailureInSetUpTest.
FailureInSetUp
FatalFailureInSetUpTest.
FailureInSetUp
MixedUpTestCaseTest.
FirstTestFromNamespaceFoo
SecondTestFromNamespaceFoo
ThisShouldFail
ThisShouldFailToo
MixedUpTestCaseWithSameTestNameTest.
TheSecondTestWithThisNameShouldFail
TheSecondTestWithThisNameShouldFail
TEST_F_before_TEST_in_same_test_case.
DefinedUsingTEST_F
DefinedUsingTESTAndShouldFail
TEST_before_TEST_F_in_same_test_case.
DefinedUsingTEST
DefinedUsingTEST_FAndShouldFail
ExpectNonfatalFailureTest.
CanReferenceGlobalVariables
CanReferenceLocalVariables
SucceedsWhenThereIsOneNonfatalFailure
FailsWhenThereIsNoNonfatalFailure
FailsWhenThereAreTwoNonfatalFailures
FailsWhenThereIsOneFatalFailure
FailsWhenStatementReturns
ExpectFatalFailureTest.
CanReferenceGlobalVariables
CanReferenceLocalStaticVariables
SucceedsWhenThereIsOneFatalFailure
FailsWhenThereIsNoFatalFailure
FailsWhenThereAreTwoFatalFailures
FailsWhenThereIsOneNonfatalFailure
FailsWhenStatementReturns
ExpectFailureTest.
ExpectFatalFailure
ExpectNonFatalFailure
ExpectFatalFailureOnAllThreads
ExpectNonFatalFailureOnAllThreads
Upon successful completion, the regcomp() function shall return 0. Otherwise, it shall return an integer value indicating an error as described in <regex.h>, and the content of preg is undefined.