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.

164 lines
4.2 KiB

  1. #!/usr/bin/env bash
  2. function usage() {
  3. echo "run the loader verify test"
  4. echo "[--rows=$rows]"
  5. echo "[--dictionaries=$dictionaries]"
  6. echo "[--ft_loader=$ft_loader]"
  7. echo "[--tokudb=$tokudb]"
  8. echo "[--branch=$branch]"
  9. echo "[--revision=$revision]"
  10. echo "[--suffix=$suffix]"
  11. echo "[--commit=$commit]"
  12. }
  13. function retry() {
  14. local cmd
  15. local retries
  16. local exitcode
  17. cmd=$*
  18. let retries=0
  19. while [ $retries -le 10 ] ; do
  20. echo `date` $cmd
  21. bash -c "$cmd"
  22. exitcode=$?
  23. echo `date` $cmd $exitcode $retries
  24. let retries=retries+1
  25. if [ $exitcode -eq 0 ] ; then break; fi
  26. sleep 10
  27. done
  28. test $exitcode = 0
  29. }
  30. rows=100000000
  31. dictionaries=3
  32. ft_loader=cilk
  33. tokudb=tokudb
  34. branch=.
  35. revision=0
  36. suffix=.
  37. commit=0
  38. svnserver=https://svn.tokutek.com/tokudb
  39. basedir=~/svn.build
  40. builddir=$basedir/mysql.build
  41. system=`uname -s | tr [:upper:] [:lower:]`
  42. arch=`uname -m | tr [:upper:] [:lower:]`
  43. myhost=`hostname`
  44. instancetype=""
  45. ftcc=gcc
  46. have_cilk=0
  47. # parse the command line
  48. while [ $# -gt 0 ] ; do
  49. arg=$1; shift
  50. if [[ $arg =~ --(.*)=(.*) ]] ; then
  51. eval ${BASH_REMATCH[1]}=${BASH_REMATCH[2]}
  52. else
  53. usage; exit 1
  54. fi
  55. done
  56. # require a revision
  57. if [ $revision -eq 0 ] ; then
  58. exit 1
  59. fi
  60. # build
  61. if [ $ftcc = icc ] ; then
  62. d=/opt/intel/bin
  63. if [ -d $d ] ; then
  64. export PATH=$d:$PATH
  65. . $d/compilervars.sh intel64
  66. fi
  67. d=/opt/intel/cilkutil/bin
  68. if [ -d $d ] ; then
  69. export PATH=$d:$PATH
  70. fi
  71. fi
  72. # setup the branchrevision string
  73. if [ $branch = "." ] ; then
  74. branchrevision=$revision
  75. else
  76. branchrevision=`basename $branch`-$revision
  77. fi
  78. if [ $suffix != "." ] ; then
  79. branchrevision=$branchrevision-$suffix
  80. fi
  81. ftccversion=$($ftcc --version|head -1|cut -f3 -d" ")
  82. # goto the base directory
  83. if [ ! -d $basedir ] ; then mkdir $basedir; fi
  84. pushd $basedir
  85. # update the build directory
  86. if [ ! -d $builddir ] ; then mkdir $builddir; fi
  87. date=`date +%Y%m%d`
  88. testresultsdir=$builddir/$date
  89. pushd $builddir
  90. while [ ! -d $date ] ; do
  91. svn mkdir $svnserver/mysql.build/$date -m ""
  92. svn checkout $svnserver/mysql.build/$date
  93. if [ $? -ne 0 ] ; then rm -rf $date; fi
  94. done
  95. popd
  96. testresult="PASS"
  97. runfile=$testresultsdir/loader-stress-$rows-$dictionaries-$tokudb-$branchrevision-$ftcc-$ftccversion-$system-$arch-$myhost
  98. if [ "$instancetype" != "" ] ; then runfilefile=$runfile-$instancetype; fi
  99. rm -f $runfile
  100. # checkout the code
  101. if [ -d loader-stress-$branchrevision ] ; then rm -rf loader-stress-$branchrevision; fi
  102. mkdir loader-stress-$branchrevision
  103. if [ $branch = "." ] ; then branch=toku; fi
  104. retry svn export -r $revision -q $svnserver/$branch/$tokudb loader-stress-$branchrevision/$tokudb
  105. exitcode=$?
  106. if [ $exitcode != 0 ] ; then
  107. testresult="FAIL"
  108. fi
  109. if [ $testresult = "PASS" ] ; then
  110. pushd loader-stress-$branchrevision/$tokudb
  111. echo `date` make release -s CC=$ftcc HAVE_CILK=$have_cilk FTLOADER=$ft_loader >>$runfile
  112. make -s release CC=$ftcc HAVE_CILK=$have_cilk FTLOADER=$ft_loader >>$runfile 2>&1
  113. exitcode=$?
  114. echo `date` complete $exitcode >>$runfile
  115. if [ $exitcode != 0 ] ; then testresult="FAIL"; fi
  116. popd
  117. fi
  118. if [ $testresult = "PASS" ] ; then
  119. pushd loader-stress-$branchrevision/$tokudb/src/tests
  120. echo `date` make loader-stress-test.tdb CC=$ftcc HAVE_CILK=$have_cilk >>$runfile
  121. make loader-stress-test.tdb -s CC=$ftcc HAVE_CILK=$have_cilk >>$runfile 2>&1
  122. exitcode=$?
  123. echo `date` complete $exitcode >>$runfile
  124. if [ $exitcode != 0 ] ; then testresult="FAIL"; fi
  125. popd
  126. fi
  127. # run
  128. if [ $testresult = "PASS" ] ; then
  129. pushd loader-stress-$branchrevision/$tokudb/src/tests
  130. echo `date` ./loader-stress-test.tdb -v -r $rows -d $dictionaries -c >>$runfile
  131. ./loader-stress-test.tdb -v -r $rows -d $dictionaries -c >>$runfile 2>&1
  132. exitcode=$?
  133. echo `date` complete $exitcode >>$runfile
  134. if [ $exitcode != 0 ] ; then testresult="FAIL"; fi
  135. popd
  136. fi
  137. if [ $commit != 0 ] ; then
  138. svn add $runfile
  139. retry svn commit -m \"$testresult loader stress $rows $dictionaries $tokudb $branchrevision $ftcc $ftccversion $system $arch $myhost\" $runfile
  140. fi
  141. popd
  142. if [ $testresult = "PASS" ] ; then exitcode=0; else exitcode=1; fi
  143. exit $exitcode