digest.pp 6.9 KB

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