wineconsole: Updated Norwegian Bokmål translation.
[wine/hacks.git] / tools / runtest
blob43f513f973357254d1da45926349d104baecaed2
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 input_file: the source code for the test program
33 Options:
34 -q quiet mode
35 -v verbose mode (can be specified multiple times)
36 -s announce successful tests
37 -p prog name of the program to run for C tests
38 -P name set the current platform name
39 -M names set the module names to be tested
40 -T dir set Wine tree top directory (autodetected if not specified)
42 EOF
43 exit 1
46 # Default values
47 platform=$WINETEST_PLATFORM
48 WINETEST_DEBUG=${WINETEST_DEBUG:-1}
50 # parse command-line options
51 while [ "$#" != 0 ]; do
52 case "$1" in
53 -h)
54 usage
56 -p)
57 shift; program="$1"
59 -q)
60 WINETEST_DEBUG=0
62 -v)
63 WINETEST_DEBUG=`expr $WINETEST_DEBUG + 1`
65 -s)
66 WINETEST_REPORT_SUCCESS=1
67 export WINETEST_REPORT_SUCCESS
69 -P)
70 shift; platform="$1"
72 -M)
73 shift; modules="$1"
75 -T)
76 shift; topobjdir="$1"
77 if [ ! -d "$topobjdir" ]; then usage; fi
79 --)
80 break
83 infile="$1"
85 esac
86 shift
87 done
89 # we must have found an input file
90 if [ ! -f "$infile" ]; then usage; fi
92 # set program to the .c file base name if not specified otherwise
93 if [ -z "$program" ]; then
94 program=`basename "$infile" .c`
97 # check/detect topobjdir
98 if [ -n "$topobjdir" ]; then
99 if [ ! -f "$topobjdir/server/wineserver" ]
100 then
101 echo "Wrong -T argument, $topobjdir/server/wineserver does not exist" 2>&1
102 usage
104 else
105 if [ -f "./server/wineserver" ]; then topobjdir="."
106 elif [ -f "../server/wineserver" ]; then topobjdir=".."
107 elif [ -f "../../server/wineserver" ]; then topobjdir="../.."
108 elif [ -f "../../../server/wineserver" ]; then topobjdir="../../.."
112 # set environment variables needed for Wine
114 if [ -n "$modules" ]; then
115 WINEDLLOVERRIDES="$WINEDLLOVERRIDES;$modules=b"
116 export WINEDLLOVERRIDES
118 WINETEST_PLATFORM=${platform:-wine}
119 export WINETEST_PLATFORM WINETEST_DEBUG
121 exec "$topobjdir/wine" "$program" "$infile" "$@"