digest.pp 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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_other_version_count : longint = 0;
  28. skipping_other_cpu_count : longint = 0;
  29. skipping_other_target_count : longint = 0;
  30. skipping_run_unit_count : longint = 0;
  31. skipping_run_test_count : longint = 0;
  32. unknown_lines : longint = 0;
  33. unexpected_run : longint = 0;
  34. next_should_be_run : boolean = false;
  35. var
  36. prevline : string;
  37. procedure analyse (const st : string);
  38. var
  39. should_be_run : boolean;
  40. begin
  41. if st=prevline then
  42. exit;
  43. prevline:=st;
  44. should_be_run:=next_should_be_run;
  45. if next_should_be_run and
  46. (pos(failed_to_run,st)<>1) and
  47. (pos(successfully_run,st)<>1) and
  48. (pos(skipping_known_bug,st)<>1) and
  49. (pos(skipping_run_test,st)<>1) and
  50. (pos(skipping_run_unit,st)<>1) then
  51. begin
  52. Writeln('No run found for "',prevline,'"');
  53. end;
  54. next_should_be_run:=false;
  55. if pos(failed_to_compile,st) = 1 then
  56. begin
  57. inc(failed_to_compile_count);
  58. end
  59. else if pos(success_compilation_failed,st)=1 then
  60. begin
  61. inc(success_compilation_failed_count);
  62. end
  63. else if pos(failed_compilation_successful,st)=1 then
  64. begin
  65. inc(failed_compilation_successful_count);
  66. end
  67. else if pos(successfully_compiled,st)=1 then
  68. begin
  69. inc(successfully_compiled_count);
  70. next_should_be_run:=true;
  71. end
  72. else if pos(failed_to_run,st)=1 then
  73. begin
  74. inc(failed_to_run_count);
  75. if not should_be_run then
  76. inc(unexpected_run);
  77. if pos(known_problem,st)>0 then
  78. inc(known_run_problem);
  79. end
  80. else if pos(successfully_run,st)=1 then
  81. begin
  82. inc(successfully_run_count);
  83. if not should_be_run then
  84. inc(unexpected_run);
  85. end
  86. else if pos(skipping_graph_test,st)=1 then
  87. begin
  88. inc(skipping_graph_test_count);
  89. end
  90. else if pos(skipping_interactive_test,st)=1 then
  91. begin
  92. inc(skipping_interactive_test_count);
  93. end
  94. else if pos(skipping_known_bug,st)=1 then
  95. begin
  96. inc(skipping_known_bug_count);
  97. end
  98. else if pos(skipping_compiler_version_too_low,st)=1 then
  99. begin
  100. inc(skipping_other_version_count);
  101. end
  102. else if pos(skipping_compiler_version_too_high,st)=1 then
  103. begin
  104. inc(skipping_other_version_count);
  105. end
  106. else if pos(skipping_other_cpu,st)=1 then
  107. begin
  108. inc(skipping_other_cpu_count);
  109. end
  110. else if pos(skipping_other_target,st)=1 then
  111. begin
  112. inc(skipping_other_target_count);
  113. end
  114. else if pos(skipping_run_unit,st)=1 then
  115. begin
  116. inc(skipping_run_unit_count);
  117. end
  118. else if pos(skipping_run_test,st)=1 then
  119. begin
  120. inc(skipping_run_test_count);
  121. end
  122. else
  123. begin
  124. Writeln('Unknown line "',st,'"');
  125. inc(unknown_lines);
  126. end;
  127. end;
  128. procedure display_results;
  129. var
  130. number_compilations : longint;
  131. number_skipped : longint;
  132. number_runs : longint;
  133. all_errors : longint;
  134. all_success : longint;
  135. begin
  136. all_errors:=failed_to_compile_count
  137. +failed_compilation_successful_count
  138. +failed_to_run_count;
  139. all_success:=success_compilation_failed_count
  140. +successfully_compiled_count
  141. +successfully_run_count;
  142. { about compilations }
  143. number_compilations:=failed_to_compile_count
  144. +success_compilation_failed_count
  145. +failed_compilation_successful_count
  146. +successfully_compiled_count;
  147. { about runs }
  148. number_runs:=failed_to_run_count+successfully_run_count;
  149. Writeln('Total = ',number_compilations+number_runs,' (',
  150. all_errors,':',
  151. all_success,')');
  152. Writeln('Total number of compilations = ', number_compilations,' (',
  153. failed_to_compile_count+failed_compilation_successful_count,':',
  154. successfully_compiled_count+success_compilation_failed_count,')');
  155. Writeln('Successfully compiled = ', successfully_compiled_count);
  156. Writeln('Successfully failed = ', success_compilation_failed_count);
  157. Writeln('Compilation failures = ', failed_to_compile_count);
  158. Writeln('Compilation that did not fail while they should = ', failed_compilation_successful_count);
  159. Writeln('Total number of runs = ', number_runs,' (',
  160. failed_to_run_count,':',
  161. successfully_run_count,')');
  162. Writeln('Successful runs = ', successfully_run_count);
  163. Writeln('Failed runs = ', failed_to_run_count);
  164. if known_run_problem>0 then
  165. Writeln('From these ',known_run_problem,' known problems');
  166. if successfully_compiled_count <>
  167. number_runs+skipping_run_unit_count+skipping_run_test_count then
  168. begin
  169. Writeln('Number units compiled = ',skipping_run_unit_count);
  170. Writeln('Number program that should not be run = ',skipping_run_test_count);
  171. end;
  172. { about skipped tests }
  173. number_skipped:= skipping_graph_test_count
  174. +skipping_interactive_test_count
  175. +skipping_known_bug_count
  176. +skipping_other_version_count
  177. +skipping_other_cpu_count
  178. +skipping_other_target_count;
  179. { don't count these ones ...
  180. skipping_run_unit_count
  181. skipping_run_test_count }
  182. Writeln('Number of skipped tests = ',number_skipped);
  183. Writeln('Number of skipped graph tests = ',skipping_graph_test_count);
  184. Writeln('Number of skipped interactive tests = ',skipping_interactive_test_count);
  185. Writeln('Number of skipped known bug tests = ',skipping_known_bug_count);
  186. Writeln('Number of skipped tests for other versions = ',skipping_other_version_count);
  187. Writeln('Number of skipped tests for other cpus = ',skipping_other_cpu_count);
  188. Writeln('Number of skipped tests for other targets = ',skipping_other_target_count);
  189. if unknown_lines>0 then
  190. Writeln('Number of unrecognized lines = ',unknown_lines);
  191. if unexpected_run>0 then
  192. Writeln('Number of unexpected runs = ',unexpected_run);
  193. end;
  194. var
  195. logfile : text;
  196. logfilename,
  197. line : string;
  198. begin
  199. if Paramcount>0 then
  200. logfilename:=Paramstr(1)
  201. else
  202. logfilename:=ResLogfile;
  203. assign(logfile,logfilename);
  204. {$i-}
  205. reset(logfile);
  206. if ioresult<>0 then
  207. begin
  208. Writeln('Unable to open ',logfilename);
  209. halt(1);
  210. end;
  211. {$i+}
  212. while not eof(logfile) do
  213. begin
  214. readln(logfile,line);
  215. analyse(line);
  216. end;
  217. close(logfile);
  218. display_results;
  219. end.
  220. {
  221. $Log$
  222. Revision 1.5 2003-10-31 16:51:46 peter
  223. * skip known bug for run
  224. Revision 1.4 2003/10/13 14:19:02 peter
  225. * digest updated for max version limit
  226. Revision 1.3 2002/12/24 21:47:49 peter
  227. * NeedTarget, SkipTarget, SkipCPU added
  228. * Retrieve compiler info in a single call for 1.1 compiler
  229. Revision 1.2 2002/11/18 16:42:43 pierre
  230. + KNOWNRUNERROR added
  231. Revision 1.1 2002/11/13 15:26:24 pierre
  232. + digest program added
  233. }