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 # Run by "make check" from build directory
10 if [ -n "$srcdir" ]; then cd "$srcdir"; fi
12 # Creates a temporary file and exports the name of the file to
13 # the provided argument. Exits on error.
15 # Usage: create_tempfile TEMPFILE
21 echo "No argument passed to create_tempfile()"
25 if [ -x /bin
/tempfile
]
28 export $1="`tempfile`"
29 elif [ -x /bin
/mktemp
]
32 export $1="`mktemp /tmp/modtest.XXXXXX`"
34 echo "Don't know how to make a temporary file on this "
41 echo "Can't create temporary file."
45 export -f create_tempfile
47 if [ ! -e "tests/build" ]; then
48 echo Making build directory
for tests
51 if [ ! -e "tests/tmp" ]; then
52 echo Making temporary directory
for tests
56 for config
in --enable-zlib --disable-zlib; do
57 echo Building with
$config...
60 ..
/..
/configure
$config CFLAGS
="-DJUST_TESTING -g -Wall" >/dev
/null
62 # ismod.static doesn't build with -DJUST_TESTING and --enable-zlib
63 make insmod.static
>/dev
/null
2>&1 ||
touch insmod.static
67 echo Testing with
$config...
68 if grep -q CONFIG_USE_ZLIB
=1 tests
/build
/Makefile
; then
70 export CONFIG_HAVE_ZLIB
72 unset CONFIG_HAVE_ZLIB
75 # Create endianness links
76 case `file tests/build/modprobe` in
79 *) echo Unknown endian
! >&2; exit 1;;
81 ln -sfn 64-$ENDIAN tests
/data
/64
82 ln -sfn 32-$ENDIAN tests
/data
/32
84 PATH
=`pwd`/tests
/build
:$PATH
86 # By default, we want to look like a new kernel.
90 MODTEST_OVERRIDE_ROOT
=tests
/tmp
91 export MODTEST_OVERRIDE_ROOT
93 if [ $# -eq 1 ]; then DOING
=0; else DOING
=1; fi
95 for dir
in `find tests/* -type d | sort`
97 # data, build and tmp dirs don't contain tests.
99 tests
/data
*) continue;;
100 tests
/build
*) continue;;
101 tests
/tmp
*) continue;;
104 if [ -z "$VERBOSE" ]; then
105 echo -n Running tests
for $dir.
107 echo Running tests
for $dir.
110 for f
in $dir/[0-9]*; do
111 # Ignore backups dir.
112 case "$f" in *~
) continue;; esac
114 if [ $DOING -eq 0 ]; then
115 case "$f" in *$1*) DOING
=1;; *) continue;; esac
119 if sh
-e $EXTRA_ARGS $f; then
120 if [ -z "$VERBOSE" ]; then
123 echo Tests
$f succeeded.
126 echo Test
for $f failed.
130 if [ -z "$VERBOSE" ]; then echo; fi