diff options
Diffstat (limited to 'googletest')
-rw-r--r-- | googletest/include/gtest/gtest-death-test.h | 2 | ||||
-rw-r--r-- | googletest/src/gtest-death-test.cc | 14 | ||||
-rw-r--r-- | googletest/src/gtest-port.cc | 16 | ||||
-rw-r--r-- | googletest/test/gtest-death-test_test.cc | 7 | ||||
-rw-r--r-- | googletest/test/gtest-options_test.cc | 6 | ||||
-rw-r--r-- | googletest/test/gtest-port_test.cc | 4 |
6 files changed, 35 insertions, 14 deletions
diff --git a/googletest/include/gtest/gtest-death-test.h b/googletest/include/gtest/gtest-death-test.h index 6a216bc..3834292 100644 --- a/googletest/include/gtest/gtest-death-test.h +++ b/googletest/include/gtest/gtest-death-test.h @@ -198,7 +198,7 @@ class GTEST_API_ ExitedWithCode { const int exit_code_; }; -# if !GTEST_OS_WINDOWS +# if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA // Tests that an exit code describes an exit due to termination by a // given signal. class GTEST_API_ KilledBySignal { diff --git a/googletest/src/gtest-death-test.cc b/googletest/src/gtest-death-test.cc index 50c15ed..a02d810 100644 --- a/googletest/src/gtest-death-test.cc +++ b/googletest/src/gtest-death-test.cc @@ -156,7 +156,7 @@ ExitedWithCode::ExitedWithCode(int exit_code) : exit_code_(exit_code) { // ExitedWithCode function-call operator. bool ExitedWithCode::operator()(int exit_status) const { -# if GTEST_OS_WINDOWS +# if GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA return exit_status == exit_code_; @@ -167,7 +167,7 @@ bool ExitedWithCode::operator()(int exit_status) const { # endif // GTEST_OS_WINDOWS } -# if !GTEST_OS_WINDOWS +# if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA // KilledBySignal constructor. KilledBySignal::KilledBySignal(int signum) : signum_(signum) { } @@ -195,7 +195,7 @@ namespace internal { static std::string ExitSummary(int exit_code) { Message m; -# if GTEST_OS_WINDOWS +# if GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA m << "Exited with exit status " << exit_code; @@ -866,10 +866,10 @@ int FuchsiaDeathTest::Wait() { zx_status_t status_zx; zx_signals_t signals; status_zx = zx_object_wait_one( - child_process_, - ZX_PROCESS_TERMINATED, - ZX_TIME_INFINITE, - &signals); + child_process_, + ZX_PROCESS_TERMINATED, + ZX_TIME_INFINITE, + &signals); GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK); ReadAndInterpretStatusByte(); diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc index d632089..ce59586 100644 --- a/googletest/src/gtest-port.cc +++ b/googletest/src/gtest-port.cc @@ -64,6 +64,7 @@ #endif // GTEST_OS_AIX #if GTEST_OS_FUCHSIA +# include <zircon/process.h> # include <zircon/syscalls.h> #endif @@ -163,7 +164,20 @@ size_t GetThreadCount() { #elif GTEST_OS_FUCHSIA size_t GetThreadCount() { - return static_cast<size_t>(zx_system_get_num_cpus()); + int dummy_buffer; + size_t avail; + zx_status_t status = zx_object_get_info( + zx_process_self(), + ZX_INFO_PROCESS_THREADS, + &dummy_buffer, + 0, + nullptr, + &avail); + if(status == ZX_OK) { + return avail; + } else { + return 0; + } } #else diff --git a/googletest/test/gtest-death-test_test.cc b/googletest/test/gtest-death-test_test.cc index 21573c7..37261cb 100644 --- a/googletest/test/gtest-death-test_test.cc +++ b/googletest/test/gtest-death-test_test.cc @@ -200,7 +200,7 @@ int DieInDebugElse12(int* sideeffect) { return 12; } -# if GTEST_OS_WINDOWS +# if GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA // Tests the ExitedWithCode predicate. TEST(ExitStatusPredicateTest, ExitedWithCode) { @@ -272,7 +272,7 @@ TEST(ExitStatusPredicateTest, KilledBySignal) { EXPECT_FALSE(pred_kill(status_segv)); } -# endif // GTEST_OS_WINDOWS +# endif // GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA // Tests that the death test macros expand to code which may or may not // be followed by operator<<, and that in either case the complete text @@ -787,8 +787,9 @@ static void TestExitMacros() { // See http://msdn.microsoft.com/en-us/library/dwwzkt4c(VS.71).aspx. EXPECT_EXIT(raise(SIGABRT), testing::ExitedWithCode(3), "") << "b_ar"; -# else +# elif !GTEST_OS_FUCHSIA + // Fuchsia has no unix signals. EXPECT_EXIT(raise(SIGKILL), testing::KilledBySignal(SIGKILL), "") << "foo"; ASSERT_EXIT(raise(SIGUSR2), testing::KilledBySignal(SIGUSR2), "") << "bar"; diff --git a/googletest/test/gtest-options_test.cc b/googletest/test/gtest-options_test.cc index 25c9f39..10cb1df 100644 --- a/googletest/test/gtest-options_test.cc +++ b/googletest/test/gtest-options_test.cc @@ -103,6 +103,8 @@ TEST(OutputFileHelpersTest, GetCurrentExecutableName) { _strcmpi("gtest-options-ex_test", exe_str.c_str()) == 0 || _strcmpi("gtest_all_test", exe_str.c_str()) == 0 || _strcmpi("gtest_dll_test", exe_str.c_str()) == 0; +#elif GTEST_OS_FUCHSIA + const bool success = exe_str == "app"; #else // TODO(wan@google.com): remove the hard-coded "lt-" prefix when // Chandler Carruth's libtool replacement is ready. @@ -116,6 +118,8 @@ TEST(OutputFileHelpersTest, GetCurrentExecutableName) { FAIL() << "GetCurrentExecutableName() returns " << exe_str; } +#if !GTEST_OS_FUCHSIA + class XmlOutputChangeDirTest : public Test { protected: virtual void SetUp() { @@ -202,6 +206,8 @@ TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsolutePath) { #endif } +#endif // !GTEST_OS_FUCHSIA + } // namespace } // namespace internal } // namespace testing diff --git a/googletest/test/gtest-port_test.cc b/googletest/test/gtest-port_test.cc index 51956f0..3801e5e 100644 --- a/googletest/test/gtest-port_test.cc +++ b/googletest/test/gtest-port_test.cc @@ -296,7 +296,7 @@ TEST(FormatCompilerIndependentFileLocationTest, FormatsUknownFileAndLine) { EXPECT_EQ("unknown file", FormatCompilerIndependentFileLocation(NULL, -1)); } -#if GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_QNX +#if GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_QNX || GTEST_OS_FUCHSIA void* ThreadFunc(void* data) { internal::Mutex* mutex = static_cast<internal::Mutex*>(data); mutex->Lock(); @@ -340,7 +340,7 @@ TEST(GetThreadCountTest, ReturnsCorrectValue) { TEST(GetThreadCountTest, ReturnsZeroWhenUnableToCountThreads) { EXPECT_EQ(0U, GetThreadCount()); } -#endif // GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_QNX +#endif // GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_QNX || GTEST_OS_FUCHSIA TEST(GtestCheckDeathTest, DiesWithCorrectOutputOnFailure) { const bool a_false_condition = false; |