Back to home page

Wine source

 
 

    


File indexing completed on 2019-05-10 20:00:19

e39e8a172 Dimi*0001 #!/bin/sh
                0002 #
                0003 # Wrapper script to run tests from inside the Wine tree
                0004 #
                0005 # Usage: runtest [options] input_file
                0006 #
                0007 # Copyright 2002 Alexandre Julliard
                0008 # Copyright 2002 Dimitrie O. Paun
                0009 #
                0010 # This library is free software; you can redistribute it and/or
                0011 # modify it under the terms of the GNU Lesser General Public
                0012 # License as published by the Free Software Foundation; either
                0013 # version 2.1 of the License, or (at your option) any later version.
                0014 #
                0015 # This library is distributed in the hope that it will be useful,
                0016 # but WITHOUT ANY WARRANTY; without even the implied warranty of
                0017 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
                0018 # Lesser General Public License for more details.
                0019 #
                0020 # You should have received a copy of the GNU Lesser General Public
                0021 # License along with this library; if not, write to the Free Software
360a3f914 Jona*0022 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
e39e8a172 Dimi*0023 #
                0024 
                0025 usage()
                0026 {
2837103fe Fran*0027     cat >&2 <<EOF
e39e8a172 Dimi*0028 
443bfc99a Dyla*0029 Usage: $0 [options] [input_file]
e39e8a172 Dimi*0030 
6d1b4af58 Jeff*0031 input_file:  the source code for the test program
                0032 
e39e8a172 Dimi*0033 Options:
                0034     -q       quiet mode
                0035     -v       verbose mode (can be specified multiple times)
baac2a6c5 Jörg*0036     -i       interactive mode (runs even more tests)
e39e8a172 Dimi*0037     -s       announce successful tests
                0038     -p prog  name of the program to run for C tests
                0039     -P name  set the current platform name
                0040     -M names set the module names to be tested
                0041     -T dir   set Wine tree top directory (autodetected if not specified)
                0042 
                0043 EOF
                0044     exit 1
                0045 }
                0046 
                0047 # Default values
                0048 platform=$WINETEST_PLATFORM
                0049 WINETEST_DEBUG=${WINETEST_DEBUG:-1}
                0050 
                0051 # parse command-line options
a9b2ee2af Dyla*0052 while [ "$#" -gt 0 ]; do
e39e8a172 Dimi*0053     case "$1" in
                0054     -h)
                0055         usage
                0056     ;;
                0057     -p)
                0058         shift; program="$1"
                0059     ;;
                0060     -q)
                0061         WINETEST_DEBUG=0
                0062     ;;
                0063     -v)
                0064         WINETEST_DEBUG=`expr $WINETEST_DEBUG + 1`
                0065     ;;
baac2a6c5 Jörg*0066     -i)
                0067         WINETEST_INTERACTIVE=1
                0068         export WINETEST_INTERACTIVE
                0069     ;;
e39e8a172 Dimi*0070     -s)
                0071         WINETEST_REPORT_SUCCESS=1
                0072         export WINETEST_REPORT_SUCCESS
                0073     ;;
                0074     -P)
                0075         shift; platform="$1"
                0076     ;;
                0077     -M)
                0078         shift; modules="$1"
                0079     ;;
                0080     -T)
                0081         shift; topobjdir="$1"
3efdf38fc Fran*0082         if [ ! -d "$topobjdir" ]; then usage; fi
                0083     ;;
a9b2ee2af Dyla*0084     *)
3efdf38fc Fran*0085         break
e39e8a172 Dimi*0086     ;;
                0087     esac
                0088     shift
                0089 done        
                0090         
                0091 if [ -z "$program" ]; then
634052e4d Dyla*0092     # try to autodetect the test program name based on the working directory
                0093     working_path=`pwd`
96346ed62 Alex*0094     case $working_path in
                0095         */dlls/*/tests)
                0096           parent_path=`dirname "$working_path"`
1459a0105 Alex*0097           program=`basename "$parent_path"`_test.exe
96346ed62 Alex*0098           ;;
                0099         */dlls/*)
1459a0105 Alex*0100           program=tests/`basename "$working_path"`_test.exe
96346ed62 Alex*0101           ;;
                0102         */programs/*/tests)
                0103           parent_path=`dirname "$working_path"`
1459a0105 Alex*0104           program=`basename "$parent_path"`.exe_test.exe
96346ed62 Alex*0105           ;;
                0106         */programs/*)
1459a0105 Alex*0107           program=tests/`basename "$working_path"`.exe_test.exe
96346ed62 Alex*0108           ;;
                0109     esac
1459a0105 Alex*0110     test -f "$program" || program="$program".so
634052e4d Dyla*0111 fi
1459a0105 Alex*0112 
634052e4d Dyla*0113 if [ ! -f "$program" ]; then
                0114     echo "Can't find the test program, use the -p argument to specify one" 1>&2
                0115     usage
e39e8a172 Dimi*0116 fi
                0117 
                0118 # check/detect topobjdir
                0119 if [ -n "$topobjdir" ]; then
3efdf38fc Fran*0120     if [ ! -f "$topobjdir/server/wineserver" ]
                0121     then
634052e4d Dyla*0122         echo "Wrong -T argument, $topobjdir/server/wineserver does not exist" 1>&2
e39e8a172 Dimi*0123         usage
                0124     fi
                0125 else
                0126     if [ -f "./server/wineserver" ]; then topobjdir="."
                0127     elif [ -f "../server/wineserver" ]; then topobjdir=".."
                0128     elif [ -f "../../server/wineserver" ]; then topobjdir="../.."
                0129     elif [ -f "../../../server/wineserver" ]; then topobjdir="../../.."
8d88fe6d4 Dyla*0130     else
634052e4d Dyla*0131         echo "Can't find the top of the Wine tree (use the -T argument)" 1>&2
8d88fe6d4 Dyla*0132         usage
e39e8a172 Dimi*0133     fi
                0134 fi
                0135 
                0136 # set environment variables needed for Wine
                0137 
2052538a4 Alex*0138 if [ -n "$modules" ]; then
                0139     WINEDLLOVERRIDES="$WINEDLLOVERRIDES;$modules=b"
                0140     export WINEDLLOVERRIDES
e39e8a172 Dimi*0141 fi
                0142 WINETEST_PLATFORM=${platform:-wine}
                0143 export WINETEST_PLATFORM WINETEST_DEBUG
                0144 
d18cd8956 Dan *0145 # WINETEST_WRAPPER is normally empty, but can be set by caller, e.g.
                0146 #  WINETEST_WRAPPER=time
                0147 # would give data about how long each test takes, and
                0148 #  WINETEST_WRAPPER=valgrind
                0149 # would run the tests under valgrind to look for memory errors.
                0150 
443bfc99a Dyla*0151 exec $WINETEST_WRAPPER "$topobjdir/wine" "$program" "$@"