浏览代码

* test result of execution and report as failure with iostatus displayed

peter 21 年之前
父节点
当前提交
f68712cc86
共有 2 个文件被更改,包括 45 次插入5 次删除
  1. 39 4
      tests/utils/dotest.pp
  2. 6 1
      tests/utils/teststr.pp

+ 39 - 4
tests/utils/dotest.pp

@@ -374,6 +374,7 @@ function RunCompiler:boolean;
 var
 var
   outname,
   outname,
   args : string;
   args : string;
+  execres : boolean;
 begin
 begin
   RunCompiler:=false;
   RunCompiler:=false;
   OutName:=ForceExtension(PPFile,'log');
   OutName:=ForceExtension(PPFile,'log');
@@ -388,9 +389,23 @@ begin
   args:=args+' '+ppfile;
   args:=args+' '+ppfile;
   Verbose(V_Debug,'Executing '+compilerbin+' '+args);
   Verbose(V_Debug,'Executing '+compilerbin+' '+args);
   { also get the output from as and ld that writes to stderr sometimes }
   { also get the output from as and ld that writes to stderr sometimes }
-  ExecuteRedir(CompilerBin,args,'',OutName,OutName);
+  execres:=ExecuteRedir(CompilerBin,args,'',OutName,OutName);
   Verbose(V_Debug,'Exitcode '+ToStr(ExecuteResult));
   Verbose(V_Debug,'Exitcode '+ToStr(ExecuteResult));
 
 
+  { Error during execution? }
+  if (not execres) and (ExecuteResult=0) then
+    begin
+      AddLog(FailLogFile,TestName);
+      AddLog(ResLogFile,failed_to_execute_compiler+PPFileInfo);
+      AddLog(LongLogFile,line_separation);
+      AddLog(LongLogFile,failed_to_execute_compiler+PPFileInfo);
+      CopyFile(OutName,LongLogFile,true);
+      { avoid to try again }
+      AddLog(ForceExtension(PPFile,'elg'),failed_to_execute_compiler+PPFileInfo);
+      Verbose(V_Abort,'IOStatus: '+ToStr(IOStatus));
+      exit;
+    end;
+
   { Check for internal error }
   { Check for internal error }
   if ExitWithInternalError(OutName) then
   if ExitWithInternalError(OutName) then
    begin
    begin
@@ -476,8 +491,10 @@ function RunExecutable:boolean;
 var
 var
   outname,
   outname,
   TestExe : string;
   TestExe : string;
+  execres  : boolean;
 begin
 begin
   RunExecutable:=false;
   RunExecutable:=false;
+  execres:=true;	
   TestExe:=ForceExtension(PPFile,ExeExt);
   TestExe:=ForceExtension(PPFile,ExeExt);
   OutName:=ForceExtension(PPFile,'elg');
   OutName:=ForceExtension(PPFile,'elg');
   Verbose(V_Debug,'Executing '+TestExe);
   Verbose(V_Debug,'Executing '+TestExe);
@@ -497,11 +514,26 @@ begin
     begin
     begin
       { don't redirect interactive and graph programs .. }
       { don't redirect interactive and graph programs .. }
       if Config.IsInteractive or Config.UsesGraph then
       if Config.IsInteractive or Config.UsesGraph then
-        ExecuteRedir(TestExe,'','','','')
+        execres:=ExecuteRedir(TestExe,'','','','')
       else
       else
-        ExecuteRedir(TestExe,'','',OutName,'');
+        execres:=ExecuteRedir(TestExe,'','',OutName,'');
     end;
     end;
   Verbose(V_Debug,'Exitcode '+ToStr(ExecuteResult));
   Verbose(V_Debug,'Exitcode '+ToStr(ExecuteResult));
+  
+  { Error during execution? }
+  if (not execres) and (ExecuteResult=0) then
+    begin
+      AddLog(FailLogFile,TestName);
+      AddLog(ResLogFile,failed_to_execute_test+PPFileInfo);
+      AddLog(LongLogFile,line_separation);
+      AddLog(LongLogFile,failed_to_execute_test+PPFileInfo);
+      CopyFile(OutName,LongLogFile,true);
+      { avoid to try again }
+      AddLog(ForceExtension(PPFile,'elg'),failed_to_execute_test+PPFileInfo);
+      Verbose(V_Abort,'IOStatus: '+ToStr(IOStatus));
+      exit;
+    end;
+
   if ExecuteResult<>Config.ResultCode then
   if ExecuteResult<>Config.ResultCode then
    begin
    begin
      if (ExecuteResult<>0) and
      if (ExecuteResult<>0) and
@@ -825,7 +857,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.31  2004-04-01 12:51:32  olle
+  Revision 1.32  2004-04-29 21:41:44  peter
+    * test result of execution and report as failure with iostatus displayed
+
+  Revision 1.31  2004/04/01 12:51:32  olle
     + Several -Y<opt> is now allowed
     + Several -Y<opt> is now allowed
 
 
   Revision 1.30  2004/03/21 19:15:18  florian
   Revision 1.30  2004/03/21 19:15:18  florian

+ 6 - 1
tests/utils/teststr.pp

@@ -27,6 +27,8 @@ const
   successfully_compiled = 'Successfully compiled ';
   successfully_compiled = 'Successfully compiled ';
   failed_to_run = 'Failed to run ';
   failed_to_run = 'Failed to run ';
   successfully_run = 'Successfully run ';
   successfully_run = 'Successfully run ';
+  failed_to_execute_compiler = 'Failed to execute compiler ';
+  failed_to_execute_test = 'Failed to execute test ';
   skipping_graph_test = 'Skipping test because it uses graph ';
   skipping_graph_test = 'Skipping test because it uses graph ';
   skipping_interactive_test = 'Skipping test because it is interactive ';
   skipping_interactive_test = 'Skipping test because it is interactive ';
   skipping_known_bug = 'Skipping test because it is a known bug ';
   skipping_known_bug = 'Skipping test because it is a known bug ';
@@ -47,7 +49,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.5  2003-10-13 14:19:02  peter
+  Revision 1.6  2004-04-29 21:41:44  peter
+    * test result of execution and report as failure with iostatus displayed
+
+  Revision 1.5  2003/10/13 14:19:02  peter
     * digest updated for max version limit
     * digest updated for max version limit
 
 
   Revision 1.4  2002/12/24 21:47:49  peter
   Revision 1.4  2002/12/24 21:47:49  peter