Skip to content

Commit

Permalink
check for exit statuses greater than 100
Browse files Browse the repository at this point in the history
Since rust-lang/rust#52197, ICEs will fail with exit status 101.
Compilation successes and failures will return 0 and 1, respectively.

Fixes rust-lang#143.
  • Loading branch information
euclio committed Oct 12, 2018
1 parent 4ac3ddb commit 1c9e231
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions test.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
#!/bin/bash

RUSTC=rustc

for f in src/*
do
[[ -f $f ]] || continue;
echo "Testing $f:"
# Compile the code, and if it passes exit with error code
if rustc "$f" > /dev/null 2>&1; then
# Compile the code, and if it exits with a code less than 101, exit with error
# code.
#
# An ICE will cause error code 101. An abort or other signal will cause an
# error code greater than 101.
output=$($RUSTC --color=always "$f" 2>&1)
if (( "$?" < 101 )); then
echo "$output"
exit 1
fi
done

echo "Testing 21335"
rustc - --out-dir=random_directory_that_does_not_exist/ --emit=llvm-ir <<< 'fn main(){}'
$RUSTC - --out-dir=random_directory_that_does_not_exist/ --emit=llvm-ir <<< 'fn main(){}'

echo "Testing 16229"
if bash 16229.sh > /dev/null 2>&1; then
Expand Down

0 comments on commit 1c9e231

Please sign in to comment.