google / gtest-parallel

Run Google Test suites in parallel.
Apache License 2.0
417 stars 104 forks source link

Add an option to print task status continuously #79

Closed jay-zhuang closed 3 years ago

jay-zhuang commented 3 years ago

Seems in non-tty mode the write is buffered. If the output data is small, it won't print out until all tests are done.

pbos commented 3 years ago

Can you see if this can detect whether it's interactive or not? ls --color=auto as an example won't print color codes if it's being piped somewhere else. I'd prefer that we did the same rather than add a flag.

jay-zhuang commented 3 years ago

Can you see if this can detect whether it's interactive or not? ls --color=auto as an example won't print color codes if it's being piped somewhere else. I'd prefer that we did the same rather than add a flag.

@pbos thanks for the quick response.

The problem is in CircleCI, the current implementation prints nothing while it's running, for example: https://app.circleci.com/pipelines/github/facebook/rocksdb/3536/workflows/a3559c67-7059-4a0a-9e6e-df1d6e4597c9/jobs/31722 image

Which is the same as if a test is hang and CircleCI may timeout after 10 minutes.

With this change, it's able to print the out line by line: image

I guess CircleCI just pipe the std.output to web UI, but for the user, it's still is_a_tty() and does support color, as I can see the colored error message when it's failed: image

Sorry, what do you mean this can detect whether it's interactive or not?

pbos commented 3 years ago

I thought isatty() would cover it. Does piping gtest-parallel to cat solve the problem if you detect isatty()? I guess what I'm getting at is if there's a way to make it a non-isatty() for the CircleCI. For context, I find adding flags fairly expensive.

jay-zhuang commented 3 years ago

I thought isatty() would cover it. Does piping gtest-parallel to cat solve the problem if you detect isatty()? I guess what I'm getting at is if there's a way to make it a non-isatty() for the CircleCI. For context, I find adding flags fairly expensive.

Great, piping to cat works. The only problem now is the buffered output, it won't print out anything until it reaches the buffer size or all tests are done. Verified that adding a flush() would fix the problem. I updated the patch for that. Please take a look.

pbos commented 3 years ago

Thank you! :)