• Abseil Team's avatar
    Googletest export · 4cfd1498
    Abseil Team authored
    gtest: Add a flag to only set up/tear down test environments once when repeating
    
    Currently when running a test multiple times using `--gtest_repeat` the global
    test environment(s) are set up and torn down for each iteration of the test.
    When checking for flakes in tests that have expensive dependencies that are set
    up in the test environment (subprocesses, external dependencies, etc) this can
    become expensive.
    
    To support finding flakes in tests that fit into this category, where the setup
    phase is expensive but each test case is fast, allow callers to specify via
    `--gtest_recreate_environments_when_repeating=false` that the test environments
    should only be set up once, for the first iteration, and only torn down once, on
    the last iteration. This makes running a test with `--gtest_repeat=1000` a much
    faster and more pleasant experience.
    
    PiperOrigin-RevId: 382748942
    4cfd1498
gtest_unittest.cc 255 KB