1 #!/bin/sh
2 #
3 # Wrapper script to run tests from inside the Wine tree
4 #
5 # Usage: runtest [options] input_file
6 #
7 # Copyright 2002 Alexandre Julliard
8 # Copyright 2002 Dimitrie O. Paun
9 #
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.
14 #
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.
19 #
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
23 #
24
25 usage()
26 {
27 cat >&2 <<EOF
28
29 Usage: $0 [options] [input_file]
30
31 input_file: the source code for the test program
32
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)
41
42 EOF
43 exit 1
44 }
45
46 # Default values
47 platform=$WINETEST_PLATFORM
48 WINETEST_DEBUG=${WINETEST_DEBUG:-1}
49
50 # parse command-line options
51 while [ "$#" -gt 0 ]; do
52 case "$1" in
53 -h)
54 usage
55 ;;
56 -p)
57 shift; program="$1"
58 ;;
59 -q)
60 WINETEST_DEBUG=0
61 ;;
62 -v)
63 WINETEST_DEBUG=`expr $WINETEST_DEBUG + 1`
64 ;;
65 -s)
66 WINETEST_REPORT_SUCCESS=1
67 export WINETEST_REPORT_SUCCESS
68 ;;
69 -P)
70 shift; platform="$1"
71 ;;
72 -M)
73 shift; modules="$1"
74 ;;
75 -T)
76 shift; topobjdir="$1"
77 if [ ! -d "$topobjdir" ]; then usage; fi
78 ;;
79 *)
80 break
81 ;;
82 esac
83 shift
84 done
85
86 if [ -z "$program" ]; then
87 # try to autodetect the test program name based on the working directory
88 working_path=`pwd`
89 working_basename=`basename "$working_path"`
90 if [ "$working_basename" = "tests" ]; then
91 parent_path=`dirname "$working_path"`
92 parent_basename=`basename "$parent_path"`
93 program="${parent_basename}_test.exe.so"
94 elif [ -d "tests" ]; then
95 program="tests/${working_basename}_test.exe.so"
96 fi
97 fi
98 if [ ! -f "$program" ]; then
99 echo "Can't find the test program, use the -p argument to specify one" 1>&2
100 usage
101 fi
102
103 # check/detect topobjdir
104 if [ -n "$topobjdir" ]; then
105 if [ ! -f "$topobjdir/server/wineserver" ]
106 then
107 echo "Wrong -T argument, $topobjdir/server/wineserver does not exist" 1>&2
108 usage
109 fi
110 else
111 if [ -f "./server/wineserver" ]; then topobjdir="."
112 elif [ -f "../server/wineserver" ]; then topobjdir=".."
113 elif [ -f "../../server/wineserver" ]; then topobjdir="../.."
114 elif [ -f "../../../server/wineserver" ]; then topobjdir="../../.."
115 else
116 echo "Can't find the top of the Wine tree (use the -T argument)" 1>&2
117 usage
118 fi
119 fi
120
121 # set environment variables needed for Wine
122
123 if [ -n "$modules" ]; then
124 WINEDLLOVERRIDES="$WINEDLLOVERRIDES;$modules=b"
125 export WINEDLLOVERRIDES
126 fi
127 WINETEST_PLATFORM=${platform:-wine}
128 export WINETEST_PLATFORM WINETEST_DEBUG
129
130 # WINETEST_WRAPPER is normally empty, but can be set by caller, e.g.
131 # WINETEST_WRAPPER=time
132 # would give data about how long each test takes, and
133 # WINETEST_WRAPPER=valgrind
134 # would run the tests under valgrind to look for memory errors.
135
136 exec $WINETEST_WRAPPER "$topobjdir/wine" "$program" "$@"
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.