From 3ce091fd7332db5051b4a836b92edae6e0b90b7c Mon Sep 17 00:00:00 2001 From: Islam AbdelRahman Date: Tue, 17 Jan 2017 13:38:40 -0800 Subject: [PATCH] Add KEEP_DB env var option Summary: When debugging tests, it's useful to preserve the DB to investigate it and check the logs This will allow us to set KEEP_DB=1 to preserve the DB Closes https://github.com/facebook/rocksdb/pull/1759 Differential Revision: D4393826 Pulled By: IslamAbdelRahman fbshipit-source-id: 1bff689 --- db/db_test_util.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/db/db_test_util.cc b/db/db_test_util.cc index 23a495e33..e33c1c0e8 100644 --- a/db/db_test_util.cc +++ b/db/db_test_util.cc @@ -72,7 +72,12 @@ DBTestBase::~DBTestBase() { options.db_paths.emplace_back(dbname_ + "_2", 0); options.db_paths.emplace_back(dbname_ + "_3", 0); options.db_paths.emplace_back(dbname_ + "_4", 0); - EXPECT_OK(DestroyDB(dbname_, options)); + + if (getenv("KEEP_DB")) { + printf("DB is still at %s\n", dbname_.c_str()); + } else { + EXPECT_OK(DestroyDB(dbname_, options)); + } delete env_; }