+ implement timeout wrapper call for testsuite (remote only)

* reduce number of remote logins for speed

git-svn-id: trunk@8870 -
This commit is contained in:
micha 2007-10-21 09:18:19 +00:00
parent cce4c0c1d3
commit ce4acf5b49
6 changed files with 52 additions and 10 deletions

View File

@ -1452,9 +1452,15 @@ endif
ifdef TEST_REMOTEPATH
override DOTESTOPT+=-P$(TEST_REMOTEPATH)
endif
ifdef TEST_DELBEFORE
override DOTESTOPT+=-B
endif
ifdef TEST_DELTEMP
override DOTESTOPT+=-Z
endif
ifdef TEST_TIMEOUT
override DOTESTOPT+=-O
endif
ifdef TEST_VERBOSE
override DOTESTOPT+=-V
Q=

View File

@ -194,9 +194,15 @@ endif
ifdef TEST_REMOTEPATH
override DOTESTOPT+=-P$(TEST_REMOTEPATH)
endif
ifdef TEST_DELBEFORE
override DOTESTOPT+=-B
endif
ifdef TEST_DELTEMP
override DOTESTOPT+=-Z
endif
ifdef TEST_TIMEOUT
override DOTESTOPT+=-O
endif
ifdef TEST_VERBOSE
override DOTESTOPT+=-V
Q=

View File

@ -39,6 +39,8 @@ SKIPTARGET.........Not for these OS targets (win32,macos,etc).
VERSION............Compiler with at lest this version number required.
MAXVERSION.........Compiler with at most this version number required.
RESULT.............Exit code of execution of test expected
TIMEOUT............Timeout indication for test in seconds (only used if
enabled by defining TEST_TIMEOUT)
GRAPH..............Requires graph unit
FAIL...............Compilation must fail
RECOMPILE..........After compiling a test, recompile the test for a second
@ -102,6 +104,7 @@ TEST_CCOMPILER defaults to installed gcc compiler, but only
if driver and test full-targets are the same.
TEST_VERBOSE let dotest be more verbose, only usefull for debugging
TEST_DELTEMP delete temporary executable/object/ppu file, default is off
TEST_TIMEOUT use timeout wrapper for (remote) execution
(Please add more test options if needed)
@ -125,6 +128,7 @@ TEST_SSH set this to use ssh/scp to execute the test
TEST_PUTTY test using putty when remote testing (pscp and plink)
TEST_REMOTEOPT extra options to remote program
TEST_REMOTEPATH set remote path to use, default is /tmp
TEST_DELBEFORE delete remote executable before uploading
TEST_DELTEMP delete executable after running, so the remote system
doesn't need much free disk space
TEST_REMOTEPW pass a password with -pw to remote tools, mainly usefull for putty

View File

@ -1,3 +1,4 @@
{ %TIMEOUT=105 }
{$mode objfpc}{$h+}
uses

View File

@ -34,6 +34,8 @@ uses
type
tcompinfo = (compver,comptarget,compcpu);
tdelexecutable = (deBefore, deAfter);
tdelexecutables = set of tdelexecutable;
const
ObjExt='o';
@ -47,6 +49,7 @@ const
ExeExt='exe';
{$endif MACOS}
{$endif UNIX}
DefaultTimeout=3;
var
Config : TConfig;
@ -78,13 +81,14 @@ const
TargetDir : string = '';
BenchmarkInfo : boolean = false;
ExtraCompilerOpts : string = '';
DelExecutable : boolean = false;
DelExecutable : TDelExecutables = [];
RemoteAddr : string = '';
RemotePath : string = '/tmp';
RemotePara : string = '';
rshprog : string = 'rsh';
rcpprog : string = 'rcp';
rquote : char = '''';
UseTimeout : boolean = false;
emulatorname : string = '';
Function FileExists (Const F : String) : Boolean;
@ -693,6 +697,7 @@ var
FullExeLogFile,
TestRemoteExe,
TestExe : string;
execcmd : string;
execres : boolean;
EndTicks,
StartTicks : int64;
@ -742,12 +747,26 @@ begin
begin
{ We don't want to create subdirs, remove paths from the test }
TestRemoteExe:=RemotePath+'/'+SplitFileName(TestExe);
ExecuteRemote(rshprog,RemotePara+' '+RemoteAddr+' rm -f '+TestRemoteExe);
if deBefore in DelExecutable then
ExecuteRemote(rshprog,RemotePara+' '+RemoteAddr+' rm -f '+TestRemoteExe);
ExecuteRemote(rcpprog,RemotePara+' '+TestExe+' '+RemoteAddr+':'+TestRemoteExe);
{ rsh doesn't pass the exitcode, use a second command to print the exitcode
on the remoteshell to stdout }
execres:=ExecuteRemote(rshprog,RemotePara+' '+RemoteAddr+' '+rquote+'chmod 755 '+TestRemoteExe+
' ; cd '+RemotePath+' ; '+TestRemoteExe+' ; echo "TestExitCode: $?"'+rquote);
execcmd:=RemotePara+' '+RemoteAddr+' '+rquote+'chmod 755 '+TestRemoteExe+
' ; cd '+RemotePath+' ;';
if UseTimeout then
begin
execcmd:=execcmd+'timeout -9 ';
if Config.Timeout=0 then
Config.Timeout:=DefaultTimeout;
str(Config.Timeout,s);
execcmd:=execcmd+s;
end;
execcmd:=execcmd+' '+TestRemoteExe+' ; echo "TestExitCode: $?"';
if deAfter in DelExecutable then
execcmd:=execcmd+' ; rm -f '+TestRemoteExe;
execcmd:=execcmd+rquote;
execres:=ExecuteRemote(rshprog,execcmd);
{ Check for TestExitCode error in output, sets ExecuteResult }
CheckTestExitCode(EXELogFile);
end
@ -823,11 +842,9 @@ begin
RunExecutable:=true;
end;
if DelExecutable then
if deAfter in DelExecutable then
begin
Verbose(V_Debug,'Deleting executable '+TestExe);
if RemoteAddr<>'' then
ExecuteRemote(rshprog,RemotePara+' '+RemoteAddr+' rm -f '+TestRemoteExe);
RemoveFile(TestExe);
RemoveFile(ForceExtension(TestExe,ObjExt));
RemoveFile(ForceExtension(TestExe,PPUExt));
@ -846,7 +863,7 @@ var
writeln('dotest [Options] <File>');
writeln;
writeln('Options can be:');
writeln(' -B output benchmark information');
writeln(' -B delete executable before remote upload');
writeln(' -C<compiler> set compiler to use');
writeln(' -V verbose');
writeln(' -E execute test also');
@ -855,6 +872,7 @@ var
writeln(' -G include graph tests');
writeln(' -K include known bug tests');
writeln(' -I include interactive tests');
writeln(' -O use timeout wrapper for (remote) execution');
writeln(' -M<emulator> run the tests using the given emulator');
writeln(' -R<remote> run the tests remotely with the given rsh/ssh address');
writeln(' -S use ssh instead of rsh');
@ -891,6 +909,8 @@ begin
DoAll:=true;
end;
'B' : Include(DelExecutable,deBefore);
'C' : CompilerBin:=Para;
'E' : DoExecute:=true;
@ -915,6 +935,8 @@ begin
'M' : EmulatorName:=Para;
'O' : UseTimeout:=true;
'P' : RemotePath:=Para;
'R' : RemoteAddr:=Para;
@ -953,8 +975,7 @@ begin
'Y' : ExtraCompilerOpts:= ExtraCompilerOpts +' '+ Para;
'Z' :
DelExecutable:=true;
'Z' : Include(DelExecutable,deAfter);
end;
end
else

View File

@ -34,6 +34,7 @@ type
NoRun : boolean;
UsesGraph : boolean;
ShouldFail : boolean;
Timeout : longint;
Category : string;
Note : string;
end;
@ -253,6 +254,9 @@ begin
R.Note:='Note: '+res;
Verbose(V_Normal,r.Note);
end
else
if GetEntry('TIMEOUT') then
Val(res,r.Timeout,code)
else
Verbose(V_Error,'Unknown entry: '+s);
end;