2002-01-14 20:56:46 +01:00
|
|
|
#!/usr/bin/perl
|
2002-01-10 04:30:21 +01:00
|
|
|
#
|
|
|
|
# Wrapper script to run tests from inside the Wine tree
|
|
|
|
#
|
2002-01-14 20:56:46 +01:00
|
|
|
# Usage: runtest [options] input_file [perl_args...]
|
2002-01-10 04:30:21 +01:00
|
|
|
#
|
2002-03-10 00:29:33 +01:00
|
|
|
# Copyright 2002 Alexandre Julliard
|
|
|
|
#
|
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This library is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with this library; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
2002-01-14 20:56:46 +01:00
|
|
|
|
2002-02-02 19:22:08 +01:00
|
|
|
use strict;
|
|
|
|
|
2002-01-14 20:56:46 +01:00
|
|
|
sub usage
|
2002-01-10 04:30:21 +01:00
|
|
|
{
|
2002-01-14 20:56:46 +01:00
|
|
|
print STDERR <<EOF;
|
|
|
|
|
|
|
|
Usage: $0 [options] input_file [perl_args...]
|
|
|
|
|
|
|
|
Options:
|
2002-02-02 19:22:08 +01:00
|
|
|
-q quiet mode
|
|
|
|
-v verbose mode (can be specified multiple times)
|
2002-04-19 02:01:52 +02:00
|
|
|
-s announce successful tests
|
2002-02-20 20:03:59 +01:00
|
|
|
-p prog name of the program to run for C tests
|
2002-02-02 19:22:08 +01:00
|
|
|
-I dir prepend dir to Perl include path
|
|
|
|
-P name set the current platform name
|
|
|
|
-M names set the module names to be tested
|
|
|
|
-T dir set Wine tree top directory (autodetected if not specified)
|
2002-01-14 20:56:46 +01:00
|
|
|
|
|
|
|
EOF
|
|
|
|
exit 1;
|
2002-01-10 04:30:21 +01:00
|
|
|
}
|
|
|
|
|
2002-01-14 20:56:46 +01:00
|
|
|
# default values
|
2002-02-02 19:22:08 +01:00
|
|
|
my $platform = $ENV{WINETEST_PLATFORM};
|
2002-01-14 20:56:46 +01:00
|
|
|
$ENV{WINETEST_DEBUG} ||= 1;
|
|
|
|
|
2002-02-02 19:22:08 +01:00
|
|
|
my $topobjdir;
|
|
|
|
my $infile;
|
2002-02-20 20:03:59 +01:00
|
|
|
my $program;
|
2002-02-02 19:22:08 +01:00
|
|
|
my @include_dirs;
|
|
|
|
my @modules;
|
|
|
|
|
2002-01-14 20:56:46 +01:00
|
|
|
# parse command-line options
|
|
|
|
while ($#ARGV >= 0)
|
|
|
|
{
|
2002-02-02 19:22:08 +01:00
|
|
|
my $arg = shift @ARGV;
|
2002-01-14 20:56:46 +01:00
|
|
|
if ($arg eq "-h") { usage; }
|
2002-02-20 20:03:59 +01:00
|
|
|
if ($arg eq "-p") { $program = shift @ARGV; next; }
|
2002-01-14 20:56:46 +01:00
|
|
|
if ($arg eq "-q") { $ENV{WINETEST_DEBUG} = 0; next; }
|
|
|
|
if ($arg eq "-v") { $ENV{WINETEST_DEBUG}++; next; }
|
2002-04-19 02:01:52 +02:00
|
|
|
if ($arg eq "-s") { $ENV{WINETEST_REPORT_SUCCESS} = 1; next;}
|
2002-01-14 20:56:46 +01:00
|
|
|
if ($arg eq "-P") { $platform = shift @ARGV; next; }
|
2002-02-02 19:22:08 +01:00
|
|
|
if ($arg eq "-M") { push @modules, split /,/, shift @ARGV; next; }
|
2002-01-14 20:56:46 +01:00
|
|
|
if ($arg eq "-I") { push @include_dirs, shift @ARGV; next; }
|
|
|
|
if ($arg eq "-T")
|
|
|
|
{
|
|
|
|
$topobjdir = shift @ARGV;
|
|
|
|
usage unless (-d $topobjdir);
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
$infile = $arg;
|
|
|
|
last;
|
|
|
|
}
|
|
|
|
|
|
|
|
# we must have found an input file
|
|
|
|
usage unless defined($infile);
|
|
|
|
|
2002-02-20 20:03:59 +01:00
|
|
|
if ($infile =~ /\.c$/ && !defined($program))
|
|
|
|
{
|
|
|
|
# set program to the .c file base name if not specified otherwise
|
|
|
|
($program = $infile) =~ s/\.c$//;
|
|
|
|
}
|
|
|
|
|
2002-01-14 20:56:46 +01:00
|
|
|
# check/detect topobjdir
|
|
|
|
if (defined($topobjdir))
|
|
|
|
{
|
|
|
|
unless (-f $topobjdir . "/server/wineserver")
|
|
|
|
{
|
|
|
|
printf STDERR "Wrong -T argument, %s/server/wineserver does not exist\n", $topobjdir;
|
|
|
|
usage;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else # try to detect it automatically
|
|
|
|
{
|
|
|
|
if (-f "./server/wineserver") { $topobjdir = "."; }
|
|
|
|
elsif (-f "../server/wineserver") { $topobjdir = ".."; }
|
|
|
|
elsif (-f "../../server/wineserver") { $topobjdir = "../.."; }
|
|
|
|
elsif (-f "../../../server/wineserver") { $topobjdir = "../../.."; }
|
|
|
|
}
|
2002-01-10 04:30:21 +01:00
|
|
|
|
2002-01-14 20:56:46 +01:00
|
|
|
# check for include/ dir in script source directory and append it to search path
|
|
|
|
my $basedir = $0;
|
|
|
|
if ($basedir =~ /\//) { $basedir =~ s!/[^/]+$!!; }
|
|
|
|
else { $basedir = "."; }
|
|
|
|
if (-d $basedir . "/include") { push @include_dirs, $basedir . "/include"; }
|
|
|
|
|
|
|
|
$ENV{PERL5LIB} = join( ":", @include_dirs, split( ":", $ENV{PERL5LIB} ) );
|
2002-02-02 19:22:08 +01:00
|
|
|
if (@modules)
|
|
|
|
{
|
|
|
|
if (defined($ENV{WINEOPTIONS})) { $ENV{WINEOPTIONS} .= " "; }
|
|
|
|
$ENV{WINEOPTIONS} .= "--dll " . join(',',@modules) . "=b";
|
|
|
|
}
|
2002-01-14 20:56:46 +01:00
|
|
|
|
2002-02-20 20:03:59 +01:00
|
|
|
# set environment variables needed for Wine
|
2002-01-14 20:56:46 +01:00
|
|
|
if (defined($topobjdir))
|
|
|
|
{
|
2002-02-20 20:03:59 +01:00
|
|
|
chop($topobjdir = `cd $topobjdir && pwd`);
|
2002-03-28 19:21:06 +01:00
|
|
|
$ENV{LD_LIBRARY_PATH} = $topobjdir . ":" . $ENV{LD_LIBRARY_PATH};
|
2002-05-22 23:32:49 +02:00
|
|
|
$ENV{WINEDLLPATH} = $topobjdir . "/dlls:" . $topobjdir . "/programs";
|
2002-03-28 19:21:06 +01:00
|
|
|
$ENV{WINESERVER} = $topobjdir . "/server/wineserver";
|
|
|
|
$ENV{WINELOADER} = $topobjdir . "/wine";
|
2002-02-20 20:03:59 +01:00
|
|
|
$ENV{WINETEST_PLATFORM} = $platform || "wine";
|
2002-05-22 23:32:49 +02:00
|
|
|
$program ||= "winetest.exe";
|
|
|
|
exec $ENV{WINELOADER}, $program, $infile, @ARGV;
|
2002-02-20 20:03:59 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$ENV{WINETEST_PLATFORM} = $platform || "windows";
|
2002-01-14 20:56:46 +01:00
|
|
|
}
|
2002-02-20 20:03:59 +01:00
|
|
|
|
|
|
|
# and now exec the program
|
2002-05-22 23:32:49 +02:00
|
|
|
$program ||= "winetest.exe";
|
2002-02-20 20:03:59 +01:00
|
|
|
exec $program, $infile, @ARGV;
|
|
|
|
print STDERR "Could not exec $program\n";
|
|
|
|
exit 1;
|