]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/tools/auto_sanity_test.sh
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / rocksdb / tools / auto_sanity_test.sh
1 TMP_DIR="${TMPDIR:-/tmp}/rocksdb-sanity-test"
2
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"
11 else
12 commit_new=$1
13 commit_old=$2
14 fi
15
16 if [ ! -d $TMP_DIR ]; then
17 mkdir $TMP_DIR
18 fi
19 dir_new="${TMP_DIR}/${commit_new}"
20 dir_old="${TMP_DIR}/${commit_old}"
21
22 function makestuff() {
23 echo "make clean"
24 make clean > /dev/null
25 echo "make db_sanity_test -j32"
26 make db_sanity_test -j32 > /dev/null
27 if [ $? -ne 0 ]; then
28 echo "[ERROR] Failed to perform 'make db_sanity_test'"
29 exit 1
30 fi
31 }
32
33 rm -r -f $dir_new
34 rm -r -f $dir_old
35
36 echo "Running db sanity check with commits $commit_new and $commit_old."
37
38 echo "============================================================="
39 echo "Making build $commit_new"
40 git checkout $commit_new
41 if [ $? -ne 0 ]; then
42 echo "[ERROR] Can't checkout $commit_new"
43 exit 1
44 fi
45 makestuff
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
51
52 echo "============================================================="
53 echo "Making build $commit_old"
54 git checkout $commit_old
55 if [ $? -ne 0 ]; then
56 echo "[ERROR] Can't checkout $commit_old"
57 exit 1
58 fi
59 cp -f $dir_new/db_sanity_test.cc ./tools/.
60 cp -f $dir_new/auto_sanity_test.sh ./tools/.
61 makestuff
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
65
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
70 if [ $? -ne 0 ]; then
71 echo "[ERROR] Backward Compatibility Check fails:"
72 echo " Verification of $dir_old using commit $commit_new failed."
73 exit 2
74 fi
75
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
80 if [ $? -ne 0 ]; then
81 echo "[ERROR] Forward Compatibility Check fails:"
82 echo " $dir_new using commit $commit_old failed."
83 exit 2
84 fi
85
86 rm old_db_sanity_test
87 rm new_db_sanity_test
88 rm -rf $dir_new
89 rm -rf $dir_old
90
91 echo "Auto sanity test passed!"