Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
4d69b160
Commit
4d69b160
authored
Jul 19, 2015
by
kosak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GTEST_USE_OWN_FLAGFILE support
parent
e7dbfde8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
0 deletions
+14
-0
gtest-port.h
include/gtest/internal/custom/gtest-port.h
+2
-0
gtest-port.h
include/gtest/internal/gtest-port.h
+4
-0
gtest.cc
src/gtest.cc
+6
-0
gtest_unittest.cc
test/gtest_unittest.cc
+2
-0
No files found.
include/gtest/internal/custom/gtest-port.h
View file @
4d69b160
...
@@ -32,6 +32,8 @@
...
@@ -32,6 +32,8 @@
//
//
// Flag related macros:
// Flag related macros:
// GTEST_FLAG(flag_name)
// GTEST_FLAG(flag_name)
// GTEST_USE_OWN_FLAGFILE_FLAG_ - Define to 0 when the system provides its
// own flagfile flag parsing.
// GTEST_DECLARE_bool_(name)
// GTEST_DECLARE_bool_(name)
// GTEST_DECLARE_int32_(name)
// GTEST_DECLARE_int32_(name)
// GTEST_DECLARE_string_(name)
// GTEST_DECLARE_string_(name)
...
...
include/gtest/internal/gtest-port.h
View file @
4d69b160
...
@@ -2434,6 +2434,10 @@ typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseconds.
...
@@ -2434,6 +2434,10 @@ typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseconds.
# define GTEST_FLAG(name) FLAGS_gtest_##name
# define GTEST_FLAG(name) FLAGS_gtest_##name
#endif // !defined(GTEST_FLAG)
#endif // !defined(GTEST_FLAG)
#if !defined(GTEST_USE_OWN_FLAGFILE_FLAG_)
# define GTEST_USE_OWN_FLAGFILE_FLAG_ 1
#endif // !defined(GTEST_USE_OWN_FLAGFILE_FLAG_)
#if !defined(GTEST_DECLARE_bool_)
#if !defined(GTEST_DECLARE_bool_)
# define GTEST_FLAG_SAVER_ ::testing::internal::GTestFlagSaver
# define GTEST_FLAG_SAVER_ ::testing::internal::GTestFlagSaver
...
...
src/gtest.cc
View file @
4d69b160
...
@@ -296,10 +296,12 @@ GTEST_DEFINE_bool_(
...
@@ -296,10 +296,12 @@ GTEST_DEFINE_bool_(
"if exceptions are enabled or exit the program with a non-zero code "
"if exceptions are enabled or exit the program with a non-zero code "
"otherwise."
);
"otherwise."
);
#if GTEST_USE_OWN_FLAGFILE_FLAG_
GTEST_DEFINE_string_
(
GTEST_DEFINE_string_
(
flagfile
,
flagfile
,
internal
::
StringFromGTestEnv
(
"flagfile"
,
""
),
internal
::
StringFromGTestEnv
(
"flagfile"
,
""
),
"This flag specifies the flagfile to read command-line flags from."
);
"This flag specifies the flagfile to read command-line flags from."
);
#endif // GTEST_USE_OWN_FLAGFILE_FLAG_
namespace
internal
{
namespace
internal
{
...
@@ -5233,6 +5235,7 @@ bool ParseGoogleTestFlag(const char* const arg) {
...
@@ -5233,6 +5235,7 @@ bool ParseGoogleTestFlag(const char* const arg) {
&
GTEST_FLAG
(
throw_on_failure
));
&
GTEST_FLAG
(
throw_on_failure
));
}
}
#if GTEST_USE_OWN_FLAGFILE_FLAG_
void
LoadFlagsFromFile
(
const
std
::
string
&
path
)
{
void
LoadFlagsFromFile
(
const
std
::
string
&
path
)
{
FILE
*
flagfile
=
posix
::
FOpen
(
path
.
c_str
(),
"r"
);
FILE
*
flagfile
=
posix
::
FOpen
(
path
.
c_str
(),
"r"
);
if
(
!
flagfile
)
{
if
(
!
flagfile
)
{
...
@@ -5253,6 +5256,7 @@ void LoadFlagsFromFile(const std::string& path) {
...
@@ -5253,6 +5256,7 @@ void LoadFlagsFromFile(const std::string& path) {
g_help_flag
=
true
;
g_help_flag
=
true
;
}
}
}
}
#endif // GTEST_USE_OWN_FLAGFILE_FLAG_
// Parses the command line for Google Test flags, without initializing
// Parses the command line for Google Test flags, without initializing
// other parts of Google Test. The type parameter CharType can be
// other parts of Google Test. The type parameter CharType can be
...
@@ -5270,9 +5274,11 @@ void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {
...
@@ -5270,9 +5274,11 @@ void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {
bool
remove_flag
=
false
;
bool
remove_flag
=
false
;
if
(
ParseGoogleTestFlag
(
arg
))
{
if
(
ParseGoogleTestFlag
(
arg
))
{
remove_flag
=
true
;
remove_flag
=
true
;
#if GTEST_USE_OWN_FLAGFILE_FLAG_
}
else
if
(
ParseStringFlag
(
arg
,
kFlagfileFlag
,
&
GTEST_FLAG
(
flagfile
)))
{
}
else
if
(
ParseStringFlag
(
arg
,
kFlagfileFlag
,
&
GTEST_FLAG
(
flagfile
)))
{
LoadFlagsFromFile
(
GTEST_FLAG
(
flagfile
));
LoadFlagsFromFile
(
GTEST_FLAG
(
flagfile
));
remove_flag
=
true
;
remove_flag
=
true
;
#endif // GTEST_USE_OWN_FLAGFILE_FLAG_
}
else
if
(
arg_string
==
"--help"
||
arg_string
==
"-h"
||
}
else
if
(
arg_string
==
"--help"
||
arg_string
==
"-h"
||
arg_string
==
"-?"
||
arg_string
==
"/?"
||
arg_string
==
"-?"
||
arg_string
==
"/?"
||
HasGoogleTestFlagPrefix
(
arg
))
{
HasGoogleTestFlagPrefix
(
arg
))
{
...
...
test/gtest_unittest.cc
View file @
4d69b160
...
@@ -6399,6 +6399,7 @@ TEST_F(InitGoogleTestTest, WideStrings) {
...
@@ -6399,6 +6399,7 @@ TEST_F(InitGoogleTestTest, WideStrings) {
}
}
# endif // GTEST_OS_WINDOWS
# endif // GTEST_OS_WINDOWS
#if GTEST_USE_OWN_FLAGFILE_FLAG_
class
FlagfileTest
:
public
InitGoogleTestTest
{
class
FlagfileTest
:
public
InitGoogleTestTest
{
public
:
public
:
virtual
void
SetUp
()
{
virtual
void
SetUp
()
{
...
@@ -6497,6 +6498,7 @@ TEST_F(FlagfileTest, SeveralFlags) {
...
@@ -6497,6 +6498,7 @@ TEST_F(FlagfileTest, SeveralFlags) {
GTEST_TEST_PARSING_FLAGS_
(
argv
,
argv2
,
expected_flags
,
false
);
GTEST_TEST_PARSING_FLAGS_
(
argv
,
argv2
,
expected_flags
,
false
);
}
}
#endif // GTEST_USE_OWN_FLAGFILE_FLAG_
// Tests current_test_info() in UnitTest.
// Tests current_test_info() in UnitTest.
class
CurrentTestInfoTest
:
public
Test
{
class
CurrentTestInfoTest
:
public
Test
{
...
...
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