Skip to content

Instantly share code, notes, and snippets.

@ytomino
Last active November 25, 2017 18:19
Show Gist options
  • Save ytomino/8f4762169634cc0b286b928c61e378df to your computer and use it in GitHub Desktop.
Save ytomino/8f4762169634cc0b286b928c61e378df to your computer and use it in GitHub Desktop.
Run drake.testsuite
#!/bin/bash
set -e
FAILURE=0
for I in *.ad[sb] ; do
echo "==== " $I " ===="
case $I in
calendar_inline.adb)
B=${I%.adb}
gcc$GCCSUFFIX -S -O2 -gnatn -gnatwI -o ../bin/$B.s $I --RTS=../bin
set +e
C1=$(grep -c -E $'^\tcall\t_*ada__calendar__packed_split(@PLT)?$' ../bin/$B.s)
C2=$(grep -c -E $'^\tcall\t_*ada__calendar__formatting__packed_split(@PLT)?$' ../bin/$B.s)
set -e
if [[ $C1 -ne 1 || $C2 -ne 1 ]] ; then
echo "!! FAILURE !!"
FAILURE=$(expr $FAILURE + 1)
fi
;;
inline.adb | task_select.adb)
B=${I%.adb}
set +e
gcc$GCCSUFFIX -c -O2 -gnat-a -gnatp -gnatn2 -gnatwI -Winline -Werror -o ../bin/$B.o $I --RTS=../bin
CODE=$?
set -e
if [[ $CODE -ne 0 ]] ; then
echo "!! FAILURE !!"
FAILURE=$(expr $FAILURE + 1)
fi
;;
*.adb)
B=${I%.adb}
gnatmake -c $I --RTS=../bin -D ../bin -cargs -pipe -ggdb -gnatef -gnatf -gnatwIue -gnata -gnat-p
cd ../bin
gnatbind $B --RTS=../bin -E
gnatlink $B --RTS=../bin -ggdb
cd ../testsuite
case $I in
assert.adb)
set +e
timeout 10 ../bin/$B
set -e
;;
command_line_iterate.adb)
timeout 10 ../bin/$B
timeout 10 ../bin/$B 1
timeout 10 ../bin/$B 1 2
;;
exception3.adb)
set +e
timeout 10 ../bin/$B
set -e
;;
interrupts.adb)
timeout --signal=INT --kill-after=7 --preserve-status 3 ../bin/$B
sleep 0.1
;;
multiprocessors.adb)
timeout 10 ../bin/$B
nproc
;;
protected_rw.adb)
timeout 10 ../bin/$B
set +e
C1=$(grep -c -E "\bsystem\.tasks\b" ../bin/b~$B.ads)
set -e
if [[ $C1 -ne 0 ]] ; then
echo "!! FAILURE !!"
FAILURE=$(expr $FAILURE + 1)
fi
;;
text_io_autoflush.adb)
set +e
timeout 10 ../bin/$B | tee $TMPDIR/text_io_autoflush.log
C1=$(grep -c -E "^STDOUT$" $TMPDIR/text_io_autoflush.log)
set -e
if [[ $C1 -ne 1 ]] ; then
echo "!! FAILURE !!"
FAILURE=$(expr $FAILURE + 1)
fi
;;
*)
set +e
timeout 10 ../bin/$B
CODE=$?
if [[ $CODE -eq 124 ]] ; then
sleep 0.1
echo "!! TIMEOUT !!"
FAILURE=$(expr $FAILURE + 1)
elif [[ $CODE -ne 0 ]] ; then
echo "!! FAILURE !!"
FAILURE=$(expr $FAILURE + 1)
fi
set -e
;;
esac
;;
*_instantiation.ads)
B=${I%.ads}
gcc$GCCSUFFIX -S -O2 -gnatn -gnatwI -o ../bin/$B.s $I --RTS=../bin
set +e
C1=$(grep -c -E $'__elab[sb](@PLT)?$' ../bin/$B.s)
C2=$(grep -c -E $'\tcall\t_*__enable_execute_stack(@PLT)?$' ../bin/$B.s)
set -e
if [[ $C1 -ne 0 || $C2 -ne 0 ]] ; then
echo "!! FAILURE !!"
FAILURE=$(expr $FAILURE + 1)
fi
;;
*.ads)
gnatmake -c $I --RTS=../bin -D ../bin -cargs -pipe -ggdb -gnatef -gnatf -gnatwIue -gnata -gnat-p
;;
esac
done
echo "total failure: " $FAILURE
exit $FAILURE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment