Introduce TinyHttp server
[lcapit-junk-code.git] / module-load-test
bloba80150d4227fbd9bd1092e70e377af58375a324b
1 #!/bin/sh
3 # module-load-test: Try to load all the available modules in the
4 # system. This will surely crash the kernel.
6 # Luiz Fernando N. Capitulino
7 # <lcapitulino@gmail.com>
9 DMESG_BEFORE_LOAD=dmesg-before-load.txt
10 DMESG_AFTER_LOAD=dmesg-after-module-load.txt
11 DMESG_AFTER=dmesg-after-unload.txt
12 LOAD_ERRORS=load-errors.txt
13 MODULE_LIST=modules.txt
14 MODULES_DIR=/lib/modules/$(uname -r)/kernel
15 MODULES=""
17 load_modules()
19 modules=$1
20 count=0
22 echo "-> loading modules"
24 for mod in $modules; do
25 echo " $mod"
26 modprobe $mod 2> $LOAD_ERRORS
27 ((count++))
28 done
30 echo "-> loaded $count modules"
33 get_dmesg()
35 file=$1
37 dmesg -c > $file
38 sync
41 # Get all the modules
42 for file in $(find $MODULES_DIR -iname '*.ko.gz'); do
43 module=$(basename $file | sed 's/\.ko\.gz//')
44 echo $module >> $MODULE_LIST
45 MODULES="$MODULES $module"
46 done
48 # Load them all
49 get_dmesg $DMESG_BEFORE_LOAD
50 load_modules "$MODULES"
51 get_dmesg $DMESG_AFTER_LOAD
53 # FIXME: Write unload part