]>
Commit | Line | Data |
---|---|---|
07d339d4 | 1 | #!/bin/bash |
2 | ||
3 | prog=check.sh | |
617d5a67 BB |
4 | spl_module=../module/spl/spl.ko |
5 | splat_module=../module/splat/splat.ko | |
07d339d4 | 6 | splat_cmd=../cmd/splat |
9490c148 | 7 | verbose= |
07d339d4 | 8 | |
9 | die() { | |
10 | echo "${prog}: $1" >&2 | |
11 | exit 1 | |
12 | } | |
13 | ||
14 | warn() { | |
15 | echo "${prog}: $1" >&2 | |
16 | } | |
17 | ||
9490c148 | 18 | if [ -n "$V" ]; then |
19 | verbose="-v" | |
20 | fi | |
21 | ||
4b171585 | 22 | if [ -n "$TESTS" ]; then |
23 | tests="$TESTS" | |
24 | else | |
25 | tests="-a" | |
26 | fi | |
27 | ||
07d339d4 | 28 | if [ $(id -u) != 0 ]; then |
29 | die "Must run as root" | |
30 | fi | |
31 | ||
32 | if /sbin/lsmod | egrep -q "^spl|^splat"; then | |
33 | die "Must start with spl modules unloaded" | |
34 | fi | |
35 | ||
36 | if [ ! -f ${spl_module} ] || [ ! -f ${splat_module} ]; then | |
37 | die "Source tree must be built, run 'make'" | |
38 | fi | |
39 | ||
c30df9c8 | 40 | spl_module_params="spl_debug_mask=-1 spl_debug_subsys=-1" |
07d339d4 | 41 | echo "Loading ${spl_module}" |
c30df9c8 | 42 | /sbin/insmod ${spl_module} ${spl_module_params} || die "Failed to load ${spl_module}" |
07d339d4 | 43 | |
44 | echo "Loading ${splat_module}" | |
45 | /sbin/insmod ${splat_module} || die "Unable to load ${splat_module}" | |
46 | ||
e7318771 | 47 | # Wait a maximum of 3 seconds for udev to detect the new splatctl |
48 | # device, if we do not see the character device file created assume | |
49 | # udev is not running and manually create the character device. | |
50 | for i in `seq 1 50`; do | |
51 | sleep 0.1 | |
52 | ||
53 | if [ -c /dev/splatctl ]; then | |
54 | break | |
55 | fi | |
56 | ||
57 | if [ $i -eq 50 ]; then | |
58 | mknod /dev/splatctl c 229 0 | |
59 | fi | |
60 | done | |
61 | ||
4b171585 | 62 | $splat_cmd $tests $verbose |
07d339d4 | 63 | |
64 | echo "Unloading ${splat_module}" | |
65 | /sbin/rmmod ${splat_module} || die "Failed to unload ${splat_module}" | |
66 | ||
67 | echo "Unloading ${spl_module}" | |
68 | /sbin/rmmod ${spl_module} || die "Unable to unload ${spl_module}" | |
69 | ||
70 | exit 0 |