shlwapi/tests: Fix the spelling of a couple of ok() messages.
[wine/zf.git] / tools / runtest
blob3299d6135c8143f7c9fbfe19b61236cbbe199a67
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 -i interactive mode (runs even more tests)
37 -s announce successful tests
38 -p prog name of the program to run for C tests
39 -P name set the current platform name
40 -M names set the module names to be tested
41 -T dir set Wine tree top directory (autodetected if not specified)
43 EOF
44 exit 1
47 # Default values
48 platform=$WINETEST_PLATFORM
49 WINETEST_DEBUG=${WINETEST_DEBUG:-1}
51 # parse command-line options
52 while [ "$#" -gt 0 ]; do
53 case "$1" in
54 -h)
55 usage
57 -p)
58 shift; program="$1"
60 -q)
61 WINETEST_DEBUG=0
63 -v)
64 WINETEST_DEBUG=`expr $WINETEST_DEBUG + 1`
66 -i)
67 WINETEST_INTERACTIVE=1
68 export WINETEST_INTERACTIVE
70 -s)
71 WINETEST_REPORT_SUCCESS=1
72 export WINETEST_REPORT_SUCCESS
74 -P)
75 shift; platform="$1"
77 -M)
78 shift; modules="$1"
80 -T)
81 shift; topobjdir="$1"
82 if [ ! -d "$topobjdir" ]; then usage; fi
85 break
87 esac
88 shift
89 done
91 if [ -z "$program" ]; then
92 # try to autodetect the test program name based on the working directory
93 working_path=`pwd`
94 case $working_path in
95 */dlls/*/tests)
96 parent_path=`dirname "$working_path"`
97 program=`basename "$parent_path"`_test.exe
99 */dlls/*)
100 program=tests/`basename "$working_path"`_test.exe
102 */programs/*/tests)
103 parent_path=`dirname "$working_path"`
104 program=`basename "$parent_path"`.exe_test.exe
106 */programs/*)
107 program=tests/`basename "$working_path"`.exe_test.exe
109 esac
110 test -f "$program" || program="$program".so
113 if [ ! -f "$program" ]; then
114 echo "Can't find the test program, use the -p argument to specify one" 1>&2
115 usage
118 # check/detect topobjdir
119 if [ -n "$topobjdir" ]; then
120 if [ ! -f "$topobjdir/server/wineserver" ]
121 then
122 echo "Wrong -T argument, $topobjdir/server/wineserver does not exist" 1>&2
123 usage
125 else
126 if [ -f "./server/wineserver" ]; then topobjdir="."
127 elif [ -f "../server/wineserver" ]; then topobjdir=".."
128 elif [ -f "../../server/wineserver" ]; then topobjdir="../.."
129 elif [ -f "../../../server/wineserver" ]; then topobjdir="../../.."
130 else
131 echo "Can't find the top of the Wine tree (use the -T argument)" 1>&2
132 usage
136 # set environment variables needed for Wine
138 if [ -n "$modules" ]; then
139 WINEDLLOVERRIDES="$WINEDLLOVERRIDES;$modules=b"
140 export WINEDLLOVERRIDES
142 WINETEST_PLATFORM=${platform:-wine}
143 export WINETEST_PLATFORM WINETEST_DEBUG
145 # WINETEST_WRAPPER is normally empty, but can be set by caller, e.g.
146 # WINETEST_WRAPPER=time
147 # would give data about how long each test takes, and
148 # WINETEST_WRAPPER=valgrind
149 # would run the tests under valgrind to look for memory errors.
151 exec $WINETEST_WRAPPER "$topobjdir/wine" "$program" "$@"