2010-05-11 21:42:16 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# //===--------------------------- testit ---------------------------------===//
|
|
|
|
# //
|
2010-05-11 23:36:01 +02:00
|
|
|
# // The LLVM Compiler Infrastructure
|
2010-05-11 21:42:16 +02:00
|
|
|
# //
|
|
|
|
# // This file is distributed under the University of Illinois Open Source
|
|
|
|
# // License. See LICENSE.TXT for details.
|
|
|
|
# //
|
|
|
|
# //===--------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
BACKUP="../"
|
|
|
|
|
|
|
|
currentpath=`pwd`
|
|
|
|
origpath=$currentpath
|
|
|
|
currentdir=`basename $currentpath`
|
|
|
|
while [ $currentdir != "test" ]; do
|
|
|
|
if [ $currentdir == "/" ]
|
|
|
|
then
|
|
|
|
echo "current directory must be in or under \"test\"."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
cd ..
|
|
|
|
currentpath=`pwd`
|
|
|
|
currentdir=`basename $currentpath`
|
|
|
|
BACKUP="../"$BACKUP
|
|
|
|
done
|
|
|
|
cd $origpath
|
|
|
|
|
|
|
|
if [ -z $CC ]
|
|
|
|
then
|
|
|
|
CC=g++
|
|
|
|
fi
|
|
|
|
|
|
|
|
auto_header=0
|
|
|
|
|
|
|
|
if [ -z $HEADER_INCLUDE ]
|
|
|
|
then
|
|
|
|
HEADER_INCLUDE=$BACKUP"include"
|
|
|
|
let "auto_header+=1"
|
|
|
|
fi
|
|
|
|
|
|
|
|
auto_lib=0
|
|
|
|
|
|
|
|
SOURCE_LIB=/usr/lib/libc++.dylib
|
|
|
|
#SOURCE_LIB=/Users/hinnant/Development/libcpp/lib/libc++.a
|
|
|
|
|
|
|
|
if [ -z $SOURCE_LIB ]
|
|
|
|
then
|
|
|
|
SOURCE_LIB=$BACKUP"lib/libc++.dylib"
|
|
|
|
let "auto_lib+=1"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$OPTIONS" ]
|
|
|
|
then
|
2010-08-22 03:04:38 +02:00
|
|
|
OPTIONS="-nostdinc++ -nodefaultlibs /usr/lib/libSystem.B.dylib -arch `arch`"
|
2010-05-11 21:42:16 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
FAIL=0
|
|
|
|
PASS=0
|
|
|
|
UNIMPLEMENTED=0
|
|
|
|
IMPLEMENTED_FAIL=0
|
|
|
|
IMPLEMENTED_PASS=0
|
|
|
|
|
|
|
|
function afunc
|
|
|
|
{
|
|
|
|
fail=0
|
|
|
|
pass=0
|
|
|
|
if (ls *.fail.cpp &> /dev/null)
|
|
|
|
then
|
|
|
|
for FILE in $(ls *.fail.cpp); do
|
|
|
|
if $CC $OPTIONS -I$HEADER_INCLUDE $SOURCE_LIB $FILE &> /dev/null
|
|
|
|
then
|
|
|
|
rm ./a.out
|
|
|
|
echo "$FILE should not compile"
|
|
|
|
let "fail+=1"
|
|
|
|
else
|
|
|
|
let "pass+=1"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
2010-08-22 03:04:38 +02:00
|
|
|
|
2010-05-11 21:42:16 +02:00
|
|
|
if (ls *.pass.cpp &> /dev/null)
|
|
|
|
then
|
|
|
|
for FILE in $(ls *.pass.cpp); do
|
|
|
|
if $CC $OPTIONS -I$HEADER_INCLUDE $SOURCE_LIB $FILE
|
|
|
|
then
|
|
|
|
if ./a.out
|
|
|
|
then
|
|
|
|
rm ./a.out
|
|
|
|
let "pass+=1"
|
|
|
|
else
|
|
|
|
echo "$FILE failed at run time"
|
|
|
|
let "fail+=1"
|
|
|
|
rm ./a.out
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "$FILE failed to compile"
|
|
|
|
let "fail+=1"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $fail -gt 0 ]
|
|
|
|
then
|
|
|
|
echo "failed $fail tests in `pwd`"
|
|
|
|
let "IMPLEMENTED_FAIL+=1"
|
|
|
|
fi
|
|
|
|
if [ $pass -gt 0 ]
|
|
|
|
then
|
|
|
|
echo "passed $pass tests in `pwd`"
|
|
|
|
if [ $fail -eq 0 ]
|
|
|
|
then
|
|
|
|
let "IMPLEMENTED_PASS+=1"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ $fail -eq 0 -a $pass -eq 0 ]
|
|
|
|
then
|
|
|
|
echo "not implemented: `pwd`"
|
|
|
|
let "UNIMPLEMENTED+=1"
|
|
|
|
fi
|
|
|
|
|
|
|
|
let "FAIL+=$fail"
|
|
|
|
let "PASS+=$pass"
|
|
|
|
|
|
|
|
for FILE in *
|
|
|
|
do
|
|
|
|
if [ -d "$FILE" ];
|
|
|
|
then
|
|
|
|
cd $FILE
|
|
|
|
if [ $auto_header -eq 1 ]
|
|
|
|
then
|
|
|
|
SAVE_HEADER_INCLUDE=$HEADER_INCLUDE
|
|
|
|
HEADER_INCLUDE="../"$HEADER_INCLUDE
|
|
|
|
fi
|
|
|
|
if [ $auto_lib -eq 1 ]
|
|
|
|
then
|
|
|
|
SAVE_SOURCE_LIB=$SOURCE_LIB
|
|
|
|
SOURCE_LIB="../"$SOURCE_LIB
|
|
|
|
fi
|
|
|
|
|
|
|
|
afunc
|
|
|
|
|
|
|
|
if [ $auto_header -eq 1 ]
|
|
|
|
then
|
|
|
|
HEADER_INCLUDE=${HEADER_INCLUDE:3}
|
|
|
|
fi
|
|
|
|
if [ $auto_lib -eq 1 ]
|
|
|
|
then
|
|
|
|
SOURCE_LIB=${SOURCE_LIB:3}
|
|
|
|
fi
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
afunc
|
|
|
|
|
|
|
|
echo "****************************************************"
|
|
|
|
echo "Results for `pwd`:"
|
|
|
|
echo "using `$CC --version`"
|
|
|
|
echo "with $OPTIONS -I$HEADER_INCLUDE $SOURCE_LIB"
|
|
|
|
echo "----------------------------------------------------"
|
|
|
|
echo "sections without tests : $UNIMPLEMENTED"
|
|
|
|
echo "sections with failures : $IMPLEMENTED_FAIL"
|
|
|
|
echo "sections without failures: $IMPLEMENTED_PASS"
|
|
|
|
echo " + ----"
|
|
|
|
echo "total number of sections : $(($UNIMPLEMENTED+$IMPLEMENTED_FAIL+$IMPLEMENTED_PASS))"
|
|
|
|
echo "----------------------------------------------------"
|
|
|
|
echo "number of tests failed : $FAIL"
|
|
|
|
echo "number of tests passed : $PASS"
|
|
|
|
echo " + ----"
|
|
|
|
echo "total number of tests : $(($FAIL+$PASS))"
|
|
|
|
echo "****************************************************"
|
|
|
|
|
|
|
|
exit $FAIL
|