| 683 | } |
| 684 | |
| 685 | Status GetTestDirectory(std::string* result) override { |
| 686 | const char* env = std::getenv("TEST_TMPDIR"); |
| 687 | if (env && env[0] != '\0') { |
| 688 | *result = env; |
| 689 | } else { |
| 690 | char buf[100]; |
| 691 | std::snprintf(buf, sizeof(buf), "/tmp/leveldbtest-%d", |
| 692 | static_cast<int>(::geteuid())); |
| 693 | *result = buf; |
| 694 | } |
| 695 | |
| 696 | // The CreateDir status is ignored because the directory may already exist. |
| 697 | CreateDir(*result); |
| 698 | |
| 699 | return Status::OK(); |
| 700 | } |
| 701 | |
| 702 | Status NewLogger(const std::string& filename, Logger** result) override { |
| 703 | int fd = ::open(filename.c_str(), |