From 109a404e78600528058ccb21ba2b62b43ab6562c Mon Sep 17 00:00:00 2001 From: Guillaume Bury Date: Mon, 6 Nov 2023 15:33:14 +0100 Subject: [PATCH] Fix tests/backtrace/backtrace_bounds_exn Fix the test by applying the existing backtrace normalizing script before comparing the backtrace to the reference (and update the reference). See the comment in the sanitize-backtrace.sh script for more info. --- ocaml/testsuite/tests/backtrace/backtrace_bounds_exn.ml | 6 ------ .../tests/backtrace/backtrace_bounds_exn.reference | 2 +- ocaml/testsuite/tests/backtrace/backtrace_bounds_exn.run | 3 +++ 3 files changed, 4 insertions(+), 7 deletions(-) create mode 100755 ocaml/testsuite/tests/backtrace/backtrace_bounds_exn.run diff --git a/ocaml/testsuite/tests/backtrace/backtrace_bounds_exn.ml b/ocaml/testsuite/tests/backtrace/backtrace_bounds_exn.ml index f006d824514..5eb0975388b 100644 --- a/ocaml/testsuite/tests/backtrace/backtrace_bounds_exn.ml +++ b/ocaml/testsuite/tests/backtrace/backtrace_bounds_exn.ml @@ -1,14 +1,8 @@ (* TEST - * setup-ocamlc.byte-build-env - ** ocamlc.byte flags = "-g" ocamlrunparam += ",b=1" *) -(* CR mshinwell: re-enable for native once Flambda 2 fixed to say - "Raised by primitive operation" in backtraces rather than just - "Raised" for bounds check failures *) - (* #11436: bad backtrace for out-of-bounds exception *) let xs = [| 0; 1; 2 |] diff --git a/ocaml/testsuite/tests/backtrace/backtrace_bounds_exn.reference b/ocaml/testsuite/tests/backtrace/backtrace_bounds_exn.reference index 1705e3f8279..e082c43df40 100644 --- a/ocaml/testsuite/tests/backtrace/backtrace_bounds_exn.reference +++ b/ocaml/testsuite/tests/backtrace/backtrace_bounds_exn.reference @@ -1,4 +1,4 @@ Uncaught exception Invalid_argument("index out of bounds") -Raised by primitive operation at Backtrace_bounds_exn.bad_bound_fn in file "backtrace_bounds_exn.ml", line 11, characters 7-15 +Raised at Backtrace_bounds_exn.bad_bound_fn in file "backtrace_bounds_exn.ml", line 11, characters 7-15 Called from Backtrace_bounds_exn in file "backtrace_bounds_exn.ml", line 15, characters 32-54 OK diff --git a/ocaml/testsuite/tests/backtrace/backtrace_bounds_exn.run b/ocaml/testsuite/tests/backtrace/backtrace_bounds_exn.run new file mode 100755 index 00000000000..ecfe43c9739 --- /dev/null +++ b/ocaml/testsuite/tests/backtrace/backtrace_bounds_exn.run @@ -0,0 +1,3 @@ +#!/bin/sh +(${program} 2>&1 || true) 2>&1 | \ + ${test_source_directory}/sanitize-backtrace.sh > ${output}