]>
Commit | Line | Data |
---|---|---|
7bdf406d TG |
1 | #!/bin/bash |
2 | ############################################################################### | |
3 | # Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. | |
4 | # Copyright (C) 2007 The Regents of the University of California. | |
5 | # Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). | |
6 | # Written by Brian Behlendorf <behlendorf1@llnl.gov>. | |
7 | # UCRL-CODE-235197 | |
8 | # | |
9 | # This file is part of the SPL, Solaris Porting Layer. | |
10 | # For details, see <http://zfsonlinux.org/>. | |
11 | # | |
12 | # The SPL is free software; you can redistribute it and/or modify it | |
13 | # under the terms of the GNU General Public License as published by the | |
14 | # Free Software Foundation; either version 2 of the License, or (at your | |
15 | # option) any later version. | |
16 | # | |
17 | # The SPL is distributed in the hope that it will be useful, but WITHOUT | |
18 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
19 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
20 | # for more details. | |
21 | # | |
22 | # You should have received a copy of the GNU General Public License along | |
23 | # with the SPL. If not, see <http://www.gnu.org/licenses/>. | |
24 | ############################################################################### | |
25 | # This script runs the full set of regression tests. | |
26 | ############################################################################### | |
27 | ||
28 | prog=check.sh | |
29 | spl_module=../module/spl/spl.ko | |
30 | splat_module=../module/splat/splat.ko | |
0bd31011 | 31 | splat_cmd=../cmd/splat |
7bdf406d TG |
32 | verbose= |
33 | ||
34 | die() { | |
35 | echo "${prog}: $1" >&2 | |
36 | exit 1 | |
37 | } | |
38 | ||
39 | warn() { | |
40 | echo "${prog}: $1" >&2 | |
41 | } | |
42 | ||
43 | if [ -n "$V" ]; then | |
44 | verbose="-v" | |
45 | fi | |
46 | ||
47 | if [ -n "$TESTS" ]; then | |
48 | tests="$TESTS" | |
49 | else | |
50 | tests="-a" | |
51 | fi | |
52 | ||
53 | if [ $(id -u) != 0 ]; then | |
54 | die "Must run as root" | |
55 | fi | |
56 | ||
57 | if /sbin/lsmod | egrep -q "^spl|^splat"; then | |
58 | die "Must start with spl modules unloaded" | |
59 | fi | |
60 | ||
61 | if [ ! -f ${spl_module} ] || [ ! -f ${splat_module} ]; then | |
62 | die "Source tree must be built, run 'make'" | |
63 | fi | |
64 | ||
65 | /sbin/modprobe zlib_inflate &>/dev/null | |
66 | /sbin/modprobe zlib_deflate &>/dev/null | |
67 | ||
68 | echo "Loading ${spl_module}" | |
69 | /sbin/insmod ${spl_module} || die "Failed to load ${spl_module}" | |
70 | ||
71 | echo "Loading ${splat_module}" | |
72 | /sbin/insmod ${splat_module} || die "Unable to load ${splat_module}" | |
73 | ||
74 | # Wait a maximum of 3 seconds for udev to detect the new splatctl | |
75 | # device, if we do not see the character device file created assume | |
76 | # udev is not running and manually create the character device. | |
77 | for i in `seq 1 50`; do | |
78 | sleep 0.1 | |
79 | ||
80 | if [ -c /dev/splatctl ]; then | |
81 | break | |
82 | fi | |
83 | ||
84 | if [ $i -eq 50 ]; then | |
85 | mknod /dev/splatctl c 229 0 | |
86 | fi | |
87 | done | |
88 | ||
89 | $splat_cmd $tests $verbose | |
90 | ||
91 | echo "Unloading ${splat_module}" | |
92 | /sbin/rmmod ${splat_module} || die "Failed to unload ${splat_module}" | |
93 | ||
94 | echo "Unloading ${spl_module}" | |
95 | /sbin/rmmod ${spl_module} || die "Unable to unload ${spl_module}" | |
96 | ||
97 | exit 0 |