From b96823997d1f3695182ddfcf004163d0539b013f Mon Sep 17 00:00:00 2001 From: micha Date: Sun, 9 Mar 2008 18:25:25 +0000 Subject: [PATCH] + add "FILES" variable for testsuite tests: list of files required by test needing to be copied to remote target git-svn-id: trunk@10467 - --- tests/readme.txt | 2 ++ tests/test/units/system/trdtxt01.pp | 1 + tests/test/units/system/trdtxt02.pp | 1 + tests/test/units/system/trdtxt03.pp | 1 + tests/utils/dotest.pp | 38 ++++++++++++++++++++++++++++- tests/utils/testu.pp | 4 +++ 6 files changed, 46 insertions(+), 1 deletion(-) diff --git a/tests/readme.txt b/tests/readme.txt index 9eb85f2972..d15fdbf9c4 100644 --- a/tests/readme.txt +++ b/tests/readme.txt @@ -41,6 +41,8 @@ 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) +FILES..............List of files (separated by spaces) required by test, + will be copied to remote before execution GRAPH..............Requires graph unit FAIL...............Compilation must fail RECOMPILE..........After compiling a test, recompile the test for a second diff --git a/tests/test/units/system/trdtxt01.pp b/tests/test/units/system/trdtxt01.pp index 4c7a254ba4..a4b9f86f8c 100644 --- a/tests/test/units/system/trdtxt01.pp +++ b/tests/test/units/system/trdtxt01.pp @@ -1,3 +1,4 @@ +{ %FILES=testpc.txt } Program trdtxt01; {$ifdef fpc} diff --git a/tests/test/units/system/trdtxt02.pp b/tests/test/units/system/trdtxt02.pp index 5bb800c040..ea0a9419f0 100644 --- a/tests/test/units/system/trdtxt02.pp +++ b/tests/test/units/system/trdtxt02.pp @@ -1,3 +1,4 @@ +{ %FILES=testux.txt } Program trdtxt02; {$ifdef fpc} diff --git a/tests/test/units/system/trdtxt03.pp b/tests/test/units/system/trdtxt03.pp index badf1ab424..d71238366e 100644 --- a/tests/test/units/system/trdtxt03.pp +++ b/tests/test/units/system/trdtxt03.pp @@ -1,3 +1,4 @@ +{ %FILES=testmac.txt } Program trdtxt03; {$ifdef fpc} diff --git a/tests/utils/dotest.pp b/tests/utils/dotest.pp index 1ffad59d9e..08224e5144 100644 --- a/tests/utils/dotest.pp +++ b/tests/utils/dotest.pp @@ -697,8 +697,11 @@ var FullExeLogFile, TestRemoteExe, TestExe : string; + LocalFile, RemoteFile: string; + LocalPath: string; execcmd : string; execres : boolean; + index : integer; EndTicks, StartTicks : int64; function ExecuteRemote(const prog,args:string):boolean; @@ -717,6 +720,8 @@ var EndTicks:=GetMicroSTicks; end; +label + done; begin RunExecutable:=false; execres:=true; @@ -747,7 +752,37 @@ begin TestRemoteExe:=RemotePath+'/'+SplitFileName(TestExe); if deBefore in DelExecutable then ExecuteRemote(rshprog,RemotePara+' '+RemoteAddr+' rm -f '+TestRemoteExe); - ExecuteRemote(rcpprog,RemotePara+' '+TestExe+' '+RemoteAddr+':'+TestRemoteExe); + execres:=ExecuteRemote(rcpprog,RemotePara+' '+TestExe+' '+RemoteAddr+':'+TestRemoteExe); + if not execres then + begin + Verbose(V_Abort, 'Could not copy executable '+TestExe); + goto done; + end; + s:=Config.Files; + if length(s) > 0 then + begin + LocalPath:=SplitPath(PPFile); + if Length(LocalPath) > 0 then + LocalPath:=LocalPath+'/'; + repeat + index:=pos(' ',s); + if index=0 then + LocalFile:=s + else + LocalFile:=copy(s,1,index-1); + RemoteFile:=RemotePath+'/'+SplitFileName(LocalFile); + LocalFile:=LocalPath+LocalFile; + execres:=ExecuteRemote(rcpprog,RemotePara+' '+LocalFile+' '+RemoteAddr+':'+RemoteFile); + if not execres then + begin + Verbose(V_Abort, 'Could not copy required file '+LocalFile); + goto done; + end; + if index=0 then + break; + s:=copy(s,index+1,length(s)-index); + until false; + end; { rsh doesn't pass the exitcode, use a second command to print the exitcode on the remoteshell to stdout } execcmd:=RemotePara+' '+RemoteAddr+' '+rquote+'chmod 755 '+TestRemoteExe+ @@ -798,6 +833,7 @@ begin begin Verbose(V_Normal,'Execution took '+ToStr(EndTicks-StartTicks)+' us'); end; +done: if (not execres) and (ExecuteResult=0) then begin AddLog(FailLogFile,TestName); diff --git a/tests/utils/testu.pp b/tests/utils/testu.pp index ee6c404201..a18ec0e1f5 100644 --- a/tests/utils/testu.pp +++ b/tests/utils/testu.pp @@ -37,6 +37,7 @@ type Timeout : longint; Category : string; Note : string; + Files : string; end; Const @@ -257,6 +258,9 @@ begin else if GetEntry('TIMEOUT') then Val(res,r.Timeout,code) + else + if GetEntry('FILES') then + r.Files:=res else Verbose(V_Error,'Unknown entry: '+s); end;