Home | History | Annotate | Download | only in lib
      1 #!/bin/sh -xe
      2 
      3 conf=${1}; shift
      4 test=${1}
      5 crasher=crasher
      6 lkdtm=lkdtm
      7 
      8 . "${conf}"
      9 
     10 case "${test}" in
     11 
     12 	"KEXEC-L")
     13                 kexec -l /boot/vmlinuz --initrd=/boot/initrd \
     14                  --append="$(cat /proc/cmdline)"
     15                 sleep 10
     16                 kexec -e
     17                 ;;
     18         "MNS")
     19                 echo "Not implemented"
     20                 ;;
     21 
     22         "MNN")
     23                 echo "Not implemented"
     24                 ;;
     25 
     26         "MCS")
     27                 echo "Not implemented"
     28                 ;;
     29 
     30         "MCN")
     31                 echo "Not implemented"
     32                 ;;
     33 
     34         "MCF")
     35                 echo "Not implemented"
     36                 ;;
     37 
     38 	"ACS")
     39 		echo c >/proc/sysrq-trigger
     40 		;;
     41 
     42 	"ACP")
     43 		# Panic test 0 in crasher module: panic()
     44 		insmod "${crasher}"/crasher.ko
     45 		echo 0 >/proc/crasher
     46 		;;
     47 
     48 	"ACB")
     49 		# Panic test 1 in crasher module: BUG()
     50 		insmod "${crasher}"/crasher.ko
     51 		echo 1 >/proc/crasher
     52 		;;
     53 
     54 	"ACE")
     55 		# Panic test 2 in crasher module: panic_on_oops
     56 		insmod "${crasher}"/crasher.ko
     57 		echo 1 >/proc/sys/kernel/panic_on_oops
     58 		echo 2 >/proc/crasher
     59 		;;
     60 
     61 	"ACL")
     62 		# Panic test 3 in crasher module: hang w/double spinlock
     63 		# requires nmi_watchdog be enabled
     64 		insmod "${crasher}"/crasher.ko
     65 		echo 3 >/proc/crasher
     66 		;;
     67 
     68 	"KPIDB")
     69 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=INT_HARDWARE_ENTRY cpoint_type=BUG cpoint_count=05
     70 		;;
     71 	"KPIDE")
     72 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=INT_HARDWARE_ENTRY cpoint_type=EXCEPTION cpoint_count=05
     73 		;;
     74 	"KPIDL")
     75 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=INT_HARDWARE_ENTRY cpoint_type=LOOP cpoint_count=05
     76 		;;
     77 	"KPIDP")
     78 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=INT_HARDWARE_ENTRY cpoint_type=PANIC cpoint_count=05
     79 		;;
     80 	"KPIDO")
     81 		echo 1 >/proc/sys/kernel/panic_on_oops
     82 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=INT_HARDWARE_ENTRY cpoint_type=OVERFLOW cpoint_count=10
     83 		;;
     84 	"KPIEB")
     85 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=INT_HW_IRQ_EN cpoint_type=BUG cpoint_count=10
     86 		;;
     87 	"KPIEE")
     88 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=INT_HW_IRQ_EN cpoint_type=EXCEPTION cpoint_count=10
     89 		;;
     90 	"KPIEL")
     91 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=INT_HW_IRQ_EN cpoint_type=LOOP cpoint_count=10
     92 		;;
     93 	"KPIEP")
     94 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=INT_HW_IRQ_EN cpoint_type=PANIC cpoint_count=10
     95 		;;
     96 	"KPIEO")
     97 		echo 1 >/proc/sys/kernel/panic_on_oops
     98 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=INT_HW_IRQ_EN cpoint_type=OVERFLOW cpoint_count=10
     99 		;;
    100 	"KPTEB")
    101 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=INT_TASKLET_ENTRY cpoint_type=BUG cpoint_count=10
    102 		;;
    103 	"KPTEE")
    104 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=INT_TASKLET_ENTRY cpoint_type=EXCEPTION cpoint_count=10
    105 		;;
    106 	"KPTEL")
    107 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=INT_TASKLET_ENTRY cpoint_type=LOOP cpoint_count=10
    108 		;;
    109 	"KPTEP")
    110 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=INT_TASKLET_ENTRY cpoint_type=PANIC cpoint_count=10
    111 		;;
    112 	"KPTEO")
    113 		echo 1 >/proc/sys/kernel/panic_on_oops
    114 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=INT_TASKLET_ENTRY cpoint_type=OVERFLOW cpoint_count=10
    115 		;;
    116 	"KPBB")
    117 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=FS_DEVRW cpoint_type=BUG cpoint_count=10
    118 		;;
    119 	"KPBE")
    120 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=FS_DEVRW cpoint_type=EXCEPTION cpoint_count=10
    121 		;;
    122 	"KPBL")
    123 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=FS_DEVRW cpoint_type=LOOP cpoint_count=10
    124 		;;
    125 	"KPBP")
    126 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=FS_DEVRW cpoint_type=PANIC cpoint_count=10
    127 		;;
    128 	"KPBO")
    129 		echo 1 >/proc/sys/kernel/panic_on_oops
    130 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=FS_DEVRW cpoint_type=OVERFLOW cpoint_count=10
    131 		;;
    132 	"KPMSB")
    133 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=MEM_SWAPOUT cpoint_type=BUG cpoint_count=10
    134 		;;
    135 	"KPMSE")
    136 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=MEM_SWAPOUT cpoint_type=EXCEPTION cpoint_count=10
    137 		;;
    138 	"KPMSL")
    139 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=MEM_SWAPOUT cpoint_type=LOOP cpoint_count=10
    140 		;;
    141 	"KPMSP")
    142 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=MEM_SWAPOUT cpoint_type=PANIC cpoint_count=10
    143 		;;
    144 	"KPMSO")
    145 		echo 1 >/proc/sys/kernel/panic_on_oops
    146 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=MEM_SWAPOUT cpoint_type=OVERFLOW cpoint_count=10
    147 		;;
    148 	"KPTB")
    149 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=TIMERADD cpoint_type=BUG cpoint_count=10
    150 		;;
    151 	"KPTE")
    152 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=TIMERADD cpoint_type=EXCEPTION cpoint_count=10
    153 		;;
    154 	"KPTL")
    155 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=TIMERADD cpoint_type=LOOP cpoint_count=10
    156 		;;
    157 	"KPTP")
    158 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=TIMERADD cpoint_type=PANIC cpoint_count=10
    159 		;;
    160 	"KPTO")
    161 		echo 1 >/proc/sys/kernel/panic_on_oops
    162 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=TIMERADD cpoint_type=OVERFLOW cpoint_count=10
    163 		;;
    164 	"KPSB")
    165 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=SCSI_DISPATCH_CMD cpoint_type=BUG cpoint_count=10
    166 		;;
    167 	"KPSE")
    168 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=SCSI_DISPATCH_CMD cpoint_type=EXCEPTION cpoint_count=10
    169 		;;
    170 	"KPSL")
    171 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=SCSI_DISPATCH_CMD cpoint_type=LOOP cpoint_count=10
    172 		;;
    173 	"KPSP")
    174 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=SCSI_DISPATCH_CMD cpoint_type=PANIC cpoint_count=10
    175 		;;
    176 	"KPSO")
    177 		echo 1 >/proc/sys/kernel/panic_on_oops
    178 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=SCSI_DISPATCH_CMD cpoint_type=OVERFLOW cpoint_count=10
    179 		;;
    180 	"KPIB")
    181 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=IDE_CORE_CP cpoint_type=BUG cpoint_count=10
    182 		;;
    183 	"KPIE")
    184 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=IDE_CORE_CP cpoint_type=EXCEPTION cpoint_count=10
    185 		;;
    186 	"KPIL")
    187 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=IDE_CORE_CP cpoint_type=LOOP cpoint_count=10
    188 		;;
    189 	"KPIP")
    190 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=IDE_CORE_CP cpoint_type=PANIC cpoint_count=10
    191 		;;
    192 	"KPIO")
    193 		echo 1 >/proc/sys/kernel/panic_on_oops
    194 		insmod "${lkdtm}"/lkdtm.ko cpoint_name=IDE_CORE_CP cpoint_type=OVERFLOW cpoint_count=01
    195 		;;
    196         "KLEXT")
    197                 echo "ext3 ${EXT3_PART}" >/etc/kdump.conf
    198                 if [ "${FILTER}" -eq 1 ]; then
    199                         echo "core_collector makedumpfile ${MAKE_OPTIONS}" >>/etc/kdump.conf
    200                 fi
    201                 /etc/init.d/kdump restart
    202                 echo c >/proc/sysrq-trigger
    203                 ;;
    204 
    205         "KLLBL")
    206                 echo "ext3 LABEL=${EXT3_LABEL}" >/etc/kdump.conf
    207                 if [ "${FILTER}" -eq 1 ]; then
    208                         echo "core_collector makedumpfile ${MAKE_OPTIONS}" >>/etc/kdump.conf
    209                 fi
    210                 /etc/init.d/kdump restart
    211                 echo c >/proc/sysrq-trigger
    212                 ;;
    213 
    214         "KLUID")
    215                 echo "ext3 UUID=${EXT3_UID}" >/etc/kdump.conf
    216                 if [ "${FILTER}" -eq 1 ]; then
    217                         echo "core_collector makedumpfile ${MAKE_OPTIONS}" >>/etc/kdump.conf
    218                 fi
    219                 /etc/init.d/kdump restart
    220                 echo c >/proc/sysrq-trigger
    221                 ;;
    222 
    223         "KLRAW")
    224                 echo "raw ${RAW_PART}" >/etc/kdump.conf
    225                 if [ "${FILTER}" -eq 1 ]; then
    226                         echo "core_collector makedumpfile ${MAKE_OPTIONS}" >>/etc/kdump.conf
    227                 fi
    228                 /etc/init.d/kdump restart
    229                 echo c >/proc/sysrq-trigger
    230                 ;;
    231 
    232         "KNSCP")
    233                 echo "net ${SCP_PATH}" >/etc/kdump.conf
    234                 if [ "${LINK_DELAY}" ]; then
    235                     echo "link_delay ${LINK_DELAY}" >>/etc/kdump.conf
    236                 fi
    237 
    238                 expect -f ./ssh.tcl "/etc/init.d/kdump propagate" "${SCP_PASS}"
    239                 if [ "${FILTER}" -eq 1 ]; then
    240                         echo "core_collector makedumpfile ${MAKE_OPTIONS}" >>/etc/kdump.conf
    241                 fi
    242                 /etc/init.d/kdump restart
    243                 echo c >/proc/sysrq-trigger
    244                 ;;
    245 
    246         "KNNFS")
    247                 echo "net ${NFS_PATH}" >/etc/kdump.conf
    248                 if [ "${LINK_DELAY}" ]; then
    249                     echo "link_delay ${LINK_DELAY}" >>/etc/kdump.conf
    250                 fi
    251 
    252                 if [ "${FILTER}" -eq 1 ]; then
    253                         echo "core_collector makedumpfile ${MAKE_OPTIONS}" >>/etc/kdump.conf
    254                 fi
    255                 /etc/init.d/kdump restart
    256                 echo c >/proc/sysrq-trigger
    257                 ;;
    258 
    259         "KDENB")
    260                 echo "net ${SCP_PATH}" >/etc/kdump.conf
    261                 expect -f ./ssh.tcl "/etc/init.d/kdump propagate" "${SCP_PASS}"
    262                 /etc/init.d/kdump restart
    263                 ;;
    264 
    265         *)
    266                 echo "Unknown test."
    267                 ;;
    268 
    269 esac
    270 
    271 exit 0
    272