Remove __APPLE_CC__ fiddling and more visible FAILURE lines
[blocksruntime.git] / checktests
blobd8e7cfeead9ea8e06e921571ba3c69d91698d617
1 #!/bin/sh
2 CFLAGS='-Wno-unused -include /usr/include/stdio.h -include /usr/include/sys/wait.h -IBlocksRuntime'
3 LIB=libBlocksRuntime.a
4 TESTDIR=testbin
5 rm -rf $TESTDIR
6 mkdir $TESTDIR
7 if ! clang --version; then
8 echo clang not installed
9 exit 1
11 if clang++ --version > /dev/null 2>&1; then
12 dopp=1
13 else
14 echo clang++ not installed -- skipping C++ tests
16 testsfailed=
17 for test in BlocksRuntime/tests/*.[cC]; do
18 skip=
19 extra=
20 stub=
21 println=
22 xfail=
23 pmsg='should PASS'
24 fmsg='should FAIL'
25 case $test in
26 */rdar6405500.c | \
27 */rdar6414583.c | \
28 */objectRRGC.c | \
29 */dispatch_async.c) skip=1;;
30 */macro.c) stub='void foo(); int main(){foo(); printf("success");}'; println=1;;
31 */cast.c | \
32 */voidarg.c) println=1;;
33 */varargs-bad-assign.c | \
34 */rettypepromotion.c | \
35 */shorthandexpression.c | \
36 */k-and-r.c | \
37 */sizeof.c | \
38 */orbars.c | \
39 */constassign.c) xfail=1;;
40 esac
41 ext=.c
42 cpp=
43 CC=clang
44 case $test in
45 *.C) cpp=1; CC=clang++; ext=.C;;
46 *.cpp) cpp=1; CC=clang++; ext=.cpp;;
47 *.cp) cpp=1; CC=clang++; ext=.cp;;
48 *.c++) cpp=1; CC=clang++; ext=.c++;;
49 esac
50 if [ -z "$skip" -a -n "$cpp" -a -z "$dopp" ]; then
51 echo "skipping $test (clang++ not installed)"
52 else
53 if [ -n "$skip" ]; then
54 echo skipping $test
55 else
56 if [ -n "$xfail" ]; then
57 echo "--- $(basename $test) ($fmsg) ---"
58 else
59 echo "--- $(basename $test) ($pmsg) ---"
61 if [ -n "$stub" ]; then
62 $CC -c $CFLAGS $extra -o $TESTDIR/$(basename $test $ext).o -fblocks $test && \
63 echo "$stub" | $CC $CFLAGS $extra -o $TESTDIR/$(basename $test $ext) -fblocks \
64 $TESTDIR/$(basename $test $ext).o $LIB -x c - && \
65 $TESTDIR/$(basename $test $ext)
66 else
67 $CC -c $CFLAGS $extra -o $TESTDIR/$(basename $test $ext).o -fblocks $test && \
68 $CC -o $TESTDIR/$(basename $test $ext) -fblocks $TESTDIR/$(basename $test $ext).o $LIB && \
69 $TESTDIR/$(basename $test $ext)
71 result=$?
72 if [ -n "$println" ]; then
73 echo ''
75 if [ $result = 0 -a -n "$xfail" ]; then
76 echo ''
77 echo "***"
78 echo "*** ^FAILURE: expect FAIL test PASSED! ***"
79 echo "***"
80 echo ''
81 testsfailed=1
83 if [ $result != 0 -a -z "$xfail" ]; then
84 echo ''
85 echo "***"
86 echo "*** ^FAILURE: expect PASS test FAILED! ***"
87 echo "***"
88 echo ''
89 testsfailed=1
93 done
94 if [ -n "$testsfailed" ]; then
95 echo ''
96 echo "***"
97 echo "*** WARNING: Some failures occurred, look for '*** ^FAILURE:' lines above"
98 echo "***"
99 echo ''
100 exit 1
102 echo "*** All tests passed ***"
103 exit 0