digest.pp 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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. teststr;
  15. const
  16. failed_to_compile_count : longint = 0;
  17. failed_to_compile_unimplemented_count : longint = 0;
  18. success_compilation_failed_count : longint = 0;
  19. success_compilation_failed_unimplemented_count : longint = 0;
  20. failed_compilation_successful_count : longint = 0;
  21. failed_compilation_successful_unimplemented_count : longint = 0;
  22. successfully_compiled_count : longint = 0;
  23. successfully_compiled_unimplemented_count : longint = 0;
  24. failed_to_run_count : longint = 0;
  25. failed_to_run_unimplemented_count : longint = 0;
  26. known_run_problem : longint = 0;
  27. successfully_run_count : longint = 0;
  28. successfully_run_unimplemented_count : longint = 0;
  29. skipping_graph_test_count : longint = 0;
  30. skipping_interactive_test_count : longint = 0;
  31. skipping_known_bug_count : longint = 0;
  32. skipping_other_version_count : longint = 0;
  33. skipping_other_cpu_count : longint = 0;
  34. skipping_other_target_count : longint = 0;
  35. skipping_run_unit_count : longint = 0;
  36. skipping_run_test_count : longint = 0;
  37. unknown_lines : longint = 0;
  38. unexpected_run : longint = 0;
  39. next_should_be_run : boolean = false;
  40. var
  41. prevline : string;
  42. procedure analyse (const st : string);
  43. var
  44. should_be_run : boolean;
  45. begin
  46. if st=prevline then
  47. exit;
  48. prevline:=st;
  49. should_be_run:=next_should_be_run;
  50. if next_should_be_run and
  51. (pos(failed_to_run,st)<>1) and
  52. (pos(failed_to_run_unimplemented,st)<>1) and
  53. (pos(successfully_run,st)<>1) and
  54. (pos(successfully_run_unimplemented,st)<>1) and
  55. (pos(skipping_known_bug,st)<>1) and
  56. (pos(skipping_run_test,st)<>1) and
  57. (pos(skipping_run_unit,st)<>1) then
  58. begin
  59. Writeln('No run found for "',prevline,'"');
  60. end;
  61. next_should_be_run:=false;
  62. if pos(failed_to_compile,st)=1 then
  63. begin
  64. inc(failed_to_compile_count);
  65. end
  66. else if pos(failed_to_compile_unimplemented,st)=1 then
  67. begin
  68. inc(failed_to_compile_unimplemented_count);
  69. end
  70. else if pos(success_compilation_failed,st)=1 then
  71. begin
  72. inc(success_compilation_failed_count);
  73. end
  74. else if pos(success_compilation_failed_unimplemented,st)=1 then
  75. begin
  76. inc(success_compilation_failed_unimplemented_count);
  77. end
  78. else if pos(failed_compilation_successful,st)=1 then
  79. begin
  80. inc(failed_compilation_successful_count);
  81. end
  82. else if pos(failed_compilation_successful_unimplemented,st)=1 then
  83. begin
  84. inc(failed_compilation_successful_unimplemented_count);
  85. end
  86. else if pos(successfully_compiled,st)=1 then
  87. begin
  88. inc(successfully_compiled_count);
  89. next_should_be_run:=true;
  90. end
  91. else if pos(successfully_compiled_unimplemented,st)=1 then
  92. begin
  93. inc(successfully_compiled_unimplemented_count);
  94. next_should_be_run:=true;
  95. end
  96. else if (pos(failed_to_run,st)=1) then
  97. begin
  98. inc(failed_to_run_count);
  99. if not should_be_run then
  100. inc(unexpected_run);
  101. if pos(known_problem,st)>0 then
  102. inc(known_run_problem);
  103. end
  104. else if (pos(failed_to_run_unimplemented,st)=1) then
  105. begin
  106. inc(failed_to_run_unimplemented_count);
  107. { Increase these as well? }
  108. {if not should_be_run then
  109. inc(unexpected_run);
  110. if pos(known_problem,st)>0 then
  111. inc(known_run_problem);}
  112. end
  113. else if pos(successfully_run,st)=1 then
  114. begin
  115. inc(successfully_run_count);
  116. if not should_be_run then
  117. inc(unexpected_run);
  118. end
  119. else if pos(successfully_run_unimplemented,st)=1 then
  120. begin
  121. inc(successfully_run_unimplemented_count);
  122. { Increase this, too? }
  123. {if not should_be_run then
  124. inc(unexpected_run);}
  125. end
  126. else if pos(skipping_graph_test,st)=1 then
  127. begin
  128. inc(skipping_graph_test_count);
  129. end
  130. else if pos(skipping_interactive_test,st)=1 then
  131. begin
  132. inc(skipping_interactive_test_count);
  133. end
  134. else if pos(skipping_known_bug,st)=1 then
  135. begin
  136. inc(skipping_known_bug_count);
  137. end
  138. else if pos(skipping_compiler_version_too_low,st)=1 then
  139. begin
  140. inc(skipping_other_version_count);
  141. end
  142. else if pos(skipping_compiler_version_too_high,st)=1 then
  143. begin
  144. inc(skipping_other_version_count);
  145. end
  146. else if pos(skipping_other_cpu,st)=1 then
  147. begin
  148. inc(skipping_other_cpu_count);
  149. end
  150. else if pos(skipping_other_target,st)=1 then
  151. begin
  152. inc(skipping_other_target_count);
  153. end
  154. else if pos(skipping_run_unit,st)=1 then
  155. begin
  156. inc(skipping_run_unit_count);
  157. end
  158. else if pos(skipping_run_test,st)=1 then
  159. begin
  160. inc(skipping_run_test_count);
  161. end
  162. else
  163. begin
  164. Writeln('Unknown line "',st,'"');
  165. inc(unknown_lines);
  166. end;
  167. end;
  168. procedure display_results;
  169. var
  170. number_compilations : longint;
  171. number_compilations_unimplemented : longint;
  172. number_skipped : longint;
  173. number_runs : longint;
  174. number_runs_unimplemented : longint;
  175. all_errors : longint;
  176. all_success : longint;
  177. all_unimplemented : longint;
  178. begin
  179. all_errors:=failed_to_compile_count
  180. +failed_compilation_successful_count
  181. +failed_to_run_count;
  182. all_success:=success_compilation_failed_count
  183. +successfully_compiled_count
  184. +successfully_run_count;
  185. all_unimplemented:=failed_to_compile_unimplemented_count
  186. +failed_compilation_successful_unimplemented_count
  187. +failed_to_run_unimplemented_count
  188. +success_compilation_failed_unimplemented_count
  189. +successfully_compiled_unimplemented_count
  190. +successfully_run_unimplemented_count;
  191. { about compilations }
  192. number_compilations_unimplemented:=failed_to_compile_unimplemented_count
  193. +success_compilation_failed_unimplemented_count
  194. +failed_compilation_successful_unimplemented_count
  195. +successfully_compiled_unimplemented_count;
  196. number_compilations:=failed_to_compile_count
  197. +success_compilation_failed_count
  198. +failed_compilation_successful_count
  199. +successfully_compiled_count
  200. +number_compilations_unimplemented;
  201. { about runs }
  202. number_runs_unimplemented:=failed_to_run_unimplemented_count
  203. +successfully_run_unimplemented_count;
  204. number_runs:=failed_to_run_count
  205. +successfully_run_count
  206. +number_runs_unimplemented;
  207. Writeln('Total = ',number_compilations+number_runs,' (',
  208. all_errors,':',
  209. all_success,':',
  210. all_unimplemented,')');
  211. Writeln('Total number of compilations = ', number_compilations,' (',
  212. failed_to_compile_count+failed_compilation_successful_count,':',
  213. successfully_compiled_count+success_compilation_failed_count,':',
  214. number_compilations_unimplemented,')');
  215. Writeln('Successfully compiled = ', successfully_compiled_count, ' (', successfully_compiled_unimplemented_count, ')');
  216. Writeln('Successfully failed = ', success_compilation_failed_count, ' (', success_compilation_failed_unimplemented_count, ')');
  217. Writeln('Compilation failures = ', failed_to_compile_count, ' (', failed_to_compile_unimplemented_count, ')');
  218. Writeln('Compilation that did not fail while they should = ', failed_compilation_successful_count, ' (', failed_compilation_successful_unimplemented_count, ')');
  219. Writeln('Total number of runs = ', number_runs,' (',
  220. failed_to_run_count,':',
  221. successfully_run_count,':',
  222. number_runs_unimplemented,')');
  223. Writeln('Successful runs = ', successfully_run_count, ' (', successfully_run_unimplemented_count, ')');
  224. Writeln('Failed runs = ', failed_to_run_count, ' (', failed_to_run_unimplemented_count, ')');
  225. if known_run_problem>0 then
  226. Writeln('From these ',known_run_problem,' known problems');
  227. Writeln('Number of unimplemented tests = ', all_unimplemented,' (',
  228. failed_to_compile_unimplemented_count
  229. +failed_compilation_successful_unimplemented_count
  230. +failed_to_run_unimplemented_count,':',
  231. success_compilation_failed_unimplemented_count
  232. +successfully_compiled_unimplemented_count
  233. +successfully_run_unimplemented_count,')');
  234. if successfully_compiled_count <>
  235. number_runs+skipping_run_unit_count+skipping_run_test_count-number_runs_unimplemented then
  236. begin
  237. Writeln('Number units compiled = ',skipping_run_unit_count);
  238. Writeln('Number program that should not be run = ',skipping_run_test_count);
  239. end;
  240. { about skipped tests }
  241. number_skipped:= skipping_graph_test_count
  242. +skipping_interactive_test_count
  243. +skipping_known_bug_count
  244. +skipping_other_version_count
  245. +skipping_other_cpu_count
  246. +skipping_other_target_count;
  247. { don't count these ones ...
  248. skipping_run_unit_count
  249. skipping_run_test_count }
  250. Writeln('Number of skipped tests = ',number_skipped);
  251. Writeln('Number of skipped graph tests = ',skipping_graph_test_count);
  252. Writeln('Number of skipped interactive tests = ',skipping_interactive_test_count);
  253. Writeln('Number of skipped known bug tests = ',skipping_known_bug_count);
  254. Writeln('Number of skipped tests for other versions = ',skipping_other_version_count);
  255. Writeln('Number of skipped tests for other cpus = ',skipping_other_cpu_count);
  256. Writeln('Number of skipped tests for other targets = ',skipping_other_target_count);
  257. if unknown_lines>0 then
  258. Writeln('Number of unrecognized lines = ',unknown_lines);
  259. if unexpected_run>0 then
  260. Writeln('Number of unexpected runs = ',unexpected_run);
  261. end;
  262. var
  263. logfile : text;
  264. logfilename,
  265. line : string;
  266. begin
  267. if Paramcount>0 then
  268. logfilename:=Paramstr(1)
  269. else
  270. logfilename:=ResLogfile;
  271. assign(logfile,logfilename);
  272. {$i-}
  273. reset(logfile);
  274. if ioresult<>0 then
  275. begin
  276. Writeln('Unable to open ',logfilename);
  277. halt(1);
  278. end;
  279. {$i+}
  280. while not eof(logfile) do
  281. begin
  282. readln(logfile,line);
  283. analyse(line);
  284. end;
  285. close(logfile);
  286. display_results;
  287. end.