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
252ce9c5
Commit
252ce9c5
authored
Apr 26, 2021
by
Abseil Team
Committed by
Derek Mauro
Apr 26, 2021
Browse files
Googletest export
Fix iOS logging issues in tests PiperOrigin-RevId: 370484087
parent
11da093e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
BUILD.bazel
BUILD.bazel
+10
-0
googletest/src/gtest-port.cc
googletest/src/gtest-port.cc
+11
-1
No files found.
BUILD.bazel
View file @
252ce9c5
...
@@ -56,6 +56,12 @@ config_setting(
...
@@ -56,6 +56,12 @@ config_setting(
values
=
{
"define"
:
"absl=1"
},
values
=
{
"define"
:
"absl=1"
},
)
)
config_setting
(
name
=
"ios"
,
values
=
{
"apple_platform_type"
:
"ios"
},
visibility
=
[
":__subpackages__"
],
)
# Library that defines the FRIEND_TEST macro.
# Library that defines the FRIEND_TEST macro.
cc_library
(
cc_library
(
name
=
"gtest_prod"
,
name
=
"gtest_prod"
,
...
@@ -86,6 +92,10 @@ cc_library(
...
@@ -86,6 +92,10 @@ cc_library(
"googlemock/include/gmock/*.h"
,
"googlemock/include/gmock/*.h"
,
]),
]),
copts
=
select
({
copts
=
select
({
":ios"
:
[
"-xobjective-c++"
,
"-pthread"
,
],
":windows"
:
[],
":windows"
:
[],
"//conditions:default"
:
[
"-pthread"
],
"//conditions:default"
:
[
"-pthread"
],
}),
}),
...
...
googletest/src/gtest-port.cc
View file @
252ce9c5
...
@@ -80,6 +80,10 @@
...
@@ -80,6 +80,10 @@
# include <zircon/syscalls.h>
# include <zircon/syscalls.h>
#endif // GTEST_OS_FUCHSIA
#endif // GTEST_OS_FUCHSIA
#if GTEST_OS_IOS
#import <Foundation/Foundation.h>
#endif // GTEST_OS_IOS
#include "gtest/gtest-spi.h"
#include "gtest/gtest-spi.h"
#include "gtest/gtest-message.h"
#include "gtest/gtest-message.h"
#include "gtest/internal/gtest-internal.h"
#include "gtest/internal/gtest-internal.h"
...
@@ -1111,9 +1115,15 @@ class CapturedStream {
...
@@ -1111,9 +1115,15 @@ class CapturedStream {
// '/sdcard' and other variants cannot be relied on, as they are not
// '/sdcard' and other variants cannot be relied on, as they are not
// guaranteed to be mounted, or may have a delay in mounting.
// guaranteed to be mounted, or may have a delay in mounting.
char
name_template
[]
=
"/data/local/tmp/gtest_captured_stream.XXXXXX"
;
char
name_template
[]
=
"/data/local/tmp/gtest_captured_stream.XXXXXX"
;
# elif GTEST_OS_IOS
NSString
*
temp_path
=
[
NSTemporaryDirectory
()
stringByAppendingPathComponent:
@
"gtest_captured_stream.XXXXXX"
];
char
name_template
[
PATH_MAX
+
1
];
strncpy
(
name_template
,
[
temp_path
UTF8String
],
PATH_MAX
);
# else
# else
char
name_template
[]
=
"/tmp/captured_stream.XXXXXX"
;
char
name_template
[]
=
"/tmp/captured_stream.XXXXXX"
;
# endif
// GTEST_OS_LINUX_ANDROID
# endif
const
int
captured_fd
=
mkstemp
(
name_template
);
const
int
captured_fd
=
mkstemp
(
name_template
);
if
(
captured_fd
==
-
1
)
{
if
(
captured_fd
==
-
1
)
{
GTEST_LOG_
(
WARNING
)
GTEST_LOG_
(
WARNING
)
...
...
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