]> git.proxmox.com Git - mirror_spl-debian.git/blame - scripts/check.sh
Sigh more compat fixes, this is almost right for 2.6.9 - 2.6.26 kernels.
[mirror_spl-debian.git] / scripts / check.sh
CommitLineData
07d339d4 1#!/bin/bash
2
3prog=check.sh
4spl_module=../modules/spl/spl.ko
5splat_module=../modules/splat/splat.ko
6splat_cmd=../cmd/splat
9490c148 7verbose=
07d339d4 8
9die() {
10 echo "${prog}: $1" >&2
11 exit 1
12}
13
14warn() {
15 echo "${prog}: $1" >&2
16}
17
9490c148 18if [ -n "$V" ]; then
19 verbose="-v"
20fi
21
4b171585 22if [ -n "$TESTS" ]; then
23 tests="$TESTS"
24else
25 tests="-a"
26fi
27
07d339d4 28if [ $(id -u) != 0 ]; then
29 die "Must run as root"
30fi
31
32if /sbin/lsmod | egrep -q "^spl|^splat"; then
33 die "Must start with spl modules unloaded"
34fi
35
36if [ ! -f ${spl_module} ] || [ ! -f ${splat_module} ]; then
37 die "Source tree must be built, run 'make'"
38fi
39
c30df9c8 40spl_module_params="spl_debug_mask=-1 spl_debug_subsys=-1"
07d339d4 41echo "Loading ${spl_module}"
c30df9c8 42/sbin/insmod ${spl_module} ${spl_module_params} || die "Failed to load ${spl_module}"
07d339d4 43
44echo "Loading ${splat_module}"
45/sbin/insmod ${splat_module} || die "Unable to load ${splat_module}"
46
4b171585 47while [ ! -c /dev/splatctl ]; do sleep 0.1; done
48$splat_cmd $tests $verbose
07d339d4 49
50echo "Unloading ${splat_module}"
51/sbin/rmmod ${splat_module} || die "Failed to unload ${splat_module}"
52
53echo "Unloading ${spl_module}"
54/sbin/rmmod ${spl_module} || die "Unable to unload ${spl_module}"
55
56exit 0