5 CPPFLAGS
='-Wno-unused -include testprefix.h -IBlocksRuntime'
11 if ! "$CC" --version >/dev
/null
2>&1; then
12 echo "$CC" not installed
15 if ("$CC" -fblocks -c -o /dev
/null
-x c
- < /dev
/null
2>&1 ||
echo '-fblocks') 2>&1 |
grep -q -- -fblocks; then
16 echo "$CC" does not support the
-fblocks option
20 if "$CXX" --version >/dev
/null
2>&1; then
22 if ("$CXX" -fblocks -c -o /dev
/null
-x c
- < /dev
/null
2>&1 ||
echo '-fblocks') |
grep -q -- -fblocks; then
23 echo "$CXX" does not support the
-fblocks option
27 echo "$CXX" not installed
-- skipping C
++ tests
29 if [ ! -r "$LIB" ]; then
30 echo "No $LIB file found, try running $(dirname "$0")/buildlib first"
35 for test in BlocksRuntime
/tests
/*.
[cC
]; do
48 */dispatch_async.c
) skip
=1;;
49 */fail.c
) skipdoze
=1;;
50 */macro.c
) stub
='void foo(); int main(){foo(); printf("success");}'; println
=1;;
52 */voidarg.c
) println
=1;;
53 */varargs-bad-assign.c | \
54 */rettypepromotion.c | \
55 */shorthandexpression.c | \
59 */constassign.c
) xfail
=1;;
64 USEFLAGS
="$CCFLAGS $CPPFLAGS"
68 *.cpp
) cpp
=1; ext
=.cpp
;;
69 *.
cp) cpp
=1; ext
=.
cp;;
70 *.c
++) cpp
=1; ext
=.c
++;;
72 if [ -n "$cpp" ]; then
75 USELIB
="$LIB -lstdc++"
77 if [ -n "$COMSPEC" -a -n "$skipdoze" ]; then
80 if [ -z "$skip" -a -n "$cpp" -a -z "$dopp" ]; then
81 echo "skipping $test ("$CXX" not installed)"
83 if [ -n "$skip" ]; then
86 if [ -n "$xfail" ]; then
87 echo "--- $(basename $test) ($fmsg) ---"
89 echo "--- $(basename $test) ($pmsg) ---"
91 if [ -n "$stub" ]; then
92 "$USECC" -c $CFLAGS $USEFLAGS $extra -o $TESTDIR/$
(basename $test $ext).o
-fblocks $test && \
93 echo "$stub" |
"$USECC" $CFLAGS $USEFLAGS $extra -o $TESTDIR/$
(basename $test $ext) -fblocks \
94 $TESTDIR/$
(basename $test $ext).o
$USELIB -x c
- && \
95 $TESTDIR/$
(basename $test $ext)
97 "$USECC" -c $CFLAGS $USEFLAGS $extra -o $TESTDIR/$
(basename $test $ext).o
-fblocks $test && \
98 "$USECC" $CFLAGS -o $TESTDIR/$
(basename $test $ext) -fblocks $TESTDIR/$
(basename $test $ext).o
$USELIB && \
99 $TESTDIR/$
(basename $test $ext)
102 if [ -n "$println" ]; then
105 if [ $result = 0 -a -n "$xfail" ]; then
109 echo "*** ^FAILURE: expect FAIL test PASSED! ***"
114 failcount
=$
(($failcount + 1))
116 if [ $result != 0 -a -z "$xfail" ]; then
120 echo "*** ^FAILURE: expect PASS test FAILED! ***"
125 failcount
=$
(($failcount + 1))
130 if [ -n "$testsfailed" ]; then
134 echo "*** WARNING: Some failures($failcount) occurred, look for '*** ^FAILURE:' lines above"
140 echo "*** All tests passed ***"