]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/binaries/utilities/test_library.ml
* trust = true
[helm.git] / helm / software / components / binaries / utilities / test_library.ml
index 1947919aedca4896af2c7893c3b12f926141098c..03742ac308a7efc02d68b929158fc5846e169f55 100644 (file)
@@ -23,7 +23,7 @@
  * http://helm.cs.unibo.it/
  *)
 
-let trust = false
+let trust = true
 let conffile = "../../../matita/matita.conf.xml"
 
 let _ = CicEnvironment.set_trust (fun _ -> trust);;
@@ -43,7 +43,7 @@ let _ =
     Printf.printf "%s\n" separator;
     Printf.printf "Total: %.2f\n" !new_total;
     if !old_total <> 0.0 then
-     Printf.printf "Old: %.2f (%.2f)\n" !old_total (perc !new_total !old_total))
+     Printf.printf "Old: %.2f (%.2f%%)\n" !old_total (perc !new_total !old_total))
 ;;
 
 let urifname =
@@ -55,6 +55,8 @@ let urifname =
 
 let ic = open_in urifname
 
+exception Done;;
+
 let _ =
   try
     while true do
@@ -64,10 +66,12 @@ let _ =
         let uri,res,time =
          match Str.split (Str.regexp " ") uri with
             uri::res::time::_ -> uri, Some res, Some (float_of_string time)
+          | [uri;res] -> uri, Some res, None
           | [ uri ] -> uri, None, None
           | _ -> assert false
         in
         Printf.printf "%s " uri;
+        flush stdout;
         let uri = UriManager.uri_of_string uri in
         let before = Unix.gettimeofday () in
         ignore (CicTypeChecker.typecheck uri);
@@ -83,18 +87,33 @@ let _ =
       with
         | End_of_file as exn -> raise exn
         | Sys.Break ->
-           Printf.printf "\e[0;31mSKIPPED\e[0m\n";
-           flush stdout;
-           Printf.eprintf "\e[0;31mContinue with next URI? [y/_]\e[0m";
-           flush stderr;
-           (match input_line stdin with
-               "y" -> ()
-             | _ -> raise Sys.Break)
+           let rec skip_break prompt =
+            try
+             if prompt then
+              begin
+               Printf.printf "\e[0;31mSKIPPED\e[0m\n";
+               flush stdout;
+               Printf.eprintf "\e[0;31mContinue with next URI? [y/_]\e[0m";
+               flush stderr;
+              end;
+             (match input_line stdin with
+                 "y" -> ()
+               | _ -> raise Done)
+            with
+             Sys.Break -> skip_break false
+           in
+            skip_break true
         | exn ->
            Printf.printf "\e[0;31mFAIL\e[0m\n";
            flush stdout;
-           prerr_endline (Printexc.to_string exn)
+           prerr_endline
+            (match exn with
+                CicTypeChecker.TypeCheckerFailure msg ->
+                 "TypeCheckerFailure: " ^ Lazy.force msg
+              | CicTypeChecker.AssertFailure msg ->
+                 "TypeCheckerAssertion: " ^ Lazy.force msg
+              | _ -> Printexc.to_string exn)
     done
   with
      End_of_file
-   | Sys.Break -> ()
+   | Done -> ()