[sledge] Distinguish LLVM assertion violations from general aborts

Reviewed By: jvillard

Differential Revision: D27188310

fbshipit-source-id: d2f616821
master
Josh Berdine 4 years ago committed by Facebook GitHub Bot
parent 6b9b16b077
commit 26014ecd4d

@ -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 () =

@ -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]

@ -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/>/\>/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

Loading…
Cancel
Save