2014-05-03 20:09:55 +08:00
|
|
|
#!/bin/sh
|
2012-02-01 04:10:33 +08:00
|
|
|
# //===--------------------------- testit ---------------------------------===//
|
|
|
|
# //
|
|
|
|
# // The LLVM Compiler Infrastructure
|
|
|
|
# //
|
|
|
|
# // This file is distributed under the University of Illinois Open Source
|
|
|
|
# // License. See LICENSE.TXT for details.
|
|
|
|
# //
|
|
|
|
# //===--------------------------------------------------------------------===//
|
|
|
|
|
2014-05-03 20:09:55 +08:00
|
|
|
if [ -z "$CC" ]
|
2012-02-01 04:10:33 +08:00
|
|
|
then
|
|
|
|
CC=clang++
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$OPTIONS" ]
|
|
|
|
then
|
|
|
|
OPTIONS="-std=c++0x -stdlib=libc++"
|
|
|
|
fi
|
|
|
|
|
|
|
|
case $TRIPLE in
|
|
|
|
*-*-mingw* | *-*-cygwin* | *-*-win*)
|
|
|
|
TEST_EXE=test.exe
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
TEST_EXE=a.out
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
FAIL=0
|
|
|
|
PASS=0
|
|
|
|
UNIMPLEMENTED=0
|
|
|
|
IMPLEMENTED_FAIL=0
|
|
|
|
IMPLEMENTED_PASS=0
|
|
|
|
|
2014-05-03 20:09:55 +08:00
|
|
|
afunc()
|
2012-02-01 04:10:33 +08:00
|
|
|
{
|
|
|
|
fail=0
|
|
|
|
pass=0
|
2014-05-03 20:09:55 +08:00
|
|
|
if (ls *.fail.cpp > /dev/null 2>&1)
|
2012-02-01 04:10:33 +08:00
|
|
|
then
|
|
|
|
for FILE in $(ls *.fail.cpp); do
|
2014-05-03 20:09:55 +08:00
|
|
|
if $CC $OPTIONS $HEADER_INCLUDE $SOURCE_LIB $FILE $LIBS -o ./$TEST_EXE > /dev/null 2>&1
|
2012-02-01 04:10:33 +08:00
|
|
|
then
|
|
|
|
rm ./$TEST_EXE
|
|
|
|
echo "$FILE should not compile"
|
2014-05-03 20:09:55 +08:00
|
|
|
fail=$(($fail + 1))
|
2012-02-01 04:10:33 +08:00
|
|
|
else
|
2014-05-03 20:09:55 +08:00
|
|
|
pass=$(($pass + 1))
|
2012-02-01 04:10:33 +08:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2014-05-03 20:09:55 +08:00
|
|
|
if (ls *.cpp > /dev/null 2>&1)
|
2012-02-01 04:10:33 +08:00
|
|
|
then
|
2015-01-22 03:05:37 +08:00
|
|
|
for FILE in $(ls *.pass.cpp); do
|
2012-02-01 04:10:33 +08:00
|
|
|
if $CC $OPTIONS $HEADER_INCLUDE $SOURCE_LIB $FILE $LIBS -o ./$TEST_EXE
|
|
|
|
then
|
|
|
|
if ./$TEST_EXE
|
|
|
|
then
|
|
|
|
rm ./$TEST_EXE
|
2014-05-03 20:09:55 +08:00
|
|
|
pass=$(($pass + 1))
|
2012-02-01 04:10:33 +08:00
|
|
|
else
|
|
|
|
echo "$FILE failed at run time"
|
2014-05-03 20:09:55 +08:00
|
|
|
fail=$(($fail + 1))
|
2012-02-01 04:10:33 +08:00
|
|
|
rm ./$TEST_EXE
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "$FILE failed to compile"
|
2014-05-03 20:09:55 +08:00
|
|
|
fail=$(($fail + 1))
|
2012-02-01 04:10:33 +08:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $fail -gt 0 ]
|
|
|
|
then
|
|
|
|
echo "failed $fail tests in `pwd`"
|
2014-05-03 20:09:55 +08:00
|
|
|
IMPLEMENTED_FAIL=$(($IMPLEMENTED_FAIL + 1))
|
2012-02-01 04:10:33 +08:00
|
|
|
fi
|
|
|
|
if [ $pass -gt 0 ]
|
|
|
|
then
|
|
|
|
echo "passed $pass tests in `pwd`"
|
|
|
|
if [ $fail -eq 0 ]
|
|
|
|
then
|
2014-05-03 20:09:55 +08:00
|
|
|
IMPLEMENTED_PASS=$(($IMPLEMENTED_PASS + 1))
|
2012-02-01 04:10:33 +08:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ $fail -eq 0 -a $pass -eq 0 ]
|
|
|
|
then
|
|
|
|
echo "not implemented: `pwd`"
|
2014-05-03 20:09:55 +08:00
|
|
|
UNIMPLEMENTED=$(($UNIMPLEMENTED + 1))
|
2012-02-01 04:10:33 +08:00
|
|
|
fi
|
|
|
|
|
2014-05-03 20:09:55 +08:00
|
|
|
FAIL=$(($FAIL + $fail))
|
|
|
|
PASS=$(($PASS + $pass))
|
2012-02-01 04:10:33 +08:00
|
|
|
|
|
|
|
for FILE in *
|
|
|
|
do
|
|
|
|
if [ -d "$FILE" ];
|
|
|
|
then
|
|
|
|
cd $FILE
|
|
|
|
afunc
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
afunc
|
|
|
|
|
|
|
|
echo "****************************************************"
|
|
|
|
echo "Results for `pwd`:"
|
|
|
|
echo "using `$CC --version`"
|
|
|
|
echo "with $OPTIONS $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
|