From cfa576402c42a7fe98089cfa02e6b8b64a9aef03 Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang Date: Fri, 27 Mar 2015 11:32:49 -0700 Subject: [PATCH] Make auto_sanity_test always use the db_sanity_test.cc of the newer commit. Summary: Whenever we add new tests in db_sanity_test.cc, the verification test will fail since the old version db_sanity_test.cc does not have the newly added test. This patch makes auto_sanity_test.sh always use the db_sanity_test.cc of the newer commit. As a result, a macro guard is added to allow db_sanity_test.cc to be backward compatible. Test Plan: tools/auto_sanity_check.sh Reviewers: sdong, rven, igor Reviewed By: igor Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D35997 --- tools/auto_sanity_test.sh | 22 ++++++++++++++++------ tools/db_sanity_test.cc | 2 ++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/tools/auto_sanity_test.sh b/tools/auto_sanity_test.sh index 138c855c0..bece681d2 100755 --- a/tools/auto_sanity_test.sh +++ b/tools/auto_sanity_test.sh @@ -46,6 +46,8 @@ makestuff mv db_sanity_test new_db_sanity_test echo "Creating db based on the new commit --- $commit_new" ./new_db_sanity_test $dir_new create +cp ./tools/db_sanity_test.cc $dir_new +cp ./tools/auto_sanity_test.sh $dir_new echo "=============================================================" echo "Making build $commit_old" @@ -54,28 +56,36 @@ if [ $? -ne 0 ]; then echo "[ERROR] Can't checkout $commit_old" exit 1 fi +cp -f $dir_new/db_sanity_test.cc ./tools/. +cp -f $dir_new/auto_sanity_test.sh ./tools/. makestuff mv db_sanity_test old_db_sanity_test echo "Creating db based on the old commit --- $commit_old" ./old_db_sanity_test $dir_old create echo "=============================================================" -echo "Verifying new db $dir_new using the old commit --- $commit_old" -./old_db_sanity_test $dir_new verify +echo "[Backward Compability Check]" +echo "Verifying old db $dir_old using the new commit --- $commit_new" +./new_db_sanity_test $dir_old verify if [ $? -ne 0 ]; then - echo "[ERROR] Verification of $dir_new using commit $commit_old failed." + echo "[ERROR] Backward Compability Check fails:" + echo " Verification of $dir_old using commit $commit_new failed." exit 2 fi echo "=============================================================" -echo "Verifying old db $dir_old using the new commit --- $commit_new" -./new_db_sanity_test $dir_old verify +echo "[Forward Compatibility Check]" +echo "Verifying new db $dir_new using the old commit --- $commit_old" +./old_db_sanity_test $dir_new verify if [ $? -ne 0 ]; then - echo "[ERROR] Verification of $dir_old using commit $commit_new failed." + echo "[ERROR] Forward Compability Check fails:" + echo " $dir_new using commit $commit_old failed." exit 2 fi rm old_db_sanity_test rm new_db_sanity_test +rm -rf $dir_new +rm -rf $dir_old echo "Auto sanity test passed!" diff --git a/tools/db_sanity_test.cc b/tools/db_sanity_test.cc index 0e273310b..4c5a709c9 100644 --- a/tools/db_sanity_test.cc +++ b/tools/db_sanity_test.cc @@ -142,7 +142,9 @@ class SanityTestZlibCompressionVersion2 : public SanityTest { : SanityTest(path) { options_.compression = kZlibCompression; BlockBasedTableOptions table_options; +#if ROCKSDB_MAJOR > 3 || (ROCKSDB_MAJOR == 3 && ROCKSDB_MINOR >= 10) table_options.format_version = 2; +#endif options_.table_factory.reset(NewBlockBasedTableFactory(table_options)); } virtual Options GetOptions() const override { return options_; }