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
28 if [ ! -r "$LIB" ]; then
29 echo "No $LIB file found, try running $(dirname "$0")/buildlib first"
34 for test in BlocksRuntime
/tests
/*.
[cC
]; do
47 */dispatch_async.c
) skip
=1;;
48 */fail.c
) skipdoze
=1;;
49 */macro.c
) stub
='void foo(); int main(){foo(); printf("success");}'; println
=1;;
51 */voidarg.c
) println
=1;;
52 */varargs-bad-assign.c | \
53 */rettypepromotion.c | \
54 */shorthandexpression.c | \
58 */constassign.c
) xfail
=1;;
63 USEFLAGS
="$CCFLAGS $CFLAGS"
67 *.cpp
) cpp
=1; ext
=.cpp
;;
68 *.
cp) cpp
=1; ext
=.
cp;;
69 *.c
++) cpp
=1; ext
=.c
++;;
71 if [ -n "$cpp" ]; then
74 USELIB
="$LIB -lstdc++"
76 if [ -n "$COMSPEC" -a -n "$skipdoze" ]; then
79 if [ -z "$skip" -a -n "$cpp" -a -z "$dopp" ]; then
80 echo "skipping $test ("$CXX" not installed)"
82 if [ -n "$skip" ]; then
85 if [ -n "$xfail" ]; then
86 echo "--- $(basename $test) ($fmsg) ---"
88 echo "--- $(basename $test) ($pmsg) ---"
90 if [ -n "$stub" ]; then
91 "$USECC" -c $USEFLAGS $extra -o $TESTDIR/$
(basename $test $ext).o
-fblocks $test && \
92 echo "$stub" |
"$USECC" $USEFLAGS $extra -o $TESTDIR/$
(basename $test $ext) -fblocks \
93 $TESTDIR/$
(basename $test $ext).o
$USELIB -x c
- && \
94 $TESTDIR/$
(basename $test $ext)
96 "$USECC" -c $USEFLAGS $extra -o $TESTDIR/$
(basename $test $ext).o
-fblocks $test && \
97 "$USECC" -o $TESTDIR/$
(basename $test $ext) -fblocks $TESTDIR/$
(basename $test $ext).o
$USELIB && \
98 $TESTDIR/$
(basename $test $ext)
101 if [ -n "$println" ]; then
104 if [ $result = 0 -a -n "$xfail" ]; then
108 echo "*** ^FAILURE: expect FAIL test PASSED! ***"
113 failcount
=$
(($failcount + 1))
115 if [ $result != 0 -a -z "$xfail" ]; then
119 echo "*** ^FAILURE: expect PASS test FAILED! ***"
124 failcount
=$
(($failcount + 1))
129 if [ -n "$testsfailed" ]; then
133 echo "*** WARNING: Some failures($failcount) occurred, look for '*** ^FAILURE:' lines above"
139 echo "*** All tests passed ***"