[m-rev.] diff: fix the "failure" of tests/hard_coded/init_excp for C# and Java grades
Julien Fischer
jfischer at opturion.com
Mon Jul 30 17:48:14 AEST 2018
Fix the "failure" of tests/hard_coded/init_excp for C# and Java grades.
tests/hard_coded/Mmakefile:
Filter the output for the above test to remove C# (Mono) and
Java stack traces. Because of the way initialisers are (currently)
implemented for those backends using MERCURY_SUPPRESS_STACK_TRACE
would not work (even if the respective runtimes supported it).
tests/hard_coded/init_excp.exp2:
Expected output for the Java grades.
tests/hard_coded/init_excp.exp3:
Expected output for the C# grades.
Julien.
diff --git a/tests/hard_coded/Mmakefile b/tests/hard_coded/Mmakefile
index 0511ce3..7839faf 100644
--- a/tests/hard_coded/Mmakefile
+++ b/tests/hard_coded/Mmakefile
@@ -910,13 +910,18 @@ final_excp.out: final_excp
fi
# init_excp.out is expected to fail (it calls throw/1).
+# We need to filter the output for the C# and Java backends in order to remove
+# the stack trace in those grades. Because the exception is thrown from
+# an initialiser rather than from main/2 we don't have any control over
+# whether the stack trace is printed or not.
#
init_excp.out: init_excp
if MERCURY_SUPPRESS_STACK_TRACE=yes ./init_excp > $@.tmp 2>&1; then \
grep . $@.tmp; \
exit 1; \
else \
- mv $@.tmp $@; \
+ grep -v "at\ j\?mercury\|System\|\-\-\-" $@.tmp > $@; \
+ rm -f #@.tmp; \
fi
# functor_ho_inst_excp.out is expected to throw an exception or cause
diff --git a/tests/hard_coded/init_excp.exp2 b/tests/hard_coded/init_excp.exp2
index e69de29..36d00e9 100644
--- a/tests/hard_coded/init_excp.exp2
+++ b/tests/hard_coded/init_excp.exp2
@@ -0,0 +1,3 @@
+This is init_pred_a/2
+EXCEPTION
+Exception in thread "main" jmercury.runtime.Exception: magic_number_exception
diff --git a/tests/hard_coded/init_excp.exp3 b/tests/hard_coded/init_excp.exp3
index e69de29..b8ead73 100644
--- a/tests/hard_coded/init_excp.exp3
+++ b/tests/hard_coded/init_excp.exp3
@@ -0,0 +1,4 @@
+This is init_pred_a/2
+EXCEPTION
+
+Unhandled Exception:
More information about the reviews
mailing list