Browse Source

* Fix PuTTY plink usage with -load option

git-svn-id: trunk@20703 -
pierre 13 years ago
parent
commit
c968fcbfaf
1 changed files with 14 additions and 6 deletions
  1. 14 6
      tests/utils/dotest.pp

+ 14 - 6
tests/utils/dotest.pp

@@ -94,6 +94,7 @@ const
   RemoteAddr : string = '';
   RemoteAddr : string = '';
   RemotePath : string = '/tmp';
   RemotePath : string = '/tmp';
   RemotePara : string = '';
   RemotePara : string = '';
+  RemoteRshParas : string = '';
   RemoteShell : string = '';
   RemoteShell : string = '';
   RemoteShellBase : string = '';
   RemoteShellBase : string = '';
   RemoteShellNeedsExport : boolean = false;
   RemoteShellNeedsExport : boolean = false;
@@ -1124,7 +1125,7 @@ begin
   { We don't want to create subdirs, remove paths from the test }
   { We don't want to create subdirs, remove paths from the test }
   TestRemoteExe:=RemotePath+'/'+SplitFileName(FileToCopy);
   TestRemoteExe:=RemotePath+'/'+SplitFileName(FileToCopy);
   if deBefore in DelExecutable then
   if deBefore in DelExecutable then
-    ExecuteRemote(rshprog,RemotePara+' '+RemoteAddr+' rm -f '+TestRemoteExe,
+    ExecuteRemote(rshprog,RemoteRshParas+' rm -f '+TestRemoteExe,
                   StartTicks,EndTicks);
                   StartTicks,EndTicks);
   execres:=ExecuteRemote(rcpprog,RemotePara+' '+FileToCopy+' '+
   execres:=ExecuteRemote(rcpprog,RemotePara+' '+FileToCopy+' '+
                          RemoteAddr+':'+TestRemoteExe,StartTicks,EndTicks);
                          RemoteAddr+':'+TestRemoteExe,StartTicks,EndTicks);
@@ -1211,10 +1212,10 @@ begin
       { rsh doesn't pass the exitcode, use a second command to print the exitcode
       { rsh doesn't pass the exitcode, use a second command to print the exitcode
         on the remoteshell to stdout }
         on the remoteshell to stdout }
       if DoVerbose and (rshprog='plink') then
       if DoVerbose and (rshprog='plink') then
-        execcmd:='-v '
+        execcmd:='-v '+RemoteRshParas
       else
       else
-        execcmd:='';
-      execcmd:=execcmd+RemotePara+' '+RemoteAddr+' '+rquote+
+        execcmd:=RemoteRshParas;
+      execcmd:=execcmd+' '+rquote+
          'chmod 755 '+TestRemoteExe+
          'chmod 755 '+TestRemoteExe+
           ' ; cd '+RemotePath+' ; ';
           ' ; cd '+RemotePath+' ; ';
       { Using -rpath . at compile time does not seem
       { Using -rpath . at compile time does not seem
@@ -1249,7 +1250,7 @@ begin
       execcmd:=execcmd+' ; echo "TestExitCode: $?"';
       execcmd:=execcmd+' ; echo "TestExitCode: $?"';
       if (deAfter in DelExecutable) and
       if (deAfter in DelExecutable) and
          not Config.NeededAfter then
          not Config.NeededAfter then
-        execcmd:=execcmd+' ; rm -f '+TestRemoteExe;
+        execcmd:=execcmd+' ; rm -f '+SplitFileName(TestRemoteExe);
       execcmd:=execcmd+rquote;
       execcmd:=execcmd+rquote;
       execres:=ExecuteRemote(rshprog,execcmd,StartTicks,EndTicks);
       execres:=ExecuteRemote(rshprog,execcmd,StartTicks,EndTicks);
       { Check for TestExitCode error in output, sets ExecuteResult }
       { Check for TestExitCode error in output, sets ExecuteResult }
@@ -1358,7 +1359,7 @@ begin
   if RemoteAddr='' then
   if RemoteAddr='' then
     exit;
     exit;
   ExeLogFile:='__remote.tmp';
   ExeLogFile:='__remote.tmp';
-  ExecuteRemote(rshprog,RemotePara+' '+RemoteAddr+
+  ExecuteRemote(rshprog,RemoteRshParas+
                 ' "echo SHELL=${SHELL}"',StartTicks,EndTicks);
                 ' "echo SHELL=${SHELL}"',StartTicks,EndTicks);
   Assign(f,ExeLogFile);
   Assign(f,ExeLogFile);
   Reset(f);
   Reset(f);
@@ -1555,6 +1556,13 @@ begin
       DoGraph:=false;
       DoGraph:=false;
       DoInteractive:=false;
       DoInteractive:=false;
     end;
     end;
+  { If we use PuTTY plink program with -load option,
+    the IP address or name should not be added to
+    the command line }
+  if (rshprog='plink') and (pos('-load',RemotePara)>0) then
+    RemoteRshParas:=RemotePara
+  else
+    RemoteRshParas:=RemotePara+' '+RemoteAddr;
 end;
 end;