specifying gtest filter in a file

940 views
Skip to first unread message

Paweł Hajdan, Jr.

unread,
Apr 15, 2015, 6:54:09 PM4/15/15
to Google C++ Testing Framework
Hello googletest,

I'm running into cases where a gtest filter would exceed command line limits. I'd like to pass the filter from a file.

Would you be OK with the idea? I think I could send a patch for this.

Paweł

Samuel Benzaquen

unread,
Apr 16, 2015, 10:30:29 AM4/16/15
to Paweł Hajdan, Jr., Google C++ Testing Framework
On Wed, Apr 15, 2015 at 6:53 PM, Paweł Hajdan, Jr. <phajd...@chromium.org> wrote:
Hello googletest,

I'm running into cases where a gtest filter would exceed command line limits. I'd like to pass the filter from a file.

Which limits?
Is the filter string too long? If so, how long?

_Sam
 

Would you be OK with the idea? I think I could send a patch for this.

Paweł

--

---
You received this message because you are subscribed to the Google Groups "Google C++ Testing Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to googletestframe...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Paweł Hajdan, Jr.

unread,
Apr 16, 2015, 10:40:12 AM4/16/15
to Samuel Benzaquen, Google C++ Testing Framework
Yes, it's the length limit.

The filter string can be arbitrarily long in my case.

I'd like not to just increase the limit, but not to have a limit (obviously file sizes are also limited, but it's not a problem).

Paweł

Samuel Benzaquen

unread,
Apr 16, 2015, 11:20:30 AM4/16/15
to Paweł Hajdan, Jr., Google C++ Testing Framework
On Thu, Apr 16, 2015 at 10:39 AM, Paweł Hajdan, Jr. <phajd...@chromium.org> wrote:
Yes, it's the length limit.

The filter string can be arbitrarily long in my case.

I'd like not to just increase the limit, but not to have a limit (obviously file sizes are also limited, but it's not a problem).

It is not a bad idea.
However, I'd rather this was implemented as a single flag to read a flag file instead of a specific flag just for the filter.
That is, there could be --gtest_flagfile=/my/config/file that would allow specifying any flag (all flags?) through this method.
_Sam
 

Dominic Hamon

unread,
Apr 16, 2015, 11:25:10 AM4/16/15
to Samuel Benzaquen, Paweł Hajdan Jr., Google C++ Testing Framework


On Apr 16, 2015 8:20 AM, "'Samuel Benzaquen' via Google C++ Testing Framework" <googletes...@googlegroups.com> wrote:
>
> On Thu, Apr 16, 2015 at 10:39 AM, Paweł Hajdan, Jr. <phajd...@chromium.org> wrote:
>>
>> Yes, it's the length limit.
>>
>> The filter string can be arbitrarily long in my case.
>>
>> I'd like not to just increase the limit, but not to have a limit (obviously file sizes are also limited, but it's not a problem).
>
>
> It is not a bad idea.
> However, I'd rather this was implemented as a single flag to read a flag file instead of a specific flag just for the filter.
> That is, there could be --gtest_flagfile=/my/config/file that would allow specifying any flag (all flags?) through this method.

There's a standardish approach that would be @configfile instead of another flag.

Paweł Hajdan, Jr.

unread,
Apr 16, 2015, 11:49:48 AM4/16/15
to Samuel Benzaquen, Google C++ Testing Framework
Sounds fine to me.

Do you have hints how to implement that with the gflags style? For example the gtest_filter flag is accessed as GTEST_FLAG(filter).

Actually it seems that gflags supports --flagfile (http://gflags.github.io/gflags/), but I'm not sure if gtest uses gflags or its own copy/modification.

I think I'd be happy to integrate upstream gflags into latest gtest - what do you think about that?

Paweł

Samuel Benzaquen

unread,
Apr 16, 2015, 12:46:40 PM4/16/15
to Paweł Hajdan, Jr., Google C++ Testing Framework
On Thu, Apr 16, 2015 at 11:49 AM, Paweł Hajdan, Jr. <phajd...@chromium.org> wrote:
Sounds fine to me.

Do you have hints how to implement that with the gflags style? For example the gtest_filter flag is accessed as GTEST_FLAG(filter).

All flags are parsed early in main().
The idea would be to read the file contents and treat them just as if they were provided in the command line.
All uses of flags would still do GTEST_FLAG(...) to access them.
 
Actually it seems that gflags supports --flagfile (http://gflags.github.io/gflags/), but I'm not sure if gtest uses gflags or its own copy/modification.

gtest has its own flag support.
You can find it at:

Paweł Hajdan, Jr.

unread,
Apr 17, 2015, 8:52:16 PM4/17/15
to Samuel Benzaquen, Google C++ Testing Framework
Uploaded https://codereview.appspot.com/226420043/ for review.

Paweł
Reply all
Reply to author
Forward
0 new messages