]> git.proxmox.com Git - mirror_spl-debian.git/blame - scripts/check.sh
Fix zlib compression
[mirror_spl-debian.git] / scripts / check.sh
CommitLineData
07d339d4 1#!/bin/bash
716154c5
BB
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://github.com/behlendorf/spl/>.
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###############################################################################
07d339d4 27
28prog=check.sh
617d5a67
BB
29spl_module=../module/spl/spl.ko
30splat_module=../module/splat/splat.ko
07d339d4 31splat_cmd=../cmd/splat
9490c148 32verbose=
07d339d4 33
34die() {
35 echo "${prog}: $1" >&2
36 exit 1
37}
38
39warn() {
40 echo "${prog}: $1" >&2
41}
42
9490c148 43if [ -n "$V" ]; then
44 verbose="-v"
45fi
46
4b171585 47if [ -n "$TESTS" ]; then
48 tests="$TESTS"
49else
50 tests="-a"
51fi
52
07d339d4 53if [ $(id -u) != 0 ]; then
54 die "Must run as root"
55fi
56
57if /sbin/lsmod | egrep -q "^spl|^splat"; then
58 die "Must start with spl modules unloaded"
59fi
60
61if [ ! -f ${spl_module} ] || [ ! -f ${splat_module} ]; then
62 die "Source tree must be built, run 'make'"
63fi
64
55abb092 65spl_module_params="spl_debug_mask=0xffffffff spl_debug_subsys=0xffffffff"
07d339d4 66echo "Loading ${spl_module}"
c30df9c8 67/sbin/insmod ${spl_module} ${spl_module_params} || die "Failed to load ${spl_module}"
07d339d4 68
69echo "Loading ${splat_module}"
70/sbin/insmod ${splat_module} || die "Unable to load ${splat_module}"
71
e7318771 72# Wait a maximum of 3 seconds for udev to detect the new splatctl
73# device, if we do not see the character device file created assume
74# udev is not running and manually create the character device.
75for i in `seq 1 50`; do
76 sleep 0.1
77
78 if [ -c /dev/splatctl ]; then
79 break
80 fi
81
82 if [ $i -eq 50 ]; then
83 mknod /dev/splatctl c 229 0
84 fi
85done
86
4b171585 87$splat_cmd $tests $verbose
07d339d4 88
89echo "Unloading ${splat_module}"
90/sbin/rmmod ${splat_module} || die "Failed to unload ${splat_module}"
91
92echo "Unloading ${spl_module}"
93/sbin/rmmod ${spl_module} || die "Unable to unload ${spl_module}"
94
95exit 0