4 CFLAGS
='-Wno-unused -include testprefix.h -IBlocksRuntime'
10 if ! "$CC" --version >/dev
/null
2>&1; then
11 echo "$CC" not installed
14 if ("$CC" -fblocks -c -o /dev
/null
-x c
- < /dev
/null
2>&1 ||
echo '-fblocks') 2>&1 |
grep -q -- -fblocks; then
15 echo "$CC" does not support the
-fblocks option
19 if "$CXX" --version >/dev
/null
2>&1; then
21 if ("$CXX" -fblocks -c -o /dev
/null
-x c
- < /dev
/null
2>&1 ||
echo '-fblocks') |
grep -q -- -fblocks; then
22 echo "$CXX" does not support the
-fblocks option
26 echo "$CXX" not installed
-- skipping C
++ tests
30 for test in BlocksRuntime
/tests
/*.
[cC
]; do
43 */dispatch_async.c
) skip
=1;;
44 */fail.c
) skipdoze
=1;;
45 */macro.c
) stub
='void foo(); int main(){foo(); printf("success");}'; println
=1;;
47 */voidarg.c
) println
=1;;
48 */varargs-bad-assign.c | \
49 */rettypepromotion.c | \
50 */shorthandexpression.c | \
54 */constassign.c
) xfail
=1;;
59 USEFLAGS
="$CCFLAGS $CFLAGS"
63 *.cpp
) cpp
=1; ext
=.cpp
;;
64 *.
cp) cpp
=1; ext
=.
cp;;
65 *.c
++) cpp
=1; ext
=.c
++;;
67 if [ -n "$cpp" ]; then
70 USELIB
="$LIB -lstdc++"
72 if [ -n "$COMSPEC" -a -n "$skipdoze" ]; then
75 if [ -z "$skip" -a -n "$cpp" -a -z "$dopp" ]; then
76 echo "skipping $test ("$CXX" not installed)"
78 if [ -n "$skip" ]; then
81 if [ -n "$xfail" ]; then
82 echo "--- $(basename $test) ($fmsg) ---"
84 echo "--- $(basename $test) ($pmsg) ---"
86 if [ -n "$stub" ]; then
87 "$USECC" -c $USEFLAGS $extra -o $TESTDIR/$
(basename $test $ext).o
-fblocks $test && \
88 echo "$stub" |
"$USECC" $USEFLAGS $extra -o $TESTDIR/$
(basename $test $ext) -fblocks \
89 $TESTDIR/$
(basename $test $ext).o
$USELIB -x c
- && \
90 $TESTDIR/$
(basename $test $ext)
92 "$USECC" -c $USEFLAGS $extra -o $TESTDIR/$
(basename $test $ext).o
-fblocks $test && \
93 "$USECC" -o $TESTDIR/$
(basename $test $ext) -fblocks $TESTDIR/$
(basename $test $ext).o
$USELIB && \
94 $TESTDIR/$
(basename $test $ext)
97 if [ -n "$println" ]; then
100 if [ $result = 0 -a -n "$xfail" ]; then
104 echo "*** ^FAILURE: expect FAIL test PASSED! ***"
109 failcount
=$
(($failcount + 1))
111 if [ $result != 0 -a -z "$xfail" ]; then
115 echo "*** ^FAILURE: expect PASS test FAILED! ***"
120 failcount
=$
(($failcount + 1))
125 if [ -n "$testsfailed" ]; then
129 echo "*** WARNING: Some failures($failcount) occurred, look for '*** ^FAILURE:' lines above"
135 echo "*** All tests passed ***"