]> git.proxmox.com Git - mirror_spl-debian.git/blame - scripts/check.sh
Add top level make check target which runs the validation
[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
7
8die() {
9 echo "${prog}: $1" >&2
10 exit 1
11}
12
13warn() {
14 echo "${prog}: $1" >&2
15}
16
17if [ $(id -u) != 0 ]; then
18 die "Must run as root"
19fi
20
21if /sbin/lsmod | egrep -q "^spl|^splat"; then
22 die "Must start with spl modules unloaded"
23fi
24
25if [ ! -f ${spl_module} ] || [ ! -f ${splat_module} ]; then
26 die "Source tree must be built, run 'make'"
27fi
28
29echo "Loading ${spl_module}"
30/sbin/insmod ${spl_module} || die "Failed to load ${spl_module}"
31
32echo "Loading ${splat_module}"
33/sbin/insmod ${splat_module} || die "Unable to load ${splat_module}"
34
35sleep 5
36$splat_cmd -a
37
38echo "Unloading ${splat_module}"
39/sbin/rmmod ${splat_module} || die "Failed to unload ${splat_module}"
40
41echo "Unloading ${spl_module}"
42/sbin/rmmod ${spl_module} || die "Unable to unload ${spl_module}"
43
44exit 0