2024-08-30 17:56:27 +03:00
|
|
|
|
2024-08-31 12:02:03 +03:00
|
|
|
let count = 10000
|
|
|
|
|
let () =
|
|
|
|
|
Out_channel.with_open_text "dune" (fun dunech ->
|
2024-09-05 14:52:02 +03:00
|
|
|
let dprintfn fmt = Format.kasprintf (Printf.fprintf dunech "%s\n") fmt in
|
|
|
|
|
dprintfn "(cram (deps ../../src/Driver.exe ../../runtime/Std.i))\n";
|
2024-08-31 12:02:03 +03:00
|
|
|
for i=0 to count / 10 do
|
|
|
|
|
let cram_buf = Buffer.create 100 in
|
2024-09-05 14:52:02 +03:00
|
|
|
let cram_printfn fmt = Format.kasprintf (Printf.bprintf cram_buf "%s\n") fmt in
|
2024-08-31 12:02:03 +03:00
|
|
|
let cram_file = Printf.sprintf "r%04dx.t" i in
|
|
|
|
|
let deps = ref [] in
|
|
|
|
|
for j=0 to 9 do
|
|
|
|
|
let k = (i*10+j) in
|
|
|
|
|
let lama_file = Printf.sprintf "generated%05d.lama" k in
|
2024-08-30 17:56:27 +03:00
|
|
|
|
2024-08-31 12:02:03 +03:00
|
|
|
if Sys.file_exists lama_file then
|
|
|
|
|
let test =
|
|
|
|
|
In_channel.with_open_text (Printf.sprintf "generated%05d.input" k) In_channel.input_all
|
|
|
|
|
|> String.split_on_char '\n' |> List.filter ((<>)"")
|
|
|
|
|
in
|
|
|
|
|
(
|
|
|
|
|
deps := lama_file :: !deps;
|
2024-09-05 14:52:02 +03:00
|
|
|
cram_printfn " $ cat > test.input <<EOF";
|
|
|
|
|
List.iter (cram_printfn " > %s") test;
|
|
|
|
|
cram_printfn " > EOF";
|
|
|
|
|
cram_printfn " $ LAMA=../../runtime ../../src/Driver.exe -i generated%05d.lama < test.input" k
|
2024-08-31 12:02:03 +03:00
|
|
|
)
|
|
|
|
|
done;
|
|
|
|
|
match !deps with
|
|
|
|
|
| [] -> ()
|
|
|
|
|
| xs ->
|
|
|
|
|
(Printf.fprintf dunech "(cram (applies_to r%04dx)\n" i;
|
|
|
|
|
Printf.fprintf dunech " (deps %s))\n%!" (String.concat " " xs);
|
|
|
|
|
Out_channel.with_open_text cram_file (fun ch ->
|
|
|
|
|
output_string ch (Buffer.contents cram_buf)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
done
|
|
|
|
|
)
|
|
|
|
|
(*
|
2024-08-30 17:56:27 +03:00
|
|
|
let () =
|
|
|
|
|
|
2024-08-31 12:02:03 +03:00
|
|
|
for i=0 to count do
|
|
|
|
|
if Sys.file_exists (Printf.sprintf "generated%05d.lama" i) then
|
|
|
|
|
(Printf.fprintf ch "(cram (applies_to r%05d)\n" i;
|
|
|
|
|
Printf.fprintf ch " (deps generated%05d.lama))\n%!" i;)
|
|
|
|
|
done *)
|