env_test */RunMany/* tests to run individually (#6931)

Summary:
When run */RunMany/* tests individually, e.g. ChrootEnvWithDirectIO/EnvPosixTestWithParam.RunMany/0, they hang. It's because they insert to background thread pool without initializing them. Fix it.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6931

Test Plan: Run ChrootEnvWithDirectIO/EnvPosixTestWithParam.RunMany/0 by itself and see it passes.

Reviewed By: riversand963

Differential Revision: D21875603

fbshipit-source-id: 7f848174c1a660254a2b1f7e11cca5370793ba30
This commit is contained in:
sdong 2020-06-04 09:49:44 -07:00 committed by Facebook GitHub Bot
parent 2f3261831b
commit 0b45a68c59

1
env/env_test.cc vendored
View File

@ -327,6 +327,7 @@ TEST_P(EnvPosixTestWithParam, UnSchedule) {
// run in any order. The purpose of the test is unclear. // run in any order. The purpose of the test is unclear.
#ifndef OS_WIN #ifndef OS_WIN
TEST_P(EnvPosixTestWithParam, RunMany) { TEST_P(EnvPosixTestWithParam, RunMany) {
env_->SetBackgroundThreads(1, Env::LOW);
std::atomic<int> last_id(0); std::atomic<int> last_id(0);
struct CB { struct CB {