6

Because of the resource exhaustion there is a need to run test cases serially, without threads (integration tests for CUDA code). Went through source code (e.g. tweaking GetThreadCount()) and trying to find other ways how to influence gmock/gtest framework to run tests serially but found no way out.

Apparently at first did not find any command line arguments that could influence it. Feel like the only way out is to create many binaries or create a script that utilizes --gtest-filter. I would not like to mess with secret synchronization primitives between test cases.

9
  • This question is unclear. Google Test does not run tests in parallel. Do you want your application code (that is being tested) to run serially, without threads? Or do you want to run many Google Tests in parallel (as in stackoverflow.com/questions/24528821/…)? If your question is the first one, there is not enough information here to answer it. Commented Nov 22, 2020 at 19:36
  • Thanks, I edited the question. Parallelism is the behavior I would like to change. Commented Nov 23, 2020 at 20:30
  • Sorry, it is still unclear. Google Test does not run tests in parallel. To run a Google Test-based executable with serial tests, just run the executable as normal. Does your application code (i.e. the code that you wrote) use parallelism through threads? Commented Nov 24, 2020 at 1:16
  • 1
    What uses threads? The GTest framework does not run tests asynchronously. (Although there are some wrinkles with Gtest Death Tests.) It sounds like your library/application code has a GPU memory leak. Gtest will run tests one after the other. If the application code (and your tests themselves) cleans up after itself, there should be no memory exhaustion. Commented May 22, 2021 at 17:47
  • 1
    @NicholasM, nevermind. Gtest says they determine the order from "a random seed calculated from the current time", but if you want parallel machine execution you must request it. See advanced.md, under the sections called "Shuffling the Tests", and "Distributing Test Functions to Multiple Machines". It's not explicitly stated, but perhaps parallel test execution is not done then even if test order is randomized by default. Commented Dec 5, 2023 at 23:40

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.