From: Claudio Sacerdoti Coen Date: Fri, 24 Mar 2006 17:56:35 +0000 (+0000) Subject: Serious test for the Coq library added (name test_library). X-Git-Tag: make_still_working~7465 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=2a328e2a7623584d5593a9cc547c336c31ad1243;p=helm.git Serious test for the Coq library added (name test_library). Input: a file that holds a list of URIs. Output: the benchmark; the output file is also a valid input. In this case the output also prints the differences w.r.t. the last execution. Ctrl-break can be used to interrupt the type-checking of a single URI. An interactive question is posed to the user to decide if proceeding with the next URIs or not. --- diff --git a/helm/software/components/binaries/utilities/Makefile b/helm/software/components/binaries/utilities/Makefile index c22d2a99d..314136db5 100644 --- a/helm/software/components/binaries/utilities/Makefile +++ b/helm/software/components/binaries/utilities/Makefile @@ -1,6 +1,6 @@ H=@ -UTILITIES = create_environment parse_library list_uris +UTILITIES = create_environment parse_library list_uris test_library UTILITIES_OPT = $(patsubst %,%.opt,$(UTILITIES)) LINKOPTS = -linkpkg -thread LIBS = helm-cic_proof_checking diff --git a/helm/software/components/binaries/utilities/test_library.ml b/helm/software/components/binaries/utilities/test_library.ml new file mode 100644 index 000000000..1947919ae --- /dev/null +++ b/helm/software/components/binaries/utilities/test_library.ml @@ -0,0 +1,100 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +let trust = false +let conffile = "../../../matita/matita.conf.xml" + +let _ = CicEnvironment.set_trust (fun _ -> trust);; +let _ = Helm_registry.load_from conffile;; + +let old_total = ref 0.0 +let new_total = ref 0.0 + +let separator = "=============" + +let perc newt oldt = (newt -. oldt) /. oldt *. 100.0 + +let _ = + Sys.catch_break true; + at_exit + (fun () -> + 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)) +;; + +let urifname = + try + Sys.argv.(1) + with Invalid_argument _ -> + prerr_endline "You must supply a file with the list of URIs to check"; + exit (-1) + +let ic = open_in urifname + +let _ = + try + while true do + try + let uri = input_line ic in + if uri = separator then raise End_of_file; + let uri,res,time = + match Str.split (Str.regexp " ") uri with + uri::res::time::_ -> uri, Some res, Some (float_of_string time) + | [ uri ] -> uri, None, None + | _ -> assert false + in + Printf.printf "%s " uri; + let uri = UriManager.uri_of_string uri in + let before = Unix.gettimeofday () in + ignore (CicTypeChecker.typecheck uri); + let after = Unix.gettimeofday () in + let diff = after -. before in + new_total := !new_total +. diff; + Printf.printf "OK %.2f" diff; + (match time with + None -> Printf.printf "\n" + | Some time -> + old_total := !old_total +. time; + Printf.printf " %.2f%%\n" (perc diff time)) + with + | End_of_file as exn -> raise exn + | Sys.Break -> + Printf.printf "SKIPPED\n"; + flush stdout; + Printf.eprintf "Continue with next URI? [y/_]"; + flush stderr; + (match input_line stdin with + "y" -> () + | _ -> raise Sys.Break) + | exn -> + Printf.printf "FAIL\n"; + flush stdout; + prerr_endline (Printexc.to_string exn) + done + with + End_of_file + | Sys.Break -> ()