Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
13af91fa
Commit
13af91fa
authored
May 03, 2018
by
Fabrice de Gans-Riberi
Browse files
Fix more stuff and get tests to pass
parent
96c3c422
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
14 deletions
+35
-14
googletest/include/gtest/gtest-death-test.h
googletest/include/gtest/gtest-death-test.h
+1
-1
googletest/src/gtest-death-test.cc
googletest/src/gtest-death-test.cc
+7
-7
googletest/src/gtest-port.cc
googletest/src/gtest-port.cc
+15
-1
googletest/test/gtest-death-test_test.cc
googletest/test/gtest-death-test_test.cc
+4
-3
googletest/test/gtest-options_test.cc
googletest/test/gtest-options_test.cc
+6
-0
googletest/test/gtest-port_test.cc
googletest/test/gtest-port_test.cc
+2
-2
No files found.
googletest/include/gtest/gtest-death-test.h
View file @
13af91fa
...
...
@@ -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
{
...
...
googletest/src/gtest-death-test.cc
View file @
13af91fa
...
...
@@ -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
();
...
...
googletest/src/gtest-port.cc
View file @
13af91fa
...
...
@@ -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
...
...
googletest/test/gtest-death-test_test.cc
View file @
13af91fa
...
...
@@ -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"
;
# el
se
# el
if !GTEST_OS_FUCHSIA
// Fuchsia has no unix signals.
EXPECT_EXIT
(
raise
(
SIGKILL
),
testing
::
KilledBySignal
(
SIGKILL
),
""
)
<<
"foo"
;
ASSERT_EXIT
(
raise
(
SIGUSR2
),
testing
::
KilledBySignal
(
SIGUSR2
),
""
)
<<
"bar"
;
...
...
googletest/test/gtest-options_test.cc
View file @
13af91fa
...
...
@@ -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
googletest/test/gtest-port_test.cc
View file @
13af91fa
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment