X-Git-Url: http://git.hcoop.net/bpt/coccinelle.git/blobdiff_plain/174d164065f16d4a54fd565b9cae251e89a5095e..993936c04d73e4c97d0dc0910dbbef5f2c684c15:/testing.ml diff --git a/testing.ml b/testing.ml index dee8ff1..3f5ec1e 100644 --- a/testing.ml +++ b/testing.ml @@ -457,30 +457,33 @@ let test_parse_cocci file = if not (file =~ ".*\\.cocci") then pr2 "warning: seems not a .cocci file"; - let (_,xs,_,_,_,_,grep_tokens,query) = + let (_,xs,_,_,_,_,(grep_tokens,query,_)) = Parse_cocci.process file (Some !Config.std_iso) false in xs +> List.iter Pretty_print_cocci.unparse; Format.print_newline(); (* compile ocaml script code *) (match Prepare_ocamlcocci.prepare file xs with - None -> () - | Some ocaml_script_file -> - (* compile file *) - Prepare_ocamlcocci.load_file ocaml_script_file; - (* remove file *) - Prepare_ocamlcocci.clean_file ocaml_script_file; - (* Print the list of registered functions *) - Prepare_ocamlcocci.test ()); + None -> () + | Some ocaml_script_file -> + (* compile file *) + Prepare_ocamlcocci.load_file ocaml_script_file; + (* remove file *) + (if not !Common.save_tmp_files + then Prepare_ocamlcocci.clean_file ocaml_script_file); + (* Print the list of registered functions *) + Prepare_ocamlcocci.test ()); Printf.printf "grep tokens\n"; (match grep_tokens with None -> pr "No query" | Some x -> pr (String.concat " || " x)); match !Flag.scanner with Flag.NoScanner | Flag.Grep -> () - | Flag.Glimpse | Flag.Google _ -> + | Flag.Glimpse | Flag.IdUtils | Flag.Google _ -> + Printf.printf "%s tokens\n" + (if !Flag.scanner = Flag.Glimpse then "glimpse" else "google"); (match query with None -> pr "No query" - | Some x -> pr (String.concat " || " x)) + | Some x -> pr (String.concat "\nor on glimpse failure\n" x))