From 26014ecd4d96420c34552027b3f84915b8c042e4 Mon Sep 17 00:00:00 2001 From: Josh Berdine Date: Wed, 24 Mar 2021 14:16:35 -0700 Subject: [PATCH] [sledge] Distinguish LLVM assertion violations from general aborts Reviewed By: jvillard Differential Revision: D27188310 fbshipit-source-id: d2f616821 --- sledge/src/report.ml | 6 ++++-- sledge/src/report.mli | 3 ++- sledge/test/wrap.sh | 22 ++++++++++++++++++++-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/sledge/src/report.ml b/sledge/src/report.ml index f01f8746f..90f0ced9e 100644 --- a/sledge/src/report.ml +++ b/sledge/src/report.ml @@ -70,7 +70,8 @@ type status = | InternalError of string | Timeout | Memout - | Crash of string + | Abort + | Assert of string | UnknownError of string [@@deriving compare, equal, sexp] @@ -89,7 +90,8 @@ let pp_status ppf stat = | InternalError msg -> pf "Internal error: %s" msg | Timeout -> pf "Timeout" | Memout -> pf "Memout" - | Crash msg -> pf "Crash: %s" msg + | Abort -> pf "Abort" + | Assert msg -> pf "Assert: %s" msg | UnknownError msg -> pf "Unknown error: %s" msg let safe_or_unsafe () = diff --git a/sledge/src/report.mli b/sledge/src/report.mli index bf2395156..7a23cc508 100644 --- a/sledge/src/report.mli +++ b/sledge/src/report.mli @@ -27,7 +27,8 @@ type status = | InternalError of string | Timeout | Memout - | Crash of string + | Abort + | Assert of string | UnknownError of string [@@deriving compare, equal, sexp] diff --git a/sledge/test/wrap.sh b/sledge/test/wrap.sh index edc7c4f59..92d11cbb3 100755 --- a/sledge/test/wrap.sh +++ b/sledge/test/wrap.sh @@ -21,6 +21,22 @@ unknown_error () { echo "((name $test)(entry(Status(UnknownError \"$1\"))))" >> $test.sexp } +assert () { + echo "((name $test)(entry(Status(Assert \"$1\"))))" >> $test.sexp +} + +abort () { + if grep -q "Assertion failed" $test.err; + then + assert "$(\ + grep "Assertion failed" $test.err \ + | sed 's//\>/g;s/Assertion failed: (\(.*\)), function.*/\1/' \ + | sed 's/"/\\\"/g' )" + else + echo "((name $test)(entry(Status Abort)))" >> $test.sexp + fi +} + timeout () { echo "((name $test)(entry(Status Timeout)))" >> $test.sexp } @@ -40,11 +56,13 @@ case $status in ( 132 ) unknown_error "illegal instruction" ;; ( 136 ) unknown_error "floating-point exception" ;; ( 139 ) unknown_error "segmentation violation" ;; - ( 127 | 134 ) memout ;; + ( 127 ) memout ;; + ( 134 ) abort ;; ( 137 | 152 ) timeout ;; ( * ) unknown_error "exit $status" ;; esac -(test -f $test.sexp && grep -q "Status" $test.sexp) || unknown_error "exit $status" +(test -f $test.sexp && grep -q "Status" $test.sexp) \ +|| unknown_error "exit $status" exit $status