diff --git a/ptests/ptests.ml b/ptests/ptests.ml index 4db22c91fe23f353fbf34785921f6e5c8cf6a9f9..64401651909d77b6750644327c810e154d6dce20 100644 --- a/ptests/ptests.ml +++ b/ptests/ptests.ml @@ -1473,6 +1473,19 @@ let worker_thread () = unlock (); done +let diff_check_exist old_file new_file = + if Sys.file_exists old_file then begin + if Sys.file_exists new_file then begin + !do_diffs ^ " " ^ old_file ^ " " ^ new_file + end else begin + "echo \"" ^ new_file ^ " does not exist. Showing " ^ old_file ^ "\";" ^ + " cat " ^ old_file + end + end else begin + "echo \"" ^ old_file ^ " does not exist. Showing " ^ new_file ^ "\";" ^ + " cat " ^ new_file + end + let do_diff = function | Command_error (diff, kind) -> let log_prefix = log_prefix diff in @@ -1487,7 +1500,7 @@ let do_diff = function let oracle_file = Filename.sanitize (oracle_prefix ^ log_ext ^ ".oracle") in - let diff_string = !do_diffs ^ " " ^ oracle_file ^ " " ^ log_file in + let diff_string = diff_check_exist oracle_file log_file in ignore (launch diff_string) | Target_error execnow -> lock_printf "Custom command failed: %s@\n" execnow.ex_cmd; @@ -1515,9 +1528,7 @@ let do_diff = function let oracle_file = Filename.sanitize (SubDir.make_oracle_file dir file) in - let diff_string = - !do_diffs ^ " " ^ oracle_file ^ " " ^ result_file - in + let diff_string = diff_check_exist oracle_file result_file in ignore (launch diff_string)