Francois Gouget : testbot/bin: Standardize handling of the function arguments and add prototypes.
Alexandre Julliard
julliard at winehq.org
Thu Jun 12 11:29:29 CDT 2014
Module: tools
Branch: master
Commit: 7533b8452fb45c9c0fe94ff145c5afd0e8d0d94a
URL: http://source.winehq.org/git/tools.git/?a=commit;h=7533b8452fb45c9c0fe94ff145c5afd0e8d0d94a
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Mon Jun 9 10:56:23 2014 +0200
testbot/bin: Standardize handling of the function arguments and add prototypes.
The prototypes let Perl detect when the wrong number of parameters is passed to these functions.
They also document which arguments are optional.
---
testbot/bin/CheckForWinetestUpdate.pl | 4 ++--
testbot/bin/RevertVM.pl | 2 +-
testbot/bin/WineSendLog.pl | 21 +++++++++++----------
testbot/bin/build/Build.pl | 10 +++++-----
testbot/bin/build/Reconfig.pl | 14 +++++++-------
5 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/testbot/bin/CheckForWinetestUpdate.pl b/testbot/bin/CheckForWinetestUpdate.pl
index 4eb2555..17b75d0 100755
--- a/testbot/bin/CheckForWinetestUpdate.pl
+++ b/testbot/bin/CheckForWinetestUpdate.pl
@@ -60,7 +60,7 @@ my %WineTestUrls = (
);
-sub AddJob
+sub AddJob($$$)
{
my ($BaseJob, $LatestBaseName, $Bits) = @_;
@@ -140,7 +140,7 @@ sub AddJob
return 1;
}
-sub AddReconfigJob
+sub AddReconfigJob()
{
# First create a new job
my $Jobs = CreateJobs();
diff --git a/testbot/bin/RevertVM.pl b/testbot/bin/RevertVM.pl
index b2ae902..3712c4d 100755
--- a/testbot/bin/RevertVM.pl
+++ b/testbot/bin/RevertVM.pl
@@ -42,7 +42,7 @@ use WineTestBot::Config;
use WineTestBot::Log;
use WineTestBot::VMs;
-sub FatalError
+sub FatalError($$)
{
my ($ErrMessage, $VM) = @_;
diff --git a/testbot/bin/WineSendLog.pl b/testbot/bin/WineSendLog.pl
index 5f4f1b1..c0a5057 100755
--- a/testbot/bin/WineSendLog.pl
+++ b/testbot/bin/WineSendLog.pl
@@ -43,9 +43,9 @@ use WineTestBot::Log;
use WineTestBot::StepsTasks;
-sub IsBotFailure
+sub IsBotFailure($)
{
- my $ErrLine = $_[0];
+ my ($ErrLine) = @_;
return ($ErrLine =~ m/Can't set VM status to running/ ||
$ErrLine =~ m/Can't copy exe to VM/ ||
@@ -53,9 +53,9 @@ sub IsBotFailure
$ErrLine =~ m/Can't copy generated executable from VM/);
}
-sub CheckErrLog
+sub CheckErrLog($)
{
- my $ErrLogFileName = $_[0];
+ my ($ErrLogFileName) = @_;
my $BotFailure = !1;
my $Messages = "";
@@ -82,7 +82,7 @@ sub CheckErrLog
return ($BotFailure, $Messages);
}
-sub ReadLog
+sub ReadLog($$$)
{
my ($LogName, $BaseName, $TestSet) = @_;
@@ -127,16 +127,16 @@ sub ReadLog
return \@Messages;
}
-sub GetLineKey
+sub GetLineKey($)
{
- my $Line = $_[0];
+ my ($Line) = @_;
$Line =~ s/^([\w_.]+:)\d+(:.*)$/$1$2/;
return $Line;
}
-sub CompareLogs
+sub CompareLogs($$$$)
{
my ($SuiteLog, $TaskLog, $BaseName, $TestSet) = @_;
@@ -166,9 +166,10 @@ sub CompareLogs
return $Messages;
}
-sub SendLog
+sub SendLog($)
{
- my $Job = shift;
+ my ($Job) = @_;
+
my $To = $WinePatchToOverride || $Job->GetEMailRecipient();
if (! defined($To))
{
diff --git a/testbot/bin/build/Build.pl b/testbot/bin/build/Build.pl
index ef3fece..f94b87e 100755
--- a/testbot/bin/build/Build.pl
+++ b/testbot/bin/build/Build.pl
@@ -40,7 +40,7 @@ sub BEGIN
use WineTestBot::Config;
-sub InfoMsg
+sub InfoMsg(@)
{
my $oldumask = umask(002);
if (open LOGFILE, ">>$LogDir/Build.log")
@@ -51,7 +51,7 @@ sub InfoMsg
umask($oldumask);
}
-sub LogMsg
+sub LogMsg(@)
{
my $oldumask = umask(002);
if (open LOGFILE, ">>$LogDir/Build.log")
@@ -62,14 +62,14 @@ sub LogMsg
umask($oldumask);
}
-sub FatalError
+sub FatalError(@)
{
LogMsg @_;
exit 1;
}
-sub ApplyPatch
+sub ApplyPatch($$$)
{
my ($PatchFile, $PatchType, $BaseName) = @_;
@@ -169,7 +169,7 @@ sub CountCPUs()
$ncpus ||= 1;
}
-sub BuildTestExecutable
+sub BuildTestExecutable($$$$$$$$)
{
my ($BaseName, $PatchType, $Bits, $NeedConfigure, $NeedMakefile,
$NeedMakeInclude, $NeedBuildDeps, $NeedImplib) = @_;
diff --git a/testbot/bin/build/Reconfig.pl b/testbot/bin/build/Reconfig.pl
index a82d879..f5ffcab 100755
--- a/testbot/bin/build/Reconfig.pl
+++ b/testbot/bin/build/Reconfig.pl
@@ -40,7 +40,7 @@ sub BEGIN
use WineTestBot::Config;
-sub LogMsg
+sub LogMsg(@)
{
my $oldumask = umask(002);
if (open LOGFILE, ">>$LogDir/Reconfig.log")
@@ -51,14 +51,14 @@ sub LogMsg
umask($oldumask);
}
-sub FatalError
+sub FatalError(@)
{
LogMsg @_;
exit 1;
}
-sub GitPull
+sub GitPull()
{
system("cd $DataDir/wine && git pull >> $LogDir/Reconfig.log 2>&1");
if ($? != 0)
@@ -82,7 +82,7 @@ sub CountCPUs()
$ncpus ||= 1;
}
-sub BuildTestAgentd
+sub BuildTestAgentd()
{
# If testagentd already exists it's likely already running
# so don't rebuild it.
@@ -110,7 +110,7 @@ sub BuildTestAgentd
return 1;
}
-sub BuildNative
+sub BuildNative()
{
mkdir "$DataDir/build-native" if (! -d "$DataDir/build-native");
system("( cd $DataDir/build-native && set -x && " .
@@ -129,9 +129,9 @@ sub BuildNative
return 1;
}
-sub BuildCross
+sub BuildCross($)
{
- my $Bits = $_[0];
+ my ($Bits) = @_;
my $Host = ($Bits == 64 ? "x86_64-w64-mingw32" : "i686-w64-mingw32");
mkdir "$DataDir/build-mingw$Bits" if (! -d "$DataDir/build-mingw$Bits");
More information about the wine-cvs
mailing list