google / gtest-parallel

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

Add gtest_output support #81

Open tonka3000 opened 3 years ago

tonka3000 commented 3 years ago

This PR add support for gtest_output xml format.

gtest support --gtest_output to save files as xml. An example would be my.exe --gtest_output=xml:myfile.xml. gtest-parallel does not support this option right now, but it would be very practical to have support for it because many CI systems like e.g. GitLab CI support artifact upload to visualize the test results in a project.

How a user can use this option

I've added and --gtest_output option which is very similar to the original one.

Example: --gtest_output xml:myfile.xml

How is it implemented

I save the gtest xml file for every exectuable run in temp files and join them together after all tasks have finished. This way I get the original content of the gtest xml output which be joined together.

Greetings Michael

google-cla[bot] commented 3 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

tonka3000 commented 3 years ago

@googlebot I signed it!

JensHuthmann commented 3 years ago

The merging of the xml fails, if one of the tests crashes the test itself. Which happens for me with glog and CHECK(...). This creates a SIGABRT. The merge fails because no xml is created for that test.

philipogorman commented 2 years ago

this would be a great feature for running tests on jenkins.

tonka3000 commented 2 years ago

@JensHuthmann @pbos

I've merged the master branch and resolved the conflicts.

I also skip now files which are empty (0 bytes) when e.g. abort() is called in a test. This is not a great solution because the existence of the test is now fully hidden from the xml file, but I'm not quite sure how to handle it better. The gtest version I use (1.8.x) don't write a xml file when one of the tests send SIGABRT. Not quite sure if more recent version of gtest make a better job here.

Suggestions are welcome.

Greetings Michael

pbos commented 2 years ago

Sorry for the slow response I've been more busy than I'd like. Can we make sure this error handling is explicit (by comments and printing which tests aborted and that they're therefore not present in the xml output)?

tonka3000 commented 2 years ago

Hi @pbos ,

I will check it (hopefully in the next couple of days).

mr1sunshine commented 1 year ago

Such a helpful feature!

@tonka3000 I'm just wondering if you had a chance or if you are planning to finish a work on this PR, so it gets merged?

tonka3000 commented 1 year ago

Hey @mr1sunshine ,

never found the time to finish the PR. Work drifted to different technology and I used gtest rarely since the shift. When somebody want to finish this in the meantime, feel free.