tools/llvm: Do not build with symbols
[minix3.git] / external / bsd / libc++ / dist / libcxx / test / testit
blob18b0814536048b9239cc6bf4d23c7b2d78325faa
1 #!/bin/sh
2 # //===--------------------------- testit ---------------------------------===//
3 # //
4 # // The LLVM Compiler Infrastructure
5 # //
6 # // This file is distributed under the University of Illinois Open Source
7 # // License. See LICENSE.TXT for details.
8 # //
9 # //===--------------------------------------------------------------------===//
11 currentpath=`pwd`
12 origpath=$currentpath
13 currentdir=`basename $currentpath`
14 while [ $currentdir != "test" ]; do
15 if [ $currentdir = "/" ]
16 then
17 echo "current directory must be in or under \"test\"."
18 exit 1
20 cd ..
21 currentpath=`pwd`
22 currentdir=`basename $currentpath`
23 done
25 cd ..
26 LIBCXX_ROOT=`pwd`
27 cd $origpath
29 if [ -z "$CC" ]
30 then
31 if which xcrun >/dev/null
32 then
33 CC="xcrun clang++"
34 else
35 CC=clang++
39 if [ -z "$OPTIONS" ]
40 then
41 OPTIONS="-std=c++11 -stdlib=libc++"
43 OPTIONS="$OPTIONS -I$LIBCXX_ROOT/test/support"
45 if [ -z "$HEADER_INCLUDE" ]
46 then
47 HEADER_INCLUDE="-I$LIBCXX_ROOT/include"
50 if [ -z "$SOURCE_LIB" ]
51 then
52 SOURCE_LIB="-L$LIBCXX_ROOT/lib"
55 case $TRIPLE in
56 *-*-mingw* | *-*-cygwin* | *-*-win*)
57 TEST_EXE=test.exe
60 TEST_EXE=a.out
62 esac
64 case $(uname -s) in
65 NetBSD)
66 THREAD_FLAGS=-lpthread
68 esac
70 FAIL=0
71 PASS=0
72 UNIMPLEMENTED=0
73 IMPLEMENTED_FAIL=0
74 IMPLEMENTED_PASS=0
76 afunc() {
77 fail=0
78 pass=0
79 if (ls *.fail.cpp > /dev/null 2>&1)
80 then
81 for FILE in $(ls *.fail.cpp); do
82 if $CC $OPTIONS $HEADER_INCLUDE $SOURCE_LIB $FILE $LIBS -o ./$TEST_EXE > /dev/null 2>&1
83 then
84 rm ./$TEST_EXE
85 echo "$FILE should not compile"
86 fail=$(($fail+1))
87 else
88 pass=$(($pass+1))
90 done
93 if (ls *.pass.cpp > /dev/null 2>&1)
94 then
95 for FILE in $(ls *.pass.cpp); do
96 if [ "$VERBOSE" ]
97 then
98 echo "Running test: " $FILE
100 if $CC $OPTIONS $HEADER_INCLUDE $SOURCE_LIB $FILE $LIBS $(test $1 = no || echo $THREAD_FLAGS) -o ./$TEST_EXE
101 then
102 if ./$TEST_EXE
103 then
104 rm ./$TEST_EXE
105 pass=$(($pass+1))
106 else
107 echo "`pwd`/$FILE failed at run time"
108 echo "Compile line was:" $CC $OPTIONS $HEADER_INCLUDE $SOURCE_LIB $FILE $LIBS $(test $1 = no || echo $THREAD_FLAGS)
109 fail=$(($fail+1))
110 rm ./$TEST_EXE
112 else
113 echo "`pwd`/$FILE failed to compile"
114 echo "Compile line was:" $CC $OPTIONS $HEADER_INCLUDE $SOURCE_LIB $FILE $LIBS $(test $1 = no || echo $THREAD_FLAGS)
115 fail=$(($fail+1))
117 done
120 if [ $fail -gt 0 ]
121 then
122 echo "failed $fail tests in `pwd`"
123 IMPLEMENTED_FAIL=$(($IMPLEMENTED_FAIL+1))
125 if [ $pass -gt 0 ]
126 then
127 echo "passed $pass tests in `pwd`"
128 if [ $fail -eq 0 ]
129 then
130 IMPLEMENTED_PASS=$((IMPLEMENTED_PASS+1))
133 if [ $fail -eq 0 -a $pass -eq 0 ]
134 then
135 echo "not implemented: `pwd`"
136 UNIMPLEMENTED=$(($UNIMPLEMENTED+1))
139 FAIL=$(($FAIL+$fail))
140 PASS=$(($PASS+$pass))
142 for FILE in *
144 if [ -d "$FILE" ];
145 then
146 cd $FILE
147 if [ $FILE = thread -o $1 = yes ]; then
148 afunc yes
149 else
150 afunc no
152 cd ..
154 done
157 afunc no
159 echo "****************************************************"
160 echo "Results for `pwd`:"
161 echo "using `$CC --version`"
162 echo "with $OPTIONS $HEADER_INCLUDE $SOURCE_LIB"
163 echo "----------------------------------------------------"
164 echo "sections without tests : $UNIMPLEMENTED"
165 echo "sections with failures : $IMPLEMENTED_FAIL"
166 echo "sections without failures: $IMPLEMENTED_PASS"
167 echo " + ----"
168 echo "total number of sections : $(($UNIMPLEMENTED+$IMPLEMENTED_FAIL+$IMPLEMENTED_PASS))"
169 echo "----------------------------------------------------"
170 echo "number of tests failed : $FAIL"
171 echo "number of tests passed : $PASS"
172 echo " + ----"
173 echo "total number of tests : $(($FAIL+$PASS))"
174 echo "****************************************************"
176 exit $FAIL