digest.pp 7.6 KB

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