1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
#! /bin/sh
# Shell script to run test suite.
set -e
if [ x"$1" = x"-v" ]; then VERBOSE=1; shift; fi
if [ x"$1" = x"-v" -o x"$1" = x"-vv" ]; then VERBOSE=1; EXTRA_ARGS=-x; shift; fi
# Creates a temporary file and exports the name of the file to
# the provided argument. Exits on error.
#
# Usage: create_tempfile TEMPFILE
#
create_tempfile()
{
if test $# = 0
then
echo "No argument passed to create_tempfile()"
exit 1
fi
if [ -x /bin/tempfile ]
then
# Debian
export $1="`tempfile`"
elif [ -x /bin/mktemp ]
then
# RedHat et. al.
export $1="`mktemp /tmp/modtest.XXXXXX`"
else
echo "Don't know how to make a temporary file on this "
echo "system, sorry."
exit 1
fi
if [ $? -ne 0 ]
then
echo "Can't create temporary file."
exit 1
fi
}
export -f create_tempfile
for config in --enable-zlib --disable-zlib; do
echo Building with $config...
./configure $config CFLAGS="-DJUST_TESTING -g -Wall" >/dev/null
make clean >/dev/null
# ismod.static doesn't build with -DJUST_TESTING and --enable-zlib
make insmod.static >/dev/null 2>&1 || touch insmod.static
make all >/dev/null
echo Testing with $config...
if grep -q CONFIG_USE_ZLIB=1 Makefile; then
CONFIG_HAVE_ZLIB=1
export CONFIG_HAVE_ZLIB
else
unset CONFIG_HAVE_ZLIB
fi
# Create endianness links
case `file modprobe` in
*MSB*) ENDIAN=be;;
*LSB*) ENDIAN=le;;
*) echo Unknown endian! >&2; exit 1;;
esac
ln -sfn 64-$ENDIAN tests/data/64
ln -sfn 32-$ENDIAN tests/data/32
# Make them run the valgrind wrappers, if available.
if type valgrind 2>/dev/null; then
PATH=`pwd`/tests:$PATH
else
PATH=`pwd`:$PATH
fi
# By default, we want to look like a new kernel.
MODTEST_UNAME=2.5.52
MODTEST_OVERRIDE0=/proc/ksyms
MODTEST_OVERRIDE_WITH0=/proc/nonexistent-file
export MODTEST_UNAME MODTEST_OVERRIDE0 MODTEST_OVERRIDE_WITH0
if [ $# -eq 1 ]; then DOING=0; else DOING=1; fi
for dir in `find tests/* -type d | sort`
do
# data and tmp dirs don't contain tests.
case "$dir" in tests/data*) continue;; tests/tmp*) continue;; esac
if [ -z "$VERBOSE" ]; then
echo -n Running tests for $dir.
else
echo Running tests for $dir.
fi
shopt -s nullglob
for f in $dir/[0-9]*; do
# Ignore backups dir.
case "$f" in *~) continue;; esac
if [ $DOING -eq 0 ]; then
case "$f" in *$1*) DOING=1;; *) continue;; esac
fi
rm -rf tests/tmp/*
if sh -e $EXTRA_ARGS $f; then
if [ -z "$VERBOSE" ]; then
echo -n .
else
echo Tests $f succeeded.
fi
else
echo Test for $f failed.
# Dangerous to leave these lying around
make distclean >/dev/null
exit 1
fi
done
if [ -z "$VERBOSE" ]; then echo; fi
done
done
exit 0
|