add an env var ROCKSDB_TESTS_FROM to control where to start from a list of tests
Summary: Sometimes, I got a test failure. After fixing that, I want to resume db_test from that test. ROCKSDB_TESTS_FROM is for this purpose. Test Plan: as title Reviewers: yhchiang, rven, igor, sdong Reviewed By: sdong Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D27807
This commit is contained in:
parent
e130e88bc6
commit
97451f837e
@ -41,18 +41,29 @@ bool RegisterTest(const char* base, const char* name, void (*func)()) {
|
||||
int RunAllTests() {
|
||||
port::InstallStackTraceHandler();
|
||||
|
||||
const char* matcher = getenv("ROCKSDB_TESTS");
|
||||
const char* one_matcher = getenv("ROCKSDB_TESTS");
|
||||
const char* from_matcher = getenv("ROCKSDB_TESTS_FROM");
|
||||
|
||||
int num = 0;
|
||||
bool tests_on = (one_matcher == nullptr && from_matcher == nullptr);
|
||||
if (tests != nullptr) {
|
||||
for (unsigned int i = 0; i < tests->size(); i++) {
|
||||
const Test& t = (*tests)[i];
|
||||
if (matcher != nullptr) {
|
||||
std::string name = t.base;
|
||||
name.push_back('.');
|
||||
name.append(t.name);
|
||||
if (strstr(name.c_str(), matcher) == nullptr) {
|
||||
continue;
|
||||
if (tests_on == false) {
|
||||
if (one_matcher != nullptr || from_matcher != nullptr) {
|
||||
std::string name = t.base;
|
||||
name.push_back('.');
|
||||
name.append(t.name);
|
||||
if (from_matcher != nullptr &&
|
||||
strstr(name.c_str(), from_matcher) != nullptr) {
|
||||
tests_on = true;
|
||||
}
|
||||
if (!tests_on) {
|
||||
if (one_matcher == nullptr ||
|
||||
strstr(name.c_str(), one_matcher) == nullptr) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "==== Test %s.%s\n", t.base, t.name);
|
||||
|
@ -21,9 +21,11 @@ namespace rocksdb {
|
||||
namespace test {
|
||||
|
||||
// Run some of the tests registered by the TEST() macro. If the
|
||||
// environment variable "ROCKSDB_TESTS" is not set, runs all tests.
|
||||
// Otherwise, runs only the tests whose name contains the value of
|
||||
// "ROCKSDB_TESTS" as a substring. E.g., suppose the tests are:
|
||||
// environment variable "ROCKSDB_TESTS" and "ROCKSDB_TESTS_FROM"
|
||||
// are not set, runs all tests. Otherwise, run all tests after
|
||||
// ROCKSDB_TESTS_FROM and those specified by ROCKSDB_TESTS.
|
||||
// Partial name match also works for ROCKSDB_TESTS and
|
||||
// ROCKSDB_TESTS_FROM. E.g., suppose the tests are:
|
||||
// TEST(Foo, Hello) { ... }
|
||||
// TEST(Foo, World) { ... }
|
||||
// ROCKSDB_TESTS=Hello will run the first test
|
||||
|
Loading…
Reference in New Issue
Block a user