2 # Shell script to run test suite.
6 if [ x
"$1" = x
"-v" ]; then VERBOSE
=1; shift; fi
7 if [ x
"$1" = x
"-v" -o x
"$1" = x
"-vv" ]; then VERBOSE
=1; EXTRA_ARGS
=-x; shift; fi
9 # Creates a temporary file and exports the name of the file to
10 # the provided argument. Exits on error.
12 # Usage: create_tempfile TEMPFILE
18 echo "No argument passed to create_tempfile()"
22 if [ -x /bin
/tempfile
]
25 export $1="`tempfile`"
26 elif [ -x /bin
/mktemp
]
29 export $1="`mktemp /tmp/modtest.XXXXXX`"
31 echo "Don't know how to make a temporary file on this "
38 echo "Can't create temporary file."
42 export -f create_tempfile
44 for config
in --enable-zlib --disable-zlib; do
45 echo Building with
$config...
46 .
/configure
$config CFLAGS
="-DJUST_TESTING -g -Wall" >/dev
/null
48 # ismod.static doesn't build with -DJUST_TESTING and --enable-zlib
49 make insmod.static
>/dev
/null
2>&1 ||
touch insmod.static
52 echo Testing with
$config...
53 if grep -q CONFIG_USE_ZLIB
=1 Makefile
; then
55 export CONFIG_HAVE_ZLIB
57 unset CONFIG_HAVE_ZLIB
60 # Create endianness links
61 case `file modprobe` in
64 *) echo Unknown endian
! >&2; exit 1;;
66 ln -sfn 64-$ENDIAN tests
/data
/64
67 ln -sfn 32-$ENDIAN tests
/data
/32
69 # Make them run the valgrind wrappers, if available.
70 if type valgrind
2>/dev
/null
; then
71 PATH
=`pwd`/tests
:$PATH
76 # By default, we want to look like a new kernel.
80 MODTEST_OVERRIDE_ROOT
=tests
/tmp
81 export MODTEST_OVERRIDE_ROOT
83 if [ $# -eq 1 ]; then DOING
=0; else DOING
=1; fi
85 if [ ! -e "tests/tmp" ]; then
86 echo Making temporary directory
for tests
91 for dir
in `find tests/* -type d | sort`
93 # data and tmp dirs don't contain tests.
94 case "$dir" in tests
/data
*) continue;; tests
/tmp
*) continue;; esac
96 if [ -z "$VERBOSE" ]; then
97 echo -n Running tests
for $dir.
99 echo Running tests
for $dir.
102 for f
in $dir/[0-9]*; do
103 # Ignore backups dir.
104 case "$f" in *~
) continue;; esac
106 if [ $DOING -eq 0 ]; then
107 case "$f" in *$1*) DOING
=1;; *) continue;; esac
111 if sh
-e $EXTRA_ARGS $f; then
112 if [ -z "$VERBOSE" ]; then
115 echo Tests
$f succeeded.
118 echo Test
for $f failed.
119 # Dangerous to leave these lying around
120 make distclean
>/dev
/null
124 if [ -z "$VERBOSE" ]; then echo; fi