Module: tools Branch: master Commit: 534b42d9be75c702b5192280bc85815405b9d3a4 URL: http://source.winehq.org/git/tools.git/?a=commit;h=534b42d9be75c702b5192280b...
Author: Francois Gouget fgouget@codeweavers.com Date: Thu Nov 29 03:59:58 2012 +0100
testbot/TestAgent: Adopt a more client/server-oriented terminology.
---
testbot/lib/WineTestBot/TestAgent.pm | 30 +++++++++++++------------- testbot/scripts/TestAgent | 38 +++++++++++++++++----------------- 2 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/testbot/lib/WineTestBot/TestAgent.pm b/testbot/lib/WineTestBot/TestAgent.pm index f2fa888..40f1bed 100644 --- a/testbot/lib/WineTestBot/TestAgent.pm +++ b/testbot/lib/WineTestBot/TestAgent.pm @@ -137,20 +137,20 @@ sub _Copy($$)
sub SendFile($$$) { - my ($Hostname, $HostPathName, $GuestPathName) = @_; - LogMsg "SendFile $HostPathName -> $Hostname $GuestPathName\n"; + my ($Hostname, $LocalPathName, $ServerPathName) = @_; + LogMsg "SendFile $LocalPathName -> $Hostname $ServerPathName\n";
my $fh; - if (!open($fh, "<", $HostPathName)) + if (!open($fh, "<", $LocalPathName)) { - return "unable to open '$HostPathName' for reading: $!"; + return "unable to open '$LocalPathName' for reading: $!"; }
my $Err; my $nc = _Connect($Hostname); if ($nc) { - $nc->send("write\n$GuestPathName\n", 0); + $nc->send("write\n$ServerPathName\n", 0); $Err = $! if (!_Copy($fh, $nc)); $nc->shutdown($DONE_WRITING);
@@ -170,20 +170,20 @@ sub SendFile($$$)
sub GetFile($$$) { - my ($Hostname, $GuestPathName, $HostPathName) = @_; - LogMsg "GetFile $Hostname $GuestPathName -> $HostPathName\n"; + my ($Hostname, $ServerPathName, $LocalPathName) = @_; + LogMsg "GetFile $Hostname $ServerPathName -> $LocalPathName\n";
my $fh; - if (!open($fh, ">", $HostPathName)) + if (!open($fh, ">", $LocalPathName)) { - return "unable to open '$HostPathName' for writing: $!"; + return "unable to open '$LocalPathName' for writing: $!"; }
- my ($Err, $GuestSize); + my ($Err, $ServerSize); my $nc = _Connect($Hostname); if ($nc) { - $nc->send("read\n$GuestPathName\n", 0); + $nc->send("read\n$ServerPathName\n", 0); # The status of the open operation is returned first so it does not # get mixed up with the file data. However we must not mix buffered # (<> or read()) and unbuffered (File:Copy::copy()) read operations on @@ -194,7 +194,7 @@ sub GetFile($$$) } elsif ($Err =~ s/^ok: size=(-?[0-9]+)\n//) { - $GuestSize=$1; + $ServerSize = $1; if ($Err ne "" and syswrite($fh, $Err, length($Err)) < 0) { $Err = $!; @@ -211,8 +211,8 @@ sub GetFile($$$) $Err = $@; } close($fh); - my $HostSize=-s $HostPathName; - if (!defined $Err and $HostSize != $GuestSize) + my $LocalSize = -s $LocalPathName; + if (!defined $Err and $LocalSize != $ServerSize) { # Something still went wrong during the transfer. Get the last operation # status @@ -220,7 +220,7 @@ sub GetFile($$$) ($Err, $StatusErr) = GetStatus($Hostname); $Err = $StatusErr if (!defined $StatusErr); } - unlink $HostPathName if ($Err); + unlink $LocalPathName if ($Err); return $Err; }
diff --git a/testbot/scripts/TestAgent b/testbot/scripts/TestAgent index cc823f6..c917b0a 100755 --- a/testbot/scripts/TestAgent +++ b/testbot/scripts/TestAgent @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # # This is a testagentd client. It can be used to exchange files or run -# commands on VMs, mostly for testing purposes. +# commands on the testagentd server, mostly for testing purposes. # # Copyright 2012 Francois Gouget # @@ -42,7 +42,7 @@ sub error(@) print STDERR "$name0:error: ", @_; }
-my ($Cmd, $Hostname, $HostPathName, $GuestPathName, $Script, $ScriptTimeout); +my ($Cmd, $Hostname, $LocalPathName, $ServerPathName, $Script, $ScriptTimeout); my $Port; my $Timeout; my $Usage; @@ -86,14 +86,14 @@ while (@ARGV) } elsif ($arg eq "send") { - $HostPathName = check_opt_val($arg, $HostPathName); - $GuestPathName = check_opt_val($arg, $GuestPathName) if (!$Usage); + $LocalPathName = check_opt_val($arg, $LocalPathName); + $ServerPathName = check_opt_val($arg, $ServerPathName) if (!$Usage); $Cmd = $arg; } elsif ($arg eq "get") { - $GuestPathName = check_opt_val($arg, $GuestPathName); - $HostPathName = check_opt_val($arg, $HostPathName) if (!$Usage); + $ServerPathName = check_opt_val($arg, $ServerPathName); + $LocalPathName = check_opt_val($arg, $LocalPathName) if (!$Usage); $Cmd = $arg; } elsif ($arg eq "runscript") @@ -128,25 +128,25 @@ if (defined $Usage) error("try '$name0 --help' for more information\n"); exit $Usage; } - print "Usage: $name0 [options] <hostname> send <hostpath> <guestpath>\n"; - print "or $name0 [options] <hostname> get <guestpath> <hostpath>\n"; + print "Usage: $name0 [options] <hostname> send <localpath> <serverpath>\n"; + print "or $name0 [options] <hostname> get <serverpath> <localpath>\n"; print "or $name0 [options] <hostname> runscript <command>\n"; print "or $name0 [options] <hostname> status\n"; print "\n"; - print "This is a testagentd client. It can be used to send/receive files and to run scripts on the specified guest host.\n"; + print "This is a testagentd client. It can be used to send/receive files and to run scripts on the specified server.\n"; print "\n"; print "Where:\n"; - print " send Sends the <hostpath> file and saves it as <guestpath> on the\n"; - print " guest.\n"; - print " get Retrieves the <guestpath> file from the guest and saves it as\n"; - print " <hostpath>.\n"; - print " runscript Runs the specified <command> on the guest.\n"; + print " send Sends the <localpath> file and saves it as <serverpath> on the\n"; + print " server.\n"; + print " get Retrieves the <serverpath> file from the server and saves it as\n"; + print " <localpath>.\n"; + print " runscript Runs the specified <command> on the server.\n"; print " status Retrieves the status of the last command that was run on the\n"; - print " guest.\n"; - print " <hostname> Is the hostname of the guest.\n"; + print " server.\n"; + print " <hostname> Is the hostname of the TestAgent server.\n"; print " --port <port> Use the specified port number instead of the default one.\n"; print " --timeout <timeout> Use the specified timeout (in seconds) instead of the\n"; - print " default one.\n"; + print " default one.\n"; print " --help Shows this usage message.\n"; exit 0; } @@ -154,11 +154,11 @@ if (defined $Usage) my $Err; if ($Cmd eq "send") { - $Err = TestAgent::SendFile($Hostname, $HostPathName, $GuestPathName); + $Err = TestAgent::SendFile($Hostname, $LocalPathName, $ServerPathName); } elsif ($Cmd eq "get") { - $Err = TestAgent::GetFile($Hostname, $GuestPathName, $HostPathName); + $Err = TestAgent::GetFile($Hostname, $ServerPathName, $LocalPathName); } elsif ($Cmd eq "runscript") {