You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

201 lines
5.5 KiB

  1. #!/usr/bin/env bash
  2. function usage() {
  3. echo "run db-benchmark-test"
  4. echo "[--tokudb=$tokudb"
  5. echo "[--revision=$revision]"
  6. echo "[--branch=$branch]"
  7. echo "[--suffix=$suffix]"
  8. echo "[--commit=$commit]"
  9. echo "[--cc=$cc]"
  10. echo "[--n=$n]"
  11. }
  12. function retry() {
  13. local cmd
  14. local retries
  15. local exitcode
  16. cmd=$*
  17. let retries=0
  18. while [ $retries -le 10 ] ; do
  19. echo `date` $cmd
  20. bash -c "$cmd"
  21. exitcode=$?
  22. echo `date` $cmd $exitcode $retries
  23. let retries=retries+1
  24. if [ $exitcode -eq 0 ] ; then break; fi
  25. sleep 10
  26. done
  27. test $exitcode = 0
  28. }
  29. n=100
  30. cc=gcc44
  31. ft_loader=cilk
  32. branch=toku
  33. revision=0
  34. tokudb=tokudb
  35. suffix=.
  36. commit=0
  37. svnserver=https://svn.tokutek.com/tokudb
  38. basedir=$HOME/svn.build
  39. builddir=$basedir/tokudb.build
  40. system=`uname -s | tr [:upper:] [:lower:]`
  41. arch=`uname -m | tr [:upper:] [:lower:]`
  42. hostname=`hostname`
  43. instancetype=""
  44. # parse the command line
  45. while [ $# -gt 0 ] ; do
  46. arg=$1; shift
  47. if [[ $arg =~ --(.*)=(.*) ]] ; then
  48. eval ${BASH_REMATCH[1]}=${BASH_REMATCH[2]}
  49. else
  50. usage; exit 1
  51. fi
  52. done
  53. if [ $cc = icc ] ; then
  54. d=/opt/intel/bin
  55. if [ -d $d ] ; then
  56. export PATH=$d:$PATH
  57. . $d/compilervars.sh intel64
  58. fi
  59. d=/opt/intel/cilkutil/bin
  60. if [ -d $d ] ; then
  61. export PATH=$d:$PATH
  62. fi
  63. fi
  64. # require a revision
  65. if [ $revision -eq 0 ] ; then exit 1; fi
  66. if [ $branch = "." ] ; then branch="toku"; fi
  67. function append() {
  68. local s=""; local x
  69. for x in $*; do
  70. if [ "$s" != "" ] ; then s=$s-$x; else s=$x; fi
  71. done
  72. echo $s
  73. }
  74. # setup the branchrevision string
  75. branchrevision=""
  76. if [ $branch != "toku" ] ; then branchrevision=$(append $branchrevision $(basename $branch)); fi
  77. if [ $tokudb != "tokudb" ] ; then branchrevision=$(append $branchrevision $tokudb); fi
  78. branchrevision=$(append $branchrevision $revision)
  79. if [ $suffix != "." ] ; then branchrevision=$(append $branchrevision $suffix); fi
  80. # goto the base directory
  81. if [ ! -d $basedir ] ; then mkdir $basedir; fi
  82. pushd $basedir
  83. # update the build directory
  84. if [ ! -d $builddir ] ; then mkdir $builddir; fi
  85. date=`date +%Y%m%d`
  86. pushd $builddir
  87. while [ ! -d $date ] ; do
  88. svn mkdir $svnserver/mysql.build/$date -m ""
  89. svn co -q $svnserver/mysql.build/$date
  90. if [ $? -ne 0 ] ; then rm -rf $date; fi
  91. done
  92. popd
  93. testresultsdir=$builddir/$date
  94. gccversion=`$cc --version|head -1|cut -f3 -d" "`
  95. runfile=$testresultsdir/db-benchmark-test-$branchrevision-$cc-$gccversion-$system-$arch-$hostname
  96. if [ "$instancetype" != "" ] ; then runfile=$runfile-$instancetype; fi
  97. rm -rf $runfile
  98. testresult="PASS"
  99. testdir=db-benchmark-test-$branchrevision
  100. rm -rf $testdir
  101. # checkout the tokudb branch
  102. if [ $testresult = "PASS" ] ; then
  103. retry svn export -q https://svn.tokutek.com/tokudb/$branch/$tokudb $testdir
  104. exitcode=$?
  105. if [ $exitcode != 0 ] ; then testresult="FAIL"; fi
  106. fi
  107. # build it
  108. if [ $testresult = "PASS" ] ; then
  109. pushd $testdir
  110. make release -s CC=$cc GCCVERSION=$gccversion FTLOADER=$ft_loader >>$runfile 2>&1
  111. exitcode=$?
  112. if [ $exitcode != 0 ] ; then testresult="FAIL"; fi
  113. popd
  114. pushd $testdir/db-benchmark-test
  115. make build.tdb CC=$cc GCCVERSION=$gccversion -s >>$runfile 2>&1
  116. exitcode=$?
  117. if [ $exitcode != 0 ] ; then testresult="FAIL"; fi
  118. popd
  119. fi
  120. # run tests
  121. if [ $testresult = "PASS" ] ; then
  122. let i=$n
  123. pushd $testdir/db-benchmark-test
  124. echo ./db-benchmark-test-tokudb -x $i >>$runfile 2>&1
  125. ./db-benchmark-test-tokudb -x $i >>$runfile 2>&1
  126. exitcode=$?
  127. if [ $exitcode != 0 ] ; then testresult="FAIL"; fi
  128. echo ./scanscan-tokudb --prelock --prelockflag >>$runfile 2>&1
  129. ./scanscan-tokudb --prelock --prelockflag >>$runfile 2>&1
  130. exitcode=$?
  131. if [ $exitcode != 0 ] ; then testresult="FAIL"; fi
  132. echo ./scanscan-tokudb --lwc --prelock --prelockflag >>$runfile 2>&1
  133. ./scanscan-tokudb --lwc --prelock --prelockflag >>$runfile 2>&1
  134. exitcode=$?
  135. if [ $exitcode != 0 ] ; then testresult="FAIL"; fi
  136. popd
  137. fi
  138. if [ $testresult = "PASS" ] ; then
  139. let i=2*$n
  140. pushd $testdir/db-benchmark-test
  141. echo ./db-benchmark-test-tokudb -x --norandom $i >>$runfile 2>&1
  142. ./db-benchmark-test-tokudb -x --norandom $i >>$runfile 2>&1
  143. exitcode=$?
  144. if [ $exitcode != 0 ] ; then testresult="FAIL"; fi
  145. echo ./scanscan-tokudb --prelock --prelockflag >>$runfile 2>&1
  146. ./scanscan-tokudb --prelock --prelockflag >>$runfile 2>&1
  147. exitcode=$?
  148. if [ $exitcode != 0 ] ; then testresult="FAIL"; fi
  149. echo ./scanscan-tokudb --lwc --prelock --prelockflag >>$runfile 2>&1
  150. ./scanscan-tokudb --lwc --prelock --prelockflag >>$runfile 2>&1
  151. exitcode=$?
  152. if [ $exitcode != 0 ] ; then testresult="FAIL"; fi
  153. popd
  154. fi
  155. if [ $testresult = "PASS" ] ; then
  156. let i=2*$n
  157. pushd $testdir/db-benchmark-test
  158. echo ./db-benchmark-test-tokudb -x --noserial $i >>$runfile 2>&1
  159. ./db-benchmark-test-tokudb -x --noserial $i >>$runfile 2>&1
  160. exitcode=$?
  161. if [ $exitcode != 0 ] ; then testresult="FAIL"; fi
  162. echo ./scanscan-tokudb --prelock --prelockflag >>$runfile 2>&1
  163. ./scanscan-tokudb --prelock --prelockflag >>$runfile 2>&1
  164. exitcode=$?
  165. if [ $exitcode != 0 ] ; then testresult="FAIL"; fi
  166. echo ./scanscan-tokudb --lwc --prelock --prelockflag >>$runfile 2>&1
  167. ./scanscan-tokudb --lwc --prelock --prelockflag >>$runfile 2>&1
  168. exitcode=$?
  169. if [ $exitcode != 0 ] ; then testresult="FAIL"; fi
  170. popd
  171. fi
  172. # commit results
  173. if [ $commit != 0 ] ; then
  174. svn add $runfile
  175. retry svn commit -m \"$testresult db-benchmark-test $branchrevision $system $arch\" $runfile
  176. fi
  177. popd
  178. exit 0