google / gtest-parallel

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

can i use it in my muti-threads test_cases? #82

Closed LoadLife closed 2 years ago

LoadLife commented 2 years ago

threre are some muti-threads test cases in my executable, can i use or benefit from gtest-parallel? thanks

pbos commented 2 years ago

You can use gtest-parallel so long as your binaries are ok running in parallel (don't fight for global resources, such as /tmp/fixed-name-file.log). The script starts multiple copies of the same binary and runs different test cases all in parallel (but they are not isolated from each other).

If those multi-threaded tests are using all of your machine's resources while running you may not benefit while those tests are running (may even be slower if the two tests are fighting over resources). You may still benefit if running the entire test suite if the test binary doesn't constantly keep your resources maxed out (100% on all cores or if the tests are bottle necked by disk read/write speed).

I'd try it, if you're not sharing global state between tests you shouldn't have to modify your binary so it's pretty cheap to try. If you have highly varying test-case times you may get faster times the second time you run too.

pbos commented 2 years ago

Marking this as closed but feel free to reply to it again I should see notifications from it.