Browse Source

+ 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 years ago
parent
commit
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
 RESULT.............Exit code of execution of test expected
 TIMEOUT............Timeout indication for test in seconds (only used if
 TIMEOUT............Timeout indication for test in seconds (only used if
                    enabled by defining TEST_TIMEOUT)
                    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
 GRAPH..............Requires graph unit
 FAIL...............Compilation must fail
 FAIL...............Compilation must fail
 RECOMPILE..........After compiling a test, recompile the test for a second
 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;
 Program trdtxt01;
 
 
 {$ifdef fpc}
 {$ifdef fpc}

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

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

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

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

+ 37 - 1
tests/utils/dotest.pp

@@ -697,8 +697,11 @@ var
   FullExeLogFile,
   FullExeLogFile,
   TestRemoteExe,
   TestRemoteExe,
   TestExe  : string;
   TestExe  : string;
+  LocalFile, RemoteFile: string;
+  LocalPath: string;
   execcmd  : string;
   execcmd  : string;
   execres  : boolean;
   execres  : boolean;
+  index    : integer;
   EndTicks,
   EndTicks,
   StartTicks : int64;
   StartTicks : int64;
   function ExecuteRemote(const prog,args:string):boolean;
   function ExecuteRemote(const prog,args:string):boolean;
@@ -717,6 +720,8 @@ var
       EndTicks:=GetMicroSTicks;
       EndTicks:=GetMicroSTicks;
    end;
    end;
 
 
+label
+  done;
 begin
 begin
   RunExecutable:=false;
   RunExecutable:=false;
   execres:=true;
   execres:=true;
@@ -747,7 +752,37 @@ begin
       TestRemoteExe:=RemotePath+'/'+SplitFileName(TestExe);
       TestRemoteExe:=RemotePath+'/'+SplitFileName(TestExe);
       if deBefore in DelExecutable then
       if deBefore in DelExecutable then
         ExecuteRemote(rshprog,RemotePara+' '+RemoteAddr+' rm -f '+TestRemoteExe);
         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
       { rsh doesn't pass the exitcode, use a second command to print the exitcode
         on the remoteshell to stdout }
         on the remoteshell to stdout }
       execcmd:=RemotePara+' '+RemoteAddr+' '+rquote+'chmod 755 '+TestRemoteExe+
       execcmd:=RemotePara+' '+RemoteAddr+' '+rquote+'chmod 755 '+TestRemoteExe+
@@ -798,6 +833,7 @@ begin
     begin
     begin
       Verbose(V_Normal,'Execution took '+ToStr(EndTicks-StartTicks)+' us');
       Verbose(V_Normal,'Execution took '+ToStr(EndTicks-StartTicks)+' us');
     end;
     end;
+done:
   if (not execres) and (ExecuteResult=0) then
   if (not execres) and (ExecuteResult=0) then
     begin
     begin
       AddLog(FailLogFile,TestName);
       AddLog(FailLogFile,TestName);

+ 4 - 0
tests/utils/testu.pp

@@ -37,6 +37,7 @@ type
     Timeout       : longint;
     Timeout       : longint;
     Category      : string;
     Category      : string;
     Note          : string;
     Note          : string;
+    Files         : string;
   end;
   end;
 
 
 Const
 Const
@@ -257,6 +258,9 @@ begin
               else
               else
                if GetEntry('TIMEOUT') then
                if GetEntry('TIMEOUT') then
                 Val(res,r.Timeout,code)
                 Val(res,r.Timeout,code)
+              else
+               if GetEntry('FILES') then
+                r.Files:=res
               else
               else
                Verbose(V_Error,'Unknown entry: '+s);
                Verbose(V_Error,'Unknown entry: '+s);
             end;
             end;