[5/6] testbot/TestAgent: Verify that only one command is specified on the command line.
Francois Gouget
fgouget at codeweavers.com
Mon Apr 14 08:45:54 CDT 2014
---
This patch is independent from all other patches in the series, except
6/6 which depends on it.
testbot/scripts/TestAgent | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/testbot/scripts/TestAgent b/testbot/scripts/TestAgent
index 4fa8f4f..e238967 100755
--- a/testbot/scripts/TestAgent
+++ b/testbot/scripts/TestAgent
@@ -59,6 +59,17 @@ my $RunFlags = 0;
my ($Port, $ConnectTimeout, $Timeout, $Keepalive, $TunnelOpt);
my $Usage;
+sub set_cmd($)
+{
+ my ($Value) = @_;
+ if (defined $Cmd)
+ {
+ error("the '$Cmd' and '$Value' commands are mutually exclusive\n");
+ $Usage = 2;
+ }
+ $Cmd = $Value;
+}
+
sub check_opt_val($$)
{
my ($option, $val) = @_;
@@ -138,7 +149,7 @@ while (@ARGV)
}
elsif ($arg eq "sendfile")
{
- $Cmd = $arg;
+ set_cmd($arg);
$LocalFilename = check_opt_val($arg, $LocalFilename);
if (!$Usage)
{
@@ -155,7 +166,7 @@ while (@ARGV)
}
elsif ($arg eq "getfile")
{
- $Cmd = $arg;
+ set_cmd($arg);
$ServerFilename = check_opt_val($arg, $ServerFilename);
if (!$Usage)
{
@@ -172,28 +183,28 @@ while (@ARGV)
}
elsif ($arg eq "run")
{
+ set_cmd($arg);
@Run = @ARGV;
- $Cmd = $arg;
last;
}
elsif ($arg eq "wait")
{
- $Cmd = $arg;
+ set_cmd($arg);
$WaitPid = check_opt_val($arg, $WaitPid);
}
elsif ($arg eq "rm")
{
- $Cmd = $arg;
+ set_cmd($arg);
@Rm = @ARGV;
last;
}
elsif ($arg eq "getversion")
{
- $Cmd = $arg;
+ set_cmd($arg);
}
elsif ($arg eq "ping" or $arg eq "settime")
{
- $Cmd = $arg;
+ set_cmd($arg);
}
else
{
--
1.9.1
More information about the wine-patches
mailing list