From cf3e05304fec98f70e579f4ca5b95f586b9f5a89 Mon Sep 17 00:00:00 2001 From: sdong Date: Tue, 4 Aug 2015 12:20:38 -0700 Subject: [PATCH] crash_test cleans up directory before testing if TEST_TMPDIR is set Summary: In a recent change, crash_test can put data under TEST_TMPDIR. However, the directory is not cleaned before running the test, which may cause unexpected results. Clean it. Test Plan: Run white and black box crash test against non-existing, or non-empty but not compactible DBs, and make sure it works as expected. Reviewers: kradhakrishnan, rven, yhchiang, IslamAbdelRahman Reviewed By: IslamAbdelRahman Subscribers: leveldb, dhruba Differential Revision: https://reviews.facebook.net/D43515 --- tools/db_crashtest.py | 1 + tools/db_crashtest2.py | 1 + 2 files changed, 2 insertions(+) diff --git a/tools/db_crashtest.py b/tools/db_crashtest.py index 6b352248d..6ef20ff40 100644 --- a/tools/db_crashtest.py +++ b/tools/db_crashtest.py @@ -72,6 +72,7 @@ def main(argv): dbname = tempfile.mkdtemp(prefix='rocksdb_crashtest_') else: dbname = test_tmpdir + "/rocksdb_crashtest" + shutil.rmtree(dbname, True) while time.time() < exit_time: run_had_errors = False diff --git a/tools/db_crashtest2.py b/tools/db_crashtest2.py index 931b73907..a74053ef7 100644 --- a/tools/db_crashtest2.py +++ b/tools/db_crashtest2.py @@ -77,6 +77,7 @@ def main(argv): dbname = tempfile.mkdtemp(prefix='rocksdb_crashtest2_') else: dbname = test_tmpdir + "/rocksdb_crashtest2" + shutil.rmtree(dbname, True) while time.time() < exit_time: killoption = ""