digest.pp 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. {
  2. $Id$
  3. This file is part of the Free Pascal test suite.
  4. Copyright (c) 2002 by the Free Pascal development team.
  5. This program generates a digest
  6. of the last tests run.
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. program digest;
  14. uses
  15. teststr;
  16. const
  17. failed_to_compile_count : longint = 0;
  18. success_compilation_failed_count : longint = 0;
  19. failed_compilation_successful_count : longint = 0;
  20. successfully_compiled_count : longint = 0;
  21. failed_to_run_count : longint = 0;
  22. known_run_problem : longint = 0;
  23. successfully_run_count : longint = 0;
  24. skipping_graph_test_count : longint = 0;
  25. skipping_interactive_test_count : longint = 0;
  26. skipping_known_bug_count : longint = 0;
  27. skipping_compiler_version_too_low_count : longint = 0;
  28. skipping_other_cpu_count : longint = 0;
  29. skipping_run_unit_count : longint = 0;
  30. skipping_run_test_count : longint = 0;
  31. unknown_lines : longint = 0;
  32. unexpected_run : longint = 0;
  33. next_should_be_run : boolean = false;
  34. var
  35. prevline : string;
  36. procedure analyse (const st : string);
  37. var
  38. should_be_run : boolean;
  39. begin
  40. if st=prevline then
  41. exit;
  42. prevline:=st;
  43. should_be_run:=next_should_be_run;
  44. if next_should_be_run and
  45. (pos(failed_to_run,st)<>1) and
  46. (pos(successfully_run,st)<>1) and
  47. (pos(skipping_run_test,st)<>1) and
  48. (pos(skipping_run_unit,st)<>1) then
  49. begin
  50. Writeln('No run found for "',prevline,'"');
  51. end;
  52. next_should_be_run:=false;
  53. if pos(failed_to_compile,st) = 1 then
  54. begin
  55. inc(failed_to_compile_count);
  56. end
  57. else if pos(success_compilation_failed,st)=1 then
  58. begin
  59. inc(success_compilation_failed_count);
  60. end
  61. else if pos(failed_compilation_successful,st)=1 then
  62. begin
  63. inc(failed_compilation_successful_count);
  64. end
  65. else if pos(successfully_compiled,st)=1 then
  66. begin
  67. inc(successfully_compiled_count);
  68. next_should_be_run:=true;
  69. end
  70. else if pos(failed_to_run,st)=1 then
  71. begin
  72. inc(failed_to_run_count);
  73. if not should_be_run then
  74. inc(unexpected_run);
  75. if pos(known_problem,st)>0 then
  76. inc(known_run_problem);
  77. end
  78. else if pos(successfully_run,st)=1 then
  79. begin
  80. inc(successfully_run_count);
  81. if not should_be_run then
  82. inc(unexpected_run);
  83. end
  84. else if pos(skipping_graph_test,st)=1 then
  85. begin
  86. inc(skipping_graph_test_count);
  87. end
  88. else if pos(skipping_interactive_test,st)=1 then
  89. begin
  90. inc(skipping_interactive_test_count);
  91. end
  92. else if pos(skipping_known_bug,st)=1 then
  93. begin
  94. inc(skipping_known_bug_count);
  95. end
  96. else if pos(skipping_compiler_version_too_low,st)=1 then
  97. begin
  98. inc(skipping_compiler_version_too_low_count);
  99. end
  100. else if pos(skipping_other_cpu,st)=1 then
  101. begin
  102. inc(skipping_other_cpu_count);
  103. end
  104. else if pos(skipping_run_unit,st)=1 then
  105. begin
  106. inc(skipping_run_unit_count);
  107. end
  108. else if pos(skipping_run_test,st)=1 then
  109. begin
  110. inc(skipping_run_test_count);
  111. end
  112. else
  113. begin
  114. Writeln('Unknown line "',st,'"');
  115. inc(unknown_lines);
  116. end;
  117. end;
  118. procedure display_results;
  119. var
  120. number_compilations : longint;
  121. number_skipped : longint;
  122. number_runs : longint;
  123. all_errors : longint;
  124. all_success : longint;
  125. begin
  126. all_errors:=failed_to_compile_count
  127. +failed_compilation_successful_count
  128. +failed_to_run_count;
  129. all_success:=success_compilation_failed_count
  130. +successfully_compiled_count
  131. +successfully_run_count;
  132. { about compilations }
  133. number_compilations:=failed_to_compile_count
  134. +success_compilation_failed_count
  135. +failed_compilation_successful_count
  136. +successfully_compiled_count;
  137. { about runs }
  138. number_runs:=failed_to_run_count+successfully_run_count;
  139. Writeln('Total = ',number_compilations+number_runs,' (',
  140. all_errors,':',
  141. all_success,')');
  142. Writeln('Total number of compilations = ', number_compilations,' (',
  143. failed_to_compile_count+failed_compilation_successful_count,':',
  144. successfully_compiled_count+success_compilation_failed_count,')');
  145. Writeln('Successfully compiled = ', successfully_compiled_count);
  146. Writeln('Successfully failed = ', success_compilation_failed_count);
  147. Writeln('Compilation failures = ', failed_to_compile_count);
  148. Writeln('Compilation that did not fail while they should = ', failed_compilation_successful_count);
  149. Writeln('Total number of runs = ', number_runs,' (',
  150. failed_to_run_count,':',
  151. successfully_run_count,')');
  152. Writeln('Successful runs = ', successfully_run_count);
  153. Writeln('Failed runs = ', failed_to_run_count);
  154. if known_run_problem>0 then
  155. Writeln('From these ',known_run_problem,' known problems');
  156. if successfully_compiled_count <>
  157. number_runs+skipping_run_unit_count+skipping_run_test_count then
  158. begin
  159. Writeln('Number units compiled = ',skipping_run_unit_count);
  160. Writeln('Number program that should not be run = ',skipping_run_test_count);
  161. end;
  162. { about skipped tests }
  163. number_skipped:= skipping_graph_test_count
  164. +skipping_interactive_test_count
  165. +skipping_known_bug_count
  166. +skipping_compiler_version_too_low_count
  167. +skipping_other_cpu_count;
  168. { don't count these ones ...
  169. skipping_run_unit_count
  170. skipping_run_test_count }
  171. Writeln('Number of skipped tests = ',number_skipped);
  172. Writeln('Number of skipped graph tests = ',skipping_graph_test_count);
  173. Writeln('Number of skipped interactive tests = ',skipping_interactive_test_count);
  174. Writeln('Number of skipped known bug tests = ',skipping_known_bug_count);
  175. Writeln('Number of skipped compiler version too low tests = ',skipping_compiler_version_too_low_count);
  176. Writeln('Number of skipped tests for other cpus = ',skipping_other_cpu_count);
  177. if unknown_lines>0 then
  178. Writeln('Number of unrecognized lines = ',unknown_lines);
  179. if unexpected_run>0 then
  180. Writeln('Number of unexpected runs = ',unexpected_run);
  181. end;
  182. var
  183. logfile : text;
  184. logfilename,
  185. line : string;
  186. begin
  187. if Paramcount>0 then
  188. logfilename:=Paramstr(1)
  189. else
  190. logfilename:=ResLogfile;
  191. assign(logfile,logfilename);
  192. {$i-}
  193. reset(logfile);
  194. if ioresult<>0 then
  195. begin
  196. Writeln('Unable to open ',logfilename);
  197. halt(1);
  198. end;
  199. {$i+}
  200. while not eof(logfile) do
  201. begin
  202. readln(logfile,line);
  203. analyse(line);
  204. end;
  205. close(logfile);
  206. display_results;
  207. end.
  208. {
  209. $Log$
  210. Revision 1.2 2002-11-18 16:42:43 pierre
  211. + KNOWNRUNERROR added
  212. Revision 1.1 2002/11/13 15:26:24 pierre
  213. + digest program added
  214. }