| 38 | } |
| 39 | |
| 40 | int RunAllTests() { |
| 41 | const char* matcher = getenv("LEVELDB_TESTS"); |
| 42 | |
| 43 | int num = 0; |
| 44 | if (tests != nullptr) { |
| 45 | for (size_t i = 0; i < tests->size(); i++) { |
| 46 | const Test& t = (*tests)[i]; |
| 47 | if (matcher != nullptr) { |
| 48 | std::string name = t.base; |
| 49 | name.push_back('.'); |
| 50 | name.append(t.name); |
| 51 | if (strstr(name.c_str(), matcher) == nullptr) { |
| 52 | continue; |
| 53 | } |
| 54 | } |
| 55 | fprintf(stderr, "==== Test %s.%s\n", t.base, t.name); |
| 56 | (*t.func)(); |
| 57 | ++num; |
| 58 | } |
| 59 | } |
| 60 | fprintf(stderr, "==== PASSED %d tests\n", num); |
| 61 | return 0; |
| 62 | } |
| 63 | |
| 64 | std::string TmpDir() { |
| 65 | std::string dir; |