ソースを参照

+ add "FILES" variable for testsuite tests: list of files required by test needing to be copied to remote target

git-svn-id: trunk@10467 -
micha 17 年 前
コミット
b96823997d

+ 2 - 0
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

+ 1 - 0
tests/test/units/system/trdtxt01.pp

@@ -1,3 +1,4 @@
+{ %FILES=testpc.txt }
 Program trdtxt01;
 
 {$ifdef fpc}

+ 1 - 0
tests/test/units/system/trdtxt02.pp

@@ -1,3 +1,4 @@
+{ %FILES=testux.txt }
 Program trdtxt02;
 
 {$ifdef fpc}

+ 1 - 0
tests/test/units/system/trdtxt03.pp

@@ -1,3 +1,4 @@
+{ %FILES=testmac.txt }
 Program trdtxt03;
 
 {$ifdef fpc}

+ 37 - 1
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);

+ 4 - 0
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;