From 9384184a11bfce925552e7cc738aa53adfa348b7 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 14 Jan 2002 19:56:46 +0000 Subject: [PATCH] Rewrote runtest in Perl so that it can be used on the Windows side. Added options for include directories, debug level and target platform. selection. --- Make.rules.in | 3 +- dlls/make_dlls | 5 ++ programs/winetest/runtest | 113 +++++++++++++++++++++++++++++--------- 3 files changed, 95 insertions(+), 26 deletions(-) diff --git a/Make.rules.in b/Make.rules.in index 878923bc582..7866e7d1e3e 100644 --- a/Make.rules.in +++ b/Make.rules.in @@ -61,6 +61,7 @@ ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check WINETEST = $(TOPOBJDIR)/programs/winetest/winetest RUNTEST = $(TOPSRCDIR)/programs/winetest/runtest +RUNTESTFLAGS = -q -P wine -T $(TOPOBJDIR) TESTRESULTS = $(PLTESTS:.pl=.ok) $(CTESTS:.c=.ok) WINEBUILD = $(TOPOBJDIR)/tools/winebuild/winebuild MAKEDEP = $(TOPOBJDIR)/tools/makedep @@ -127,7 +128,7 @@ LINTS = $(C_SRCS:.c=.ln) $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 ) .pl.ok: - $(RUNTEST) $(TOPOBJDIR) $< $(RUNTESTFLAGS) && touch $@ + $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@ .PHONY: all install uninstall clean distclean depend dummy test testclean diff --git a/dlls/make_dlls b/dlls/make_dlls index 5db5b3ed3b0..7a51bb0d96f 100755 --- a/dlls/make_dlls +++ b/dlls/make_dlls @@ -198,6 +198,9 @@ print NEWMAKE sort @depends; print NEWMAKE <= 0) +{ + $arg = shift @ARGV; + if ($arg eq "-h") { usage; } + if ($arg eq "-q") { $ENV{WINETEST_DEBUG} = 0; next; } + if ($arg eq "-v") { $ENV{WINETEST_DEBUG}++; next; } + if ($arg eq "-I") { $ENV{WINETEST_DEBUG} = 0; next; } + if ($arg eq "-P") { $platform = shift @ARGV; next; } + 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); + +# 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 = "../../.."; } +} + +# set environment variables needed for Wine +if (defined($topobjdir)) +{ + chop($topobjdir = `cd $topobjdir && pwd`); + $ENV{LD_LIBRARY_PATH} = $topobjdir . "/dlls:" . $topobjdir . ":" . $ENV{LD_LIBRARY_PATH}; + $ENV{WINESERVER} ||= $topobjdir . "/server/wineserver"; + $ENV{WINELOADER} ||= $topobjdir . "/wine"; + $ENV{WINETEST_PLATFORM} = $platform || "wine"; +} else - echo "$1 is not a directory" - usage -fi -LD_LIBRARY_PATH="$topobjdir/dlls:$topobjdir:$LD_LIBRARY_PATH" -export LD_LIBRARY_PATH -WINESERVER="$topobjdir/server/wineserver" -export WINESERVER -WINELOADER="$topobjdir/wine" -export WINELOADER -testdir=`dirname "$0"` -infile="$2" -shift 2 -exec $topobjdir/programs/winetest/winetest -- -I "$testdir" $infile $@ +{ + $ENV{WINETEST_PLATFORM} = $platform || "windows"; +} + +# 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} ) ); + +# and now exec winetest +if (defined($topobjdir)) +{ + exec $topobjdir . "/programs/winetest/winetest", "--", $infile, @ARGV; +} +exec "winetest", $infile, @ARGV; +print STDERR "Could not exec winetest\n";