src/HOL/Tools/Quickcheck/narrowing_generators.ML
changeset 73285 0e7a3c055f39
parent 73284 a97ae083cad1
child 74142 0f051404f487
equal deleted inserted replaced
73284:a97ae083cad1 73285:0e7a3c055f39
   261               (map File.bash_platform_path
   261               (map File.bash_platform_path
   262                 (map fst includes @ [code_file, narrowing_engine_file, main_file]))) ^
   262                 (map fst includes @ [code_file, narrowing_engine_file, main_file]))) ^
   263           " -o " ^ File.bash_platform_path executable ^ ";"
   263           " -o " ^ File.bash_platform_path executable ^ ";"
   264         val compilation_time =
   264         val compilation_time =
   265           Isabelle_System.bash_process cmd
   265           Isabelle_System.bash_process cmd
   266           |> Process_Result.print
   266           |> Process_Result.check
   267           |> Process_Result.timing_elapsed |> Time.toMilliseconds;
   267           |> Process_Result.timing_elapsed |> Time.toMilliseconds
       
   268           handle ERROR msg => cat_error "Compilation with GHC failed" msg
   268         val _ = Quickcheck.add_timing ("Haskell compilation", compilation_time) current_result
   269         val _ = Quickcheck.add_timing ("Haskell compilation", compilation_time) current_result
   269         fun haskell_string_of_bool v = if v then "True" else "False"
   270         fun haskell_string_of_bool v = if v then "True" else "False"
   270         val _ = if Isabelle_System.bash cmd <> 0 then error "Compilation with GHC failed" else ()
       
   271         fun with_size genuine_only k =
   271         fun with_size genuine_only k =
   272           if k > size then (NONE, !current_result)
   272           if k > size then (NONE, !current_result)
   273           else
   273           else
   274             let
   274             let
   275               val _ = verbose_message ("[Quickcheck-narrowing] Test data size: " ^ string_of_int k)
   275               val _ = verbose_message ("[Quickcheck-narrowing] Test data size: " ^ string_of_int k)
   276               val _ = current_size := k
   276               val _ = current_size := k
   277               val res =
   277               val res =
   278                 Isabelle_System.bash_process
   278                 Isabelle_System.bash_process
   279                   (File.bash_path executable ^ " " ^ haskell_string_of_bool genuine_only ^ " " ^
   279                   (File.bash_path executable ^ " " ^ haskell_string_of_bool genuine_only ^ " " ^
   280                     string_of_int k);
   280                     string_of_int k)
   281               val _ = warning (Process_Result.err res);
   281                 |> Process_Result.check
   282               val response = Process_Result.out res;
   282               val response = Process_Result.out res
   283               val timing = res |> Process_Result.timing_elapsed |> Time.toMilliseconds;
   283               val timing = res |> Process_Result.timing_elapsed |> Time.toMilliseconds;
   284               val _ =
   284               val _ =
   285                 Quickcheck.add_timing
   285                 Quickcheck.add_timing
   286                   ("execution of size " ^ string_of_int k, timing) current_result
   286                   ("execution of size " ^ string_of_int k, timing) current_result
   287             in
   287             in