PageRenderTime 22ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/kernel-source/tools/testing/selftests/rcutorture/bin/kvm.sh

https://gitlab.com/karrei/inel-imx6-kernel
Shell | 210 lines | 169 code | 11 blank | 30 comment | 13 complexity | 51a36c36fe47686ee626302d4a082d3e MD5 | raw file
  1. #!/bin/bash
  2. #
  3. # Run a series of 14 tests under KVM. These are not particularly
  4. # well-selected or well-tuned, but are the current set. Run from the
  5. # top level of the source tree.
  6. #
  7. # Edit the definitions below to set the locations of the various directories,
  8. # as well as the test duration.
  9. #
  10. # Usage: sh kvm.sh [ options ]
  11. #
  12. # This program is free software; you can redistribute it and/or modify
  13. # it under the terms of the GNU General Public License as published by
  14. # the Free Software Foundation; either version 2 of the License, or
  15. # (at your option) any later version.
  16. #
  17. # This program is distributed in the hope that it will be useful,
  18. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. # GNU General Public License for more details.
  21. #
  22. # You should have received a copy of the GNU General Public License
  23. # along with this program; if not, you can access it online at
  24. # http://www.gnu.org/licenses/gpl-2.0.html.
  25. #
  26. # Copyright (C) IBM Corporation, 2011
  27. #
  28. # Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
  29. scriptname=$0
  30. args="$*"
  31. dur=30
  32. KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM
  33. PATH=${KVM}/bin:$PATH; export PATH
  34. builddir="${KVM}/b1"
  35. RCU_INITRD="$KVM/initrd"; export RCU_INITRD
  36. RCU_KMAKE_ARG=""; export RCU_KMAKE_ARG
  37. resdir=""
  38. configs=""
  39. ds=`date +%Y.%m.%d-%H:%M:%S`
  40. kversion=""
  41. . functions.sh
  42. usage () {
  43. echo "Usage: $scriptname optional arguments:"
  44. echo " --bootargs kernel-boot-arguments"
  45. echo " --builddir absolute-pathname"
  46. echo " --buildonly"
  47. echo " --configs \"config-file list\""
  48. echo " --datestamp string"
  49. echo " --duration minutes"
  50. echo " --interactive"
  51. echo " --kmake-arg kernel-make-arguments"
  52. echo " --kversion vN.NN"
  53. echo " --mac nn:nn:nn:nn:nn:nn"
  54. echo " --no-initrd"
  55. echo " --qemu-args qemu-system-..."
  56. echo " --qemu-cmd qemu-system-..."
  57. echo " --results absolute-pathname"
  58. echo " --relbuilddir relative-pathname"
  59. exit 1
  60. }
  61. while test $# -gt 0
  62. do
  63. case "$1" in
  64. --bootargs)
  65. checkarg --bootargs "(list of kernel boot arguments)" "$#" "$2" '.*' '^--'
  66. RCU_BOOTARGS="$2"
  67. shift
  68. ;;
  69. --builddir)
  70. checkarg --builddir "(absolute pathname)" "$#" "$2" '^/' '^error'
  71. builddir=$2
  72. gotbuilddir=1
  73. shift
  74. ;;
  75. --buildonly)
  76. RCU_BUILDONLY=1; export RCU_BUILDONLY
  77. ;;
  78. --configs)
  79. checkarg --configs "(list of config files)" "$#" "$2" '^[^/]*$' '^--'
  80. configs="$2"
  81. shift
  82. ;;
  83. --datestamp)
  84. checkarg --datestamp "(relative pathname)" "$#" "$2" '^[^/]*$' '^--'
  85. ds=$2
  86. shift
  87. ;;
  88. --duration)
  89. checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' '^error'
  90. dur=$2
  91. shift
  92. ;;
  93. --interactive)
  94. RCU_QEMU_INTERACTIVE=1; export RCU_QEMU_INTERACTIVE
  95. ;;
  96. --kmake-arg)
  97. checkarg --kmake-arg "(kernel make arguments)" $# "$2" '.*' '^error$'
  98. RCU_KMAKE_ARG="$2"; export RCU_KMAKE_ARG
  99. shift
  100. ;;
  101. --kversion)
  102. checkarg --kversion "(kernel version)" $# "$2" '^v[0-9.]*$' '^error'
  103. kversion=$2
  104. shift
  105. ;;
  106. --mac)
  107. checkarg --mac "(MAC address)" $# "$2" '^\([0-9a-fA-F]\{2\}:\)\{5\}[0-9a-fA-F]\{2\}$' error
  108. RCU_QEMU_MAC=$2; export RCU_QEMU_MAC
  109. shift
  110. ;;
  111. --no-initrd)
  112. RCU_INITRD=""; export RCU_INITRD
  113. ;;
  114. --qemu-args)
  115. checkarg --qemu-args "-qemu args" $# "$2" '^-' '^error'
  116. RCU_QEMU_ARG="$2"
  117. shift
  118. ;;
  119. --qemu-cmd)
  120. checkarg --qemu-cmd "(qemu-system-...)" $# "$2" 'qemu-system-' '^--'
  121. RCU_QEMU_CMD="$2"; export RCU_QEMU_CMD
  122. shift
  123. ;;
  124. --relbuilddir)
  125. checkarg --relbuilddir "(relative pathname)" "$#" "$2" '^[^/]*$' '^--'
  126. relbuilddir=$2
  127. gotrelbuilddir=1
  128. builddir=${KVM}/${relbuilddir}
  129. shift
  130. ;;
  131. --results)
  132. checkarg --results "(absolute pathname)" "$#" "$2" '^/' '^error'
  133. resdir=$2
  134. shift
  135. ;;
  136. *)
  137. echo Unknown argument $1
  138. usage
  139. ;;
  140. esac
  141. shift
  142. done
  143. CONFIGFRAG=${KVM}/configs; export CONFIGFRAG
  144. KVPATH=${CONFIGFRAG}/$kversion; export KVPATH
  145. if test -z "$configs"
  146. then
  147. configs="`cat $CONFIGFRAG/$kversion/CFLIST`"
  148. fi
  149. if test -z "$resdir"
  150. then
  151. resdir=$KVM/res
  152. if ! test -e $resdir
  153. then
  154. mkdir $resdir || :
  155. fi
  156. else
  157. if ! test -e $resdir
  158. then
  159. mkdir -p "$resdir" || :
  160. fi
  161. fi
  162. mkdir $resdir/$ds
  163. touch $resdir/$ds/log
  164. echo $scriptname $args >> $resdir/$ds/log
  165. pwd > $resdir/$ds/testid.txt
  166. if test -d .git
  167. then
  168. git status >> $resdir/$ds/testid.txt
  169. git rev-parse HEAD >> $resdir/$ds/testid.txt
  170. fi
  171. builddir=$KVM/b1
  172. if ! test -e $builddir
  173. then
  174. mkdir $builddir || :
  175. fi
  176. for CF in $configs
  177. do
  178. # Running TREE01 multiple times creates TREE01, TREE01.2, TREE01.3, ...
  179. rd=$resdir/$ds/$CF
  180. if test -d "${rd}"
  181. then
  182. n="`ls -d "${rd}"* | grep '\.[0-9]\+$' |
  183. sed -e 's/^.*\.\([0-9]\+\)/\1/' |
  184. sort -k1n | tail -1`"
  185. if test -z "$n"
  186. then
  187. rd="${rd}.2"
  188. else
  189. n="`expr $n + 1`"
  190. rd="${rd}.${n}"
  191. fi
  192. fi
  193. mkdir "${rd}"
  194. echo Results directory: $rd
  195. kvm-test-1-rcu.sh $CONFIGFRAG/$kversion/$CF $builddir $rd $dur "-nographic $RCU_QEMU_ARG" "rcutorture.test_no_idle_hz=1 rcutorture.verbose=1 $RCU_BOOTARGS"
  196. done
  197. # Tracing: trace_event=rcu:rcu_grace_period,rcu:rcu_future_grace_period,rcu:rcu_grace_period_init,rcu:rcu_nocb_wake,rcu:rcu_preempt_task,rcu:rcu_unlock_preempted_task,rcu:rcu_quiescent_state_report,rcu:rcu_fqs,rcu:rcu_callback,rcu:rcu_kfree_callback,rcu:rcu_batch_start,rcu:rcu_invoke_callback,rcu:rcu_invoke_kfree_callback,rcu:rcu_batch_end,rcu:rcu_torture_read,rcu:rcu_barrier
  198. echo " --- `date` Test summary:"
  199. kvm-recheck.sh $resdir/$ds