From 21905dd4a8438b3ee78fa1d806e2b363a50afb35 Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Fri, 15 Nov 2013 16:30:23 -0800 Subject: [PATCH] Start DeleteFileTest with clean plate Summary: Remove all the files from the test dir before the test. The test failed when there were some old files still in the directory, since it checks the file counts. This is what caused jenkins' test failures. It was running fine on my machine so it was hard to repro. Test Plan: 1. create an extra 000001.log file in the test directory 2. run a ./deletefile_test - test failes 3. patch ./deletefile_test with this 4. test succeeds Reviewers: haobo, dhruba Reviewed By: haobo CC: leveldb Differential Revision: https://reviews.facebook.net/D14097 --- db/deletefile_test.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/db/deletefile_test.cc b/db/deletefile_test.cc index 8048bd44f..14f0324c1 100644 --- a/db/deletefile_test.cc +++ b/db/deletefile_test.cc @@ -41,6 +41,18 @@ class DeleteFileTest { options_.WAL_size_limit_MB = 1024; // Used to test log files dbname_ = test::TmpDir() + "/deletefile_test"; options_.wal_dir = dbname_ + "/wal_files"; + + // clean up all the files that might have been there before + std::vector old_files; + env_->GetChildren(dbname_, &old_files); + for (auto file : old_files) { + env_->DeleteFile(dbname_ + "/" + file); + } + env_->GetChildren(options_.wal_dir, &old_files); + for (auto file : old_files) { + env_->DeleteFile(options_.wal_dir + "/" + file); + } + DestroyDB(dbname_, options_); numlevels_ = 7; ASSERT_OK(ReopenDB(true));