* 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

@ -514,6 +514,36 @@ begin
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;
var
outname,
@ -538,7 +568,11 @@ begin
TestRemoteExe:=RemotePath+'/'+SplitFileName(TestExe);
ExecuteRemote(rshprog,RemoteAddr+' rm -f '+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
else
begin
@ -682,13 +716,13 @@ begin
'R' : RemoteAddr:=Para;
'T' :
DelExecutable:=true;
DelExecutable:=true;
'S' :
begin
rshprog:='ssh';
rcpprog:='scp';
end;
'S' :
begin
rshprog:='ssh';
rcpprog:='scp';
end;
end;
end
else
@ -912,7 +946,11 @@ begin
end.
{
$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
Revision 1.34 2004/05/03 14:48:51 peter