From: Stephane Glondu <steph@glondu.net>
Date: Thu, 25 Aug 2011 09:14:40 +0200
Subject: Add possibility to disable execinfo test through environment

It fails on armel because of [1] and on powerpc because of [2].

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=637360
[2] http://caml.inria.fr/mantis/view.php?id=5334

upstream provides an option --disable-execinfo, but this is not really
useful, it is only accepted by src/discover.ml, which runs as
PostConfCommand.

Bug: https://forge.ocamlcore.org/tracker/index.php?func=detail&aid=1288&group_id=175&atid=782
Signed-off-by: Stephane Glondu <steph@glondu.net>
---
 test/test.ml | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/test/test.ml b/test/test.ml
index 393eae6..0bb69e2 100644
--- a/test/test.ml
+++ b/test/test.ml
@@ -613,7 +613,7 @@ let () =
   let wrap test =
     with_unix_error (fun () -> test (); Gc.compact ())
   in
-  let tests = ("tests" >::: [
+  let tests = ("tests" >::: ([
     "eventfd" >:: test_eventfd;
     "uname" >:: test_uname;
     "fadvise" >:: test_fadvise;
@@ -624,7 +624,10 @@ let () =
     "resource" >::: test_resource;
     "strtime" >:: test_strtime;
     "pts" >:: test_pts;
-    "execinfo" >:: test_execinfo;
+  ] @ (
+    try let _ = Sys.getenv "DISABLE_EXECINFO" in []
+    with Not_found -> ["execinfo" >:: test_execinfo]
+  ) @ [
     "statvfs" >:: test_statvfs;
     "setenv" >:: test_setenv;
     "mkdtemp" >:: test_mkdtemp;
@@ -645,5 +648,5 @@ let () =
     "sysinfo" >:: test_sysinfo;
     "splice" >:: test_splice;
     "wait4" >:: test_wait4;
-]) in
+])) in
   ignore (run_test_tt_main (test_decorate wrap tests))
