README: Update for kernel 2.6.
[wine/multimedia.git] / tools / runtest
blobb440aab289f6b20445de49061e4fea553f4a2db5
1 #!/bin/sh
3 # Wrapper script to run tests from inside the Wine tree
5 # Usage: runtest [options] input_file
7 # Copyright 2002 Alexandre Julliard
8 # Copyright 2002 Dimitrie O. Paun
10 # This library is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU Lesser General Public
12 # License as published by the Free Software Foundation; either
13 # version 2.1 of the License, or (at your option) any later version.
15 # This library is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # Lesser General Public License for more details.
20 # You should have received a copy of the GNU Lesser General Public
21 # License along with this library; if not, write to the Free Software
22 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 usage()
27 cat >&2 <<EOF
29 Usage: $0 [options] input_file
31 Options:
32 -q quiet mode
33 -v verbose mode (can be specified multiple times)
34 -s announce successful tests
35 -p prog name of the program to run for C tests
36 -P name set the current platform name
37 -M names set the module names to be tested
38 -T dir set Wine tree top directory (autodetected if not specified)
40 EOF
41 exit 1
44 # Default values
45 platform=$WINETEST_PLATFORM
46 WINETEST_DEBUG=${WINETEST_DEBUG:-1}
48 # parse command-line options
49 while [ "$#" != 0 ]; do
50 case "$1" in
51 -h)
52 usage
54 -p)
55 shift; program="$1"
57 -q)
58 WINETEST_DEBUG=0
60 -v)
61 WINETEST_DEBUG=`expr $WINETEST_DEBUG + 1`
63 -s)
64 WINETEST_REPORT_SUCCESS=1
65 export WINETEST_REPORT_SUCCESS
67 -P)
68 shift; platform="$1"
70 -M)
71 shift; modules="$1"
73 -T)
74 shift; topobjdir="$1"
75 if [ ! -d "$topobjdir" ]; then usage; fi
77 --)
78 break
81 infile="$1"
83 esac
84 shift
85 done
87 # we must have found an input file
88 if [ ! -f "$infile" ]; then usage; fi
90 # set program to the .c file base name if not specified otherwise
91 if [ -z "$program" ]; then
92 program=`basename "$infile" .c`
95 # check/detect topobjdir
96 if [ -n "$topobjdir" ]; then
97 if [ ! -f "$topobjdir/server/wineserver" ]
98 then
99 echo "Wrong -T argument, $topobjdir/server/wineserver does not exist" 2>&1
100 usage
102 else
103 if [ -f "./server/wineserver" ]; then topobjdir="."
104 elif [ -f "../server/wineserver" ]; then topobjdir=".."
105 elif [ -f "../../server/wineserver" ]; then topobjdir="../.."
106 elif [ -f "../../../server/wineserver" ]; then topobjdir="../../.."
110 # set environment variables needed for Wine
112 if [ -n "$modules" ]; then
113 WINEDLLOVERRIDES="$WINEDLLOVERRIDES;$modules=b"
114 export WINEDLLOVERRIDES
116 WINETEST_PLATFORM=${platform:-wine}
117 export WINETEST_PLATFORM WINETEST_DEBUG
119 exec "$topobjdir/wine" "$program" "$infile" "$@"