digest.pp 6.5 KB

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