From 08da2c1e69895f1fac6a9a95f4e1e04b6665b08e Mon Sep 17 00:00:00 2001
From: Virgile Prevosto <virgile.prevosto@m4x.org>
Date: Fri, 12 Jun 2020 16:43:16 +0200
Subject: [PATCH] [ptests] explicit error message in case of timeout

---
 ptests/ptests.ml | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/ptests/ptests.ml b/ptests/ptests.ml
index 2483e59e8fd..f402cb79bd2 100644
--- a/ptests/ptests.ml
+++ b/ptests/ptests.ml
@@ -1110,6 +1110,16 @@ let command_string command =
   in
   let res = Filename.sanitize (log_prefix ^ ".res.log") in
   let command_string = command_string ^ " >" ^ res in
+  let command_string =
+    match command.timeout with
+      | "" -> command_string
+      | s ->
+          Printf.sprintf
+            "%s; if test $? -eq 124; then \
+               echo 'TIMEOUT (%s); ABORTING EXECUTION' > %s; \
+             fi"
+            command_string s (Filename.sanitize stderr)
+  in
   let command_string = match filter with
     | None -> command_string
     | Some filter ->
-- 
GitLab