* print exitcode of remote test to stdout and parse the output file.

this is the most reliable passing of the exitcode
This commit is contained in:
peter 2004-05-17 20:51:29 +00:00
parent 5787d92d8f
commit b432c9a246

View File

@ -59,7 +59,7 @@ const
RemotePath : string = '/tmp'; RemotePath : string = '/tmp';
rshprog : string = 'rsh'; rshprog : string = 'rsh';
rcpprog : string = 'rcp'; rcpprog : string = 'rcp';
Function FileExists (Const F : String) : Boolean; Function FileExists (Const F : String) : Boolean;
{ {
Returns True if the file exists, False if not. Returns True if the file exists, False if not.
@ -514,19 +514,49 @@ begin
end; end;
function CheckTestExitCode(const OutName:string):boolean;
var
t : text;
s : string;
i,code : integer;
begin
CheckTestExitCode:=false;
{ open logfile }
assign(t,Outname);
{$I-}
reset(t);
{$I+}
if ioresult<>0 then
exit;
while not eof(t) do
begin
readln(t,s);
i:=pos('TestExitCode: ',s);
if i>0 then
begin
delete(s,1,i+14-1);
val(s,ExecuteResult,code);
CheckTestExitCode:=true;
break;
end;
end;
close(t);
end;
function RunExecutable:boolean; function RunExecutable:boolean;
var var
outname, outname,
TestRemoteExe, TestRemoteExe,
TestExe : string; TestExe : string;
execres : boolean; execres : boolean;
function ExecuteRemote(const prog,args:string):boolean; function ExecuteRemote(const prog,args:string):boolean;
begin begin
Verbose(V_Debug,'RemoteExecuting '+Prog+' '+args); Verbose(V_Debug,'RemoteExecuting '+Prog+' '+args);
ExecuteRemote:=ExecuteRedir(prog,args,'',OutName,'stdout'); ExecuteRemote:=ExecuteRedir(prog,args,'',OutName,'stdout');
end; end;
begin begin
RunExecutable:=false; RunExecutable:=false;
execres:=true; execres:=true;
@ -538,7 +568,11 @@ begin
TestRemoteExe:=RemotePath+'/'+SplitFileName(TestExe); TestRemoteExe:=RemotePath+'/'+SplitFileName(TestExe);
ExecuteRemote(rshprog,RemoteAddr+' rm -f '+TestRemoteExe); ExecuteRemote(rshprog,RemoteAddr+' rm -f '+TestRemoteExe);
ExecuteRemote(rcpprog,TestExe+' '+RemoteAddr+':'+TestRemoteExe); ExecuteRemote(rcpprog,TestExe+' '+RemoteAddr+':'+TestRemoteExe);
execres:=ExecuteRemote(rshprog,RemoteAddr+' '+TestRemoteExe); { rsh doesn't pass the exitcode, use a second command to print the exitcode
on the remoteshell to stdout }
execres:=ExecuteRemote(rshprog,RemoteAddr+' '''+TestRemoteExe+' ; echo "TestExitCode: $?"''');
{ Check for TestExitCode error in output, sets ExecuteResult }
CheckTestExitCode(OutName);
end end
else else
begin begin
@ -593,7 +627,7 @@ begin
AddLog(ResLogFile,successfully_run+PPFileInfo); AddLog(ResLogFile,successfully_run+PPFileInfo);
RunExecutable:=true; RunExecutable:=true;
end; end;
if DelExecutable then if DelExecutable then
begin begin
Verbose(V_Debug,'Deleting executable '+TestExe); Verbose(V_Debug,'Deleting executable '+TestExe);
@ -602,7 +636,7 @@ begin
RemoveFile(TestExe); RemoveFile(TestExe);
RemoveFile(ForceExtension(TestExe,ObjExt)); RemoveFile(ForceExtension(TestExe,ObjExt));
RemoveFile(ForceExtension(TestExe,PPUExt)); RemoveFile(ForceExtension(TestExe,PPUExt));
end; end;
end; end;
@ -682,13 +716,13 @@ begin
'R' : RemoteAddr:=Para; 'R' : RemoteAddr:=Para;
'T' : 'T' :
DelExecutable:=true; DelExecutable:=true;
'S' : 'S' :
begin begin
rshprog:='ssh'; rshprog:='ssh';
rcpprog:='scp'; rcpprog:='scp';
end; end;
end; end;
end end
else else
@ -700,7 +734,7 @@ begin
end; end;
if (PPFile='') then if (PPFile='') then
HelpScreen; HelpScreen;
{ disable graph,interactive when running remote } { disable graph,interactive when running remote }
if RemoteAddr<>'' then if RemoteAddr<>'' then
begin begin
DoGraph:=false; DoGraph:=false;
@ -912,7 +946,11 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.35 2004-05-16 20:13:04 peter Revision 1.36 2004-05-17 20:51:29 peter
* print exitcode of remote test to stdout and parse the output file.
this is the most reliable passing of the exitcode
Revision 1.35 2004/05/16 20:13:04 peter
* remote execute updates, see readme.txt * remote execute updates, see readme.txt
Revision 1.34 2004/05/03 14:48:51 peter Revision 1.34 2004/05/03 14:48:51 peter