1 TMP_DIR
="${TMPDIR:-/tmp}/rocksdb-sanity-test"
3 if [ "$#" -lt 2 ]; then
4 echo "usage: ./auto_sanity_test.sh [new_commit] [old_commit]"
5 echo "Missing either [new_commit] or [old_commit], perform sanity check with the latest and 10th latest commits."
6 recent_commits
=`git log | grep -e "^commit [a-z0-9]\+$"| head -n10 | sed -e 's/commit //g'`
7 commit_new
=`echo "$recent_commits" | head -n1`
8 commit_old
=`echo "$recent_commits" | tail -n1`
9 echo "the most recent commits are:"
10 echo "$recent_commits"
16 if [ ! -d $TMP_DIR ]; then
19 dir_new
="${TMP_DIR}/${commit_new}"
20 dir_old
="${TMP_DIR}/${commit_old}"
22 function makestuff
() {
24 make clean
> /dev
/null
25 echo "make db_sanity_test -j32"
26 make db_sanity_test
-j32 > /dev
/null
28 echo "[ERROR] Failed to perform 'make db_sanity_test'"
36 echo "Running db sanity check with commits $commit_new and $commit_old."
38 echo "============================================================="
39 echo "Making build $commit_new"
40 git checkout
$commit_new
42 echo "[ERROR] Can't checkout $commit_new"
46 mv db_sanity_test new_db_sanity_test
47 echo "Creating db based on the new commit --- $commit_new"
48 .
/new_db_sanity_test
$dir_new create
49 cp .
/tools
/db_sanity_test.cc
$dir_new
50 cp .
/tools
/auto_sanity_test.sh
$dir_new
52 echo "============================================================="
53 echo "Making build $commit_old"
54 git checkout
$commit_old
56 echo "[ERROR] Can't checkout $commit_old"
59 cp -f $dir_new/db_sanity_test.cc .
/tools
/.
60 cp -f $dir_new/auto_sanity_test.sh .
/tools
/.
62 mv db_sanity_test old_db_sanity_test
63 echo "Creating db based on the old commit --- $commit_old"
64 .
/old_db_sanity_test
$dir_old create
66 echo "============================================================="
67 echo "[Backward Compatibility Check]"
68 echo "Verifying old db $dir_old using the new commit --- $commit_new"
69 .
/new_db_sanity_test
$dir_old verify
71 echo "[ERROR] Backward Compatibility Check fails:"
72 echo " Verification of $dir_old using commit $commit_new failed."
76 echo "============================================================="
77 echo "[Forward Compatibility Check]"
78 echo "Verifying new db $dir_new using the old commit --- $commit_old"
79 .
/old_db_sanity_test
$dir_new verify
81 echo "[ERROR] Forward Compatibility Check fails:"
82 echo " $dir_new using commit $commit_old failed."
91 echo "Auto sanity test passed!"