build: remove elf_core.c from source dependencies
[mit.git] / stress_modules.sh
blob37c1b57f917946cd80cb77dac6d10b186948a0e4
1 #! /bin/sh
3 MODULE_DIR=/lib/modules/`uname -r`/kernel
5 case "$1" in
6 mount-unmount)
7 trap "umount $3; rm -f $2; rmdir $3" 0
8 mkdir $3
9 dd bs=1204k count=20 if=/dev/zero of=$2
10 mke2fs -F $2
11 tune2fs -c 0 $2
12 modprobe loop
13 while true; do mount -o loop $2 $3; umount $3; sleep 1; done
15 bang-one)
16 trap "rmmod $2" 0
17 while true; do modprobe $2; rmmod $2; done
19 bang-all)
20 while true; do
21 # Randomize order
22 find $MODULE_DIR -name '*.ko' | ( while read mod; do echo $RANDOM $mod; done ) | sort -n |
23 while read junk modname; do
24 if [ $RANDOM -gt $RANDOM ]; then
25 rmmod `basename $modname .ko`
26 else
27 modprobe `basename $modname .ko`
29 done
30 done
32 "")
33 $0 mount-unmount testfs.$$ /tmp/$$ &
34 $0 bang-one ext2 &
35 $0 bang-all &
36 exit 0
39 echo Unknown arg "$1"
40 exit 1
42 esac