testbot/build(*): Rename BuildSingleTest.pl to Build.pl for consistency with the type of the corresponding tasks.
Francois Gouget
fgouget at codeweavers.com
Thu Oct 11 10:11:46 CDT 2012
(*) Compatibility Note: This requires updating the WineTestBot checkout on the build VM.
---
testbot/bin/WineRunBuild.pl | 8 +-
testbot/bin/build/Build.pl | 379 ++++++++++++++++++++++++++++++++++
testbot/bin/build/BuildSingleTest.pl | 379 ----------------------------------
3 files changed, 383 insertions(+), 383 deletions(-)
create mode 100755 testbot/bin/build/Build.pl
delete mode 100755 testbot/bin/build/BuildSingleTest.pl
diff --git a/testbot/bin/WineRunBuild.pl b/testbot/bin/WineRunBuild.pl
index 56161da..868b378 100755
--- a/testbot/bin/WineRunBuild.pl
+++ b/testbot/bin/WineRunBuild.pl
@@ -86,7 +86,7 @@ sub ProcessRawlog
while (defined($Line = <RAWLOG>))
{
chomp($Line);
- if ($Line =~ m/^BuildSingleTest: (.*)$/)
+ if ($Line =~ m/^Build: (.*)$/)
{
if ($1 eq "ok")
{
@@ -241,7 +241,7 @@ if (defined($ErrMessage))
$FullErrFileName, $Job, $Step, $Task;
}
my $Script = "#!/bin/sh\n";
-$Script .= "$BinDir/build/BuildSingleTest.pl $FileName " . $Step->FileType .
+$Script .= "$BinDir/build/Build.pl $FileName " . $Step->FileType .
" $BaseName 32";
if ($Run64)
{
@@ -251,14 +251,14 @@ $Script .= "\n";
$ErrMessage = $VM->RunScriptInGuestTimeout("", $Script, $Task->Timeout);
if (defined($ErrMessage))
{
- $VM->CopyFileFromGuestToHost("$LogDir/BuildSingleTest.log",
+ $VM->CopyFileFromGuestToHost("$LogDir/Build.log",
$FullRawlogFileName);
ProcessRawlog($FullRawlogFileName, $FullLogFileName, $FullErrFileName);
FatalError "Failure running script in VM: $ErrMessage\n",
$FullErrFileName, $Job, $Step, $Task;
}
-$ErrMessage = $VM->CopyFileFromGuestToHost("$LogDir/BuildSingleTest.log",
+$ErrMessage = $VM->CopyFileFromGuestToHost("$LogDir/Build.log",
$FullRawlogFileName);
if (defined($ErrMessage))
{
diff --git a/testbot/bin/build/Build.pl b/testbot/bin/build/Build.pl
new file mode 100755
index 0000000..a37537e
--- /dev/null
+++ b/testbot/bin/build/Build.pl
@@ -0,0 +1,379 @@
+#!/usr/bin/perl -Tw
+#
+# Performs the 'build' task in the build machine. Specifically this applies a
+# conformance test patch, rebuilds the impacted test and retrieves the
+# resulting 32 and 64 bit binaries.
+#
+# Copyright 2009 Ge van Geldorp
+#
+# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+
+use strict;
+
+my $Dir;
+sub BEGIN
+{
+ $main::BuildEnv = 1;
+ $0 =~ m=^(.*)/[^/]*$=;
+ $Dir = $1;
+}
+use lib "$Dir/../../lib";
+
+use WineTestBot::Config;
+
+sub InfoMsg
+{
+ my $oldumask = umask(002);
+ if (open LOGFILE, ">>$LogDir/Build.log")
+ {
+ print LOGFILE @_;
+ close LOGFILE;
+ }
+ umask($oldumask);
+}
+
+sub LogMsg
+{
+ my $oldumask = umask(002);
+ if (open LOGFILE, ">>$LogDir/Build.log")
+ {
+ print LOGFILE "Build: ", @_;
+ close LOGFILE;
+ }
+ umask($oldumask);
+}
+
+sub FatalError
+{
+ LogMsg @_;
+
+ exit 1;
+}
+
+sub ApplyPatch
+{
+ my ($PatchFile, $PatchType, $BaseName) = @_;
+
+ my $NeedMakefile = 0;
+ my $NeedMakeInclude = !1;
+ my $NeedBuildDeps = !1;
+ my $NeedImplib = !1;
+ my $NeedAutoconf = !1;
+ my $NeedConfigure = !1;
+ if (open (FH, "<$PatchFile"))
+ {
+ my $Line;
+ while (defined($Line = <FH>) &&
+ ($NeedMakefile == 0 || ! $NeedMakeInclude || ! $NeedBuildDeps ||
+ ! $NeedImplib || ! $NeedAutoconf || ! $NeedConfigure))
+ {
+ if ($Line =~ m=^diff.*tests/Makefile\.in=)
+ {
+ $NeedMakefile = 1;
+ }
+ elsif ($Line =~ m=^diff.*include/.*\.idl=)
+ {
+ $NeedMakeInclude = 1;
+ }
+ elsif ($Line =~ m=^diff.*\.spec=)
+ {
+ $NeedBuildDeps = 1;
+ }
+ elsif ($PatchType eq "dlls" && $Line =~ m=^diff.*$BaseName/Makefile\.in=)
+ {
+ $NeedImplib = 1;
+ }
+ elsif ($Line =~ m=^diff.*configure\.ac=)
+ {
+ $NeedAutoconf = 1;
+ }
+ elsif ($Line =~ m=^diff.*configure=)
+ {
+ $NeedConfigure = 1;
+ }
+ }
+ close FH;
+ }
+
+ InfoMsg "Applying patch\n";
+ system("git apply --verbose --directory=$DataDir/wine-git $PatchFile " .
+ ">> $LogDir/Build.log 2>&1");
+ if ($? != 0)
+ {
+ LogMsg "Patch failed to apply\n";
+ return (-1, $NeedMakeInclude, $NeedBuildDeps, $NeedImplib, $NeedConfigure);
+ }
+
+ if ($NeedAutoconf && ! $NeedConfigure)
+ {
+ InfoMsg "Running autoconf\n";
+ system("( cd $DataDir/wine-git && set -x && " .
+ " autoconf --output configure configure.ac " .
+ ") >>$LogDir/Build.log 2>&1");
+ if ($? != 0)
+ {
+ LogMsg "Autoconf failed\n";
+ return (-1, $NeedMakeInclude, $NeedBuildDeps, $NeedImplib,
+ $NeedConfigure);
+ }
+ $NeedConfigure = 1;
+ }
+
+ if ($NeedImplib)
+ {
+ if (open (FH, "<$DataDir/wine-git/$PatchType/$BaseName/Makefile.in"))
+ {
+ $NeedImplib = !1;
+ my $Line;
+ while (defined($Line = <FH>) && ! $NeedImplib)
+ {
+ $NeedImplib = ($Line =~ m/^\s*IMPORTLIB\s*=.*$BaseName/)
+ }
+ close FH;
+ }
+ }
+
+ return ($NeedMakefile, $NeedMakeInclude, $NeedBuildDeps, $NeedImplib,
+ $NeedConfigure);
+}
+
+my $ncpus;
+sub CountCPUs()
+{
+ if (open(my $fh, "<", "/proc/cpuinfo"))
+ {
+ # Linux
+ map { $ncpus++ if (/^processor/); } <$fh>;
+ close($fh);
+ }
+ $ncpus ||= 1;
+}
+
+sub BuildTestExecutable
+{
+ my ($BaseName, $PatchType, $Bits, $NeedConfigure, $NeedMakefile,
+ $NeedMakeInclude, $NeedBuildDeps, $NeedImplib) = @_;
+
+ if ($NeedConfigure)
+ {
+ InfoMsg "Reconfigure $Bits-bit crossbuild\n";
+ my $Host = ($Bits == 64 ? "x86_64-w64-mingw32" : "i686-pc-mingw32");
+ system("( cd $DataDir/build-mingw$Bits && set -x && " .
+ " ../wine-git/configure --host=$Host --with-wine-tools=../build-native --without-x --without-freetype " .
+ ") >>$LogDir/Build.log 2>&1");
+ if ($? != 0)
+ {
+ LogMsg "Reconfigure of $Bits-bit crossbuild failed\n";
+ return !1;
+ }
+ }
+
+ if ($NeedMakeInclude || $NeedConfigure)
+ {
+ InfoMsg "Recreating include/Makefile\n";
+ system("( cd $DataDir/build-mingw$Bits && set -x && " .
+ " ./config.status --file include/Makefile:Make.vars.in:include/Makefile.in " .
+ ") >>$LogDir/Build.log 2>&1");
+ if ($? != 0)
+ {
+ LogMsg "Recreation of include/Makefile failed\n";
+ return !1;
+ }
+
+ system("( cd $DataDir/build-mingw$Bits && set -x && " .
+ " make -j$ncpus include " .
+ ") >> $LogDir/Build.log 2>&1");
+ if ($? != 0)
+ {
+ LogMsg "Make in include dir failed\n";
+ return !1;
+ }
+ }
+
+ if ($NeedImplib || $NeedConfigure)
+ {
+ InfoMsg "Rebuilding $BaseName import lib\n";
+ system("( cd $DataDir/build-mingw$Bits && set -x && " .
+ " ./config.status --file $PatchType/$BaseName/Makefile:Make.vars.in:$PatchType/$BaseName/Makefile.in " .
+ ") >>$LogDir/Build.log 2>&1");
+ if ($? != 0)
+ {
+ LogMsg "Unable to regenerate $PatchType/$BaseName/Makefile\n";
+ }
+ else
+ {
+ system("( cd $DataDir/build-mingw$Bits && set -x && " .
+ " make -j$ncpus -C $PatchType/$BaseName lib$BaseName.a " .
+ ") >>$LogDir/Build.log 2>&1");
+ if ($? != 0)
+ {
+ InfoMsg "Make of import library failed\n";
+ }
+ }
+ }
+
+ if ($NeedMakefile || $NeedConfigure)
+ {
+ InfoMsg "Recreating tests/Makefile\n";
+ system("( cd $DataDir/build-mingw$Bits && set -x && " .
+ " ./config.status --file $PatchType/$BaseName/tests/Makefile:Make.vars.in:$PatchType/$BaseName/tests/Makefile.in " .
+ ") >>$LogDir/Build.log 2>&1");
+ if ($? != 0)
+ {
+ LogMsg "Recreation of tests/Makefile failed\n";
+ return !1;
+ }
+ }
+
+ if ($NeedBuildDeps)
+ {
+ InfoMsg "Making build dependencies\n";
+ system("( cd $DataDir/build-mingw$Bits && set -x && " .
+ " make -j$ncpus __builddeps__ " .
+ ") >>$LogDir/Build.log 2>&1");
+ if ($? != 0)
+ {
+ LogMsg "Making build dependencies failed\n";
+ return !1;
+ }
+ }
+
+ my $TestsDir = "$PatchType/$BaseName/tests";
+ my $TestExecutable = "$TestsDir/$BaseName";
+ if ($PatchType eq "programs")
+ {
+ $TestExecutable .= ".exe";
+ }
+ $TestExecutable .= "_test.exe";
+ unlink("$DataDir/build-mingw${Bits}/$TestExecutable");
+
+ InfoMsg "Making test executable\n";
+ system("( cd $DataDir/build-mingw$Bits && set -x && " .
+ " make -j$ncpus -C $TestsDir " .
+ ") >>$LogDir/Build.log 2>&1");
+ if ($? != 0)
+ {
+ LogMsg "Make failed\n";
+ return !1;
+ }
+ if (! -f "$DataDir/build-mingw${Bits}/$TestExecutable")
+ {
+ LogMsg "Make didn't produce a $TestExecutable file\n";
+ return !1;
+ }
+
+ return 1;
+}
+
+$ENV{PATH} = "/usr/lib/ccache:/usr/bin:/bin";
+delete $ENV{ENV};
+
+# Start with clean logfile
+unlink("$LogDir/Build.log");
+
+my ($PatchFile, $PatchType, $BaseName, $BitIndicators) = @ARGV;
+if (! $PatchFile || ! $PatchType || ! $BaseName || !$BitIndicators)
+{
+ FatalError "Usage: Build.pl <patchfile> <patchtype> <basename> <bits>\n";
+}
+
+# Untaint parameters
+if ($PatchFile =~ m/^([\w_.\-]+)$/)
+{
+ $PatchFile = "$DataDir/staging/$1";
+ if (! -r $PatchFile)
+ {
+ FatalError "Patch file $PatchFile not readable\n";
+ }
+}
+else
+{
+ FatalError "Invalid patch file $PatchFile\n";
+}
+
+if ($PatchType =~ m/^patch(dlls|programs)$/)
+{
+ $PatchType = $1;
+}
+else
+{
+ FatalError "Invalid patch type $PatchType\n";
+}
+
+if ($BaseName =~ m/^([\w_.\-]+)$/)
+{
+ $BaseName = $1;
+}
+else
+{
+ FatalError "Invalid DLL base name $BaseName\n";
+}
+
+my $Run32 = !1;
+my $Run64 = !1;
+if ($BitIndicators =~ m/^([\d,]+)$/)
+{
+ my @Bits = split /,/, $1;
+ foreach my $BitsValue (@Bits)
+ {
+ if ($BitsValue == 32)
+ {
+ $Run32 = 1;
+ }
+ elsif ($BitsValue == 64)
+ {
+ $Run64 = 1;
+ }
+ else
+ {
+ FatalError "Invalid number of bits $BitsValue\n";
+ }
+ }
+ if (! $Run32 && ! $Run64)
+ {
+ FatalError "Specify at least one of 32 or 64 bits\n";
+ }
+}
+else
+{
+ FatalError "Invalid number of bits $BitIndicators\n";
+}
+
+my ($NeedMakefile, $NeedMakeInclude, $NeedBuildDeps, $NeedImplib,
+ $NeedConfigure) = ApplyPatch($PatchFile, $PatchType, $BaseName);
+if ($NeedMakefile < 0)
+{
+ exit(1);
+}
+
+CountCPUs();
+
+if ($Run32 && ! BuildTestExecutable($BaseName, $PatchType, 32,
+ $NeedConfigure, 0 < $NeedMakefile,
+ $NeedMakeInclude, $NeedBuildDeps,
+ $NeedImplib))
+{
+ exit(1);
+}
+if ($Run64 && ! BuildTestExecutable($BaseName, $PatchType, 64,
+ $NeedConfigure, 0 < $NeedMakefile,
+ $NeedMakeInclude, $NeedBuildDeps,
+ $NeedImplib))
+{
+ exit(1);
+}
+
+LogMsg "ok\n";
+exit;
diff --git a/testbot/bin/build/BuildSingleTest.pl b/testbot/bin/build/BuildSingleTest.pl
deleted file mode 100755
index 8d06614..0000000
--- a/testbot/bin/build/BuildSingleTest.pl
+++ /dev/null
@@ -1,379 +0,0 @@
-#!/usr/bin/perl -Tw
-#
-# Performs the 'build' task in the build machine. Specifically this applies a
-# conformance test patch, rebuilds the impacted test and retrieves the
-# resulting 32 and 64 bit binaries.
-#
-# Copyright 2009 Ge van Geldorp
-#
-# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
-
-use strict;
-
-my $Dir;
-sub BEGIN
-{
- $main::BuildEnv = 1;
- $0 =~ m=^(.*)/[^/]*$=;
- $Dir = $1;
-}
-use lib "$Dir/../../lib";
-
-use WineTestBot::Config;
-
-sub InfoMsg
-{
- my $oldumask = umask(002);
- if (open LOGFILE, ">>$LogDir/BuildSingleTest.log")
- {
- print LOGFILE @_;
- close LOGFILE;
- }
- umask($oldumask);
-}
-
-sub LogMsg
-{
- my $oldumask = umask(002);
- if (open LOGFILE, ">>$LogDir/BuildSingleTest.log")
- {
- print LOGFILE "BuildSingleTest: ", @_;
- close LOGFILE;
- }
- umask($oldumask);
-}
-
-sub FatalError
-{
- LogMsg @_;
-
- exit 1;
-}
-
-sub ApplyPatch
-{
- my ($PatchFile, $PatchType, $BaseName) = @_;
-
- my $NeedMakefile = 0;
- my $NeedMakeInclude = !1;
- my $NeedBuildDeps = !1;
- my $NeedImplib = !1;
- my $NeedAutoconf = !1;
- my $NeedConfigure = !1;
- if (open (FH, "<$PatchFile"))
- {
- my $Line;
- while (defined($Line = <FH>) &&
- ($NeedMakefile == 0 || ! $NeedMakeInclude || ! $NeedBuildDeps ||
- ! $NeedImplib || ! $NeedAutoconf || ! $NeedConfigure))
- {
- if ($Line =~ m=^diff.*tests/Makefile\.in=)
- {
- $NeedMakefile = 1;
- }
- elsif ($Line =~ m=^diff.*include/.*\.idl=)
- {
- $NeedMakeInclude = 1;
- }
- elsif ($Line =~ m=^diff.*\.spec=)
- {
- $NeedBuildDeps = 1;
- }
- elsif ($PatchType eq "dlls" && $Line =~ m=^diff.*$BaseName/Makefile\.in=)
- {
- $NeedImplib = 1;
- }
- elsif ($Line =~ m=^diff.*configure\.ac=)
- {
- $NeedAutoconf = 1;
- }
- elsif ($Line =~ m=^diff.*configure=)
- {
- $NeedConfigure = 1;
- }
- }
- close FH;
- }
-
- InfoMsg "Applying patch\n";
- system("git apply --verbose --directory=$DataDir/wine-git $PatchFile " .
- ">> $LogDir/BuildSingleTest.log 2>&1");
- if ($? != 0)
- {
- LogMsg "Patch failed to apply\n";
- return (-1, $NeedMakeInclude, $NeedBuildDeps, $NeedImplib, $NeedConfigure);
- }
-
- if ($NeedAutoconf && ! $NeedConfigure)
- {
- InfoMsg "Running autoconf\n";
- system("( cd $DataDir/wine-git && set -x && " .
- " autoconf --output configure configure.ac " .
- ") >>$LogDir/BuildSingleTest.log 2>&1");
- if ($? != 0)
- {
- LogMsg "Autoconf failed\n";
- return (-1, $NeedMakeInclude, $NeedBuildDeps, $NeedImplib,
- $NeedConfigure);
- }
- $NeedConfigure = 1;
- }
-
- if ($NeedImplib)
- {
- if (open (FH, "<$DataDir/wine-git/$PatchType/$BaseName/Makefile.in"))
- {
- $NeedImplib = !1;
- my $Line;
- while (defined($Line = <FH>) && ! $NeedImplib)
- {
- $NeedImplib = ($Line =~ m/^\s*IMPORTLIB\s*=.*$BaseName/)
- }
- close FH;
- }
- }
-
- return ($NeedMakefile, $NeedMakeInclude, $NeedBuildDeps, $NeedImplib,
- $NeedConfigure);
-}
-
-my $ncpus;
-sub CountCPUs()
-{
- if (open(my $fh, "<", "/proc/cpuinfo"))
- {
- # Linux
- map { $ncpus++ if (/^processor/); } <$fh>;
- close($fh);
- }
- $ncpus ||= 1;
-}
-
-sub BuildTestExecutable
-{
- my ($BaseName, $PatchType, $Bits, $NeedConfigure, $NeedMakefile,
- $NeedMakeInclude, $NeedBuildDeps, $NeedImplib) = @_;
-
- if ($NeedConfigure)
- {
- InfoMsg "Reconfigure $Bits-bit crossbuild\n";
- my $Host = ($Bits == 64 ? "x86_64-w64-mingw32" : "i686-pc-mingw32");
- system("( cd $DataDir/build-mingw$Bits && set -x && " .
- " ../wine-git/configure --host=$Host --with-wine-tools=../build-native --without-x --without-freetype " .
- ") >>$LogDir/BuildSingleTest.log 2>&1");
- if ($? != 0)
- {
- LogMsg "Reconfigure of $Bits-bit crossbuild failed\n";
- return !1;
- }
- }
-
- if ($NeedMakeInclude || $NeedConfigure)
- {
- InfoMsg "Recreating include/Makefile\n";
- system("( cd $DataDir/build-mingw$Bits && set -x && " .
- " ./config.status --file include/Makefile:Make.vars.in:include/Makefile.in " .
- ") >>$LogDir/BuildSingleTest.log 2>&1");
- if ($? != 0)
- {
- LogMsg "Recreation of include/Makefile failed\n";
- return !1;
- }
-
- system("( cd $DataDir/build-mingw$Bits && set -x && " .
- " make -j$ncpus include " .
- ") >> $LogDir/BuildSingleTest.log 2>&1");
- if ($? != 0)
- {
- LogMsg "Make in include dir failed\n";
- return !1;
- }
- }
-
- if ($NeedImplib || $NeedConfigure)
- {
- InfoMsg "Rebuilding $BaseName import lib\n";
- system("( cd $DataDir/build-mingw$Bits && set -x && " .
- " ./config.status --file $PatchType/$BaseName/Makefile:Make.vars.in:$PatchType/$BaseName/Makefile.in " .
- ") >>$LogDir/BuildSingleTest.log 2>&1");
- if ($? != 0)
- {
- LogMsg "Unable to regenerate $PatchType/$BaseName/Makefile\n";
- }
- else
- {
- system("( cd $DataDir/build-mingw$Bits && set -x && " .
- " make -j$ncpus -C $PatchType/$BaseName lib$BaseName.a " .
- ") >>$LogDir/BuildSingleTest.log 2>&1");
- if ($? != 0)
- {
- InfoMsg "Make of import library failed\n";
- }
- }
- }
-
- if ($NeedMakefile || $NeedConfigure)
- {
- InfoMsg "Recreating tests/Makefile\n";
- system("( cd $DataDir/build-mingw$Bits && set -x && " .
- " ./config.status --file $PatchType/$BaseName/tests/Makefile:Make.vars.in:$PatchType/$BaseName/tests/Makefile.in " .
- ") >>$LogDir/BuildSingleTest.log 2>&1");
- if ($? != 0)
- {
- LogMsg "Recreation of tests/Makefile failed\n";
- return !1;
- }
- }
-
- if ($NeedBuildDeps)
- {
- InfoMsg "Making build dependencies\n";
- system("( cd $DataDir/build-mingw$Bits && set -x && " .
- " make -j$ncpus __builddeps__ " .
- ") >>$LogDir/BuildSingleTest.log 2>&1");
- if ($? != 0)
- {
- LogMsg "Making build dependencies failed\n";
- return !1;
- }
- }
-
- my $TestsDir = "$PatchType/$BaseName/tests";
- my $TestExecutable = "$TestsDir/$BaseName";
- if ($PatchType eq "programs")
- {
- $TestExecutable .= ".exe";
- }
- $TestExecutable .= "_test.exe";
- unlink("$DataDir/build-mingw${Bits}/$TestExecutable");
-
- InfoMsg "Making test executable\n";
- system("( cd $DataDir/build-mingw$Bits && set -x && " .
- " make -j$ncpus -C $TestsDir " .
- ") >>$LogDir/BuildSingleTest.log 2>&1");
- if ($? != 0)
- {
- LogMsg "Make failed\n";
- return !1;
- }
- if (! -f "$DataDir/build-mingw${Bits}/$TestExecutable")
- {
- LogMsg "Make didn't produce a $TestExecutable file\n";
- return !1;
- }
-
- return 1;
-}
-
-$ENV{PATH} = "/usr/lib/ccache:/usr/bin:/bin";
-delete $ENV{ENV};
-
-# Start with clean logfile
-unlink("$LogDir/BuildSingleTest.log");
-
-my ($PatchFile, $PatchType, $BaseName, $BitIndicators) = @ARGV;
-if (! $PatchFile || ! $PatchType || ! $BaseName || !$BitIndicators)
-{
- FatalError "Usage: BuildSingleTest.pl <patchfile> <patchtype> <basename> <bits>\n";
-}
-
-# Untaint parameters
-if ($PatchFile =~ m/^([\w_.\-]+)$/)
-{
- $PatchFile = "$DataDir/staging/$1";
- if (! -r $PatchFile)
- {
- FatalError "Patch file $PatchFile not readable\n";
- }
-}
-else
-{
- FatalError "Invalid patch file $PatchFile\n";
-}
-
-if ($PatchType =~ m/^patch(dlls|programs)$/)
-{
- $PatchType = $1;
-}
-else
-{
- FatalError "Invalid patch type $PatchType\n";
-}
-
-if ($BaseName =~ m/^([\w_.\-]+)$/)
-{
- $BaseName = $1;
-}
-else
-{
- FatalError "Invalid DLL base name $BaseName\n";
-}
-
-my $Run32 = !1;
-my $Run64 = !1;
-if ($BitIndicators =~ m/^([\d,]+)$/)
-{
- my @Bits = split /,/, $1;
- foreach my $BitsValue (@Bits)
- {
- if ($BitsValue == 32)
- {
- $Run32 = 1;
- }
- elsif ($BitsValue == 64)
- {
- $Run64 = 1;
- }
- else
- {
- FatalError "Invalid number of bits $BitsValue\n";
- }
- }
- if (! $Run32 && ! $Run64)
- {
- FatalError "Specify at least one of 32 or 64 bits\n";
- }
-}
-else
-{
- FatalError "Invalid number of bits $BitIndicators\n";
-}
-
-my ($NeedMakefile, $NeedMakeInclude, $NeedBuildDeps, $NeedImplib,
- $NeedConfigure) = ApplyPatch($PatchFile, $PatchType, $BaseName);
-if ($NeedMakefile < 0)
-{
- exit(1);
-}
-
-CountCPUs();
-
-if ($Run32 && ! BuildTestExecutable($BaseName, $PatchType, 32,
- $NeedConfigure, 0 < $NeedMakefile,
- $NeedMakeInclude, $NeedBuildDeps,
- $NeedImplib))
-{
- exit(1);
-}
-if ($Run64 && ! BuildTestExecutable($BaseName, $PatchType, 64,
- $NeedConfigure, 0 < $NeedMakefile,
- $NeedMakeInclude, $NeedBuildDeps,
- $NeedImplib))
-{
- exit(1);
-}
-
-LogMsg "ok\n";
-exit;
--
1.7.10.4
More information about the wine-patches
mailing list