Avoid bash specific functionality to work with any POSIX shell

implementing $(( )).


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180139 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Joerg Sonnenberger 2013-04-23 19:53:24 +00:00
parent f9e75aef34
commit c5e6aa5f5c

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
# //===--------------------------- testit ---------------------------------===// # //===--------------------------- testit ---------------------------------===//
# // # //
# // The LLVM Compiler Infrastructure # // The LLVM Compiler Infrastructure
@ -67,25 +67,24 @@ UNIMPLEMENTED=0
IMPLEMENTED_FAIL=0 IMPLEMENTED_FAIL=0
IMPLEMENTED_PASS=0 IMPLEMENTED_PASS=0
function afunc afunc() {
{
fail=0 fail=0
pass=0 pass=0
if (ls *.fail.cpp &> /dev/null) if (ls *.fail.cpp > /dev/null 2>&1)
then then
for FILE in $(ls *.fail.cpp); do for FILE in $(ls *.fail.cpp); do
if $CC $OPTIONS $HEADER_INCLUDE $SOURCE_LIB $FILE $LIBS -o ./$TEST_EXE &> /dev/null if $CC $OPTIONS $HEADER_INCLUDE $SOURCE_LIB $FILE $LIBS -o ./$TEST_EXE > /dev/null 2>&1
then then
rm ./$TEST_EXE rm ./$TEST_EXE
echo "$FILE should not compile" echo "$FILE should not compile"
let "fail+=1" fail=$(($fail+1))
else else
let "pass+=1" pass=$(($pass+1))
fi fi
done done
fi fi
if (ls *.pass.cpp &> /dev/null) if (ls *.pass.cpp > /dev/null 2>&1)
then then
for FILE in $(ls *.pass.cpp); do for FILE in $(ls *.pass.cpp); do
if [ "$VERBOSE" ] if [ "$VERBOSE" ]
@ -97,17 +96,17 @@ function afunc
if ./$TEST_EXE if ./$TEST_EXE
then then
rm ./$TEST_EXE rm ./$TEST_EXE
let "pass+=1" pass=$(($pass+1))
else else
echo "`pwd`/$FILE failed at run time" echo "`pwd`/$FILE failed at run time"
echo "Compile line was:" $CC $OPTIONS $HEADER_INCLUDE $SOURCE_LIB $FILE $LIBS echo "Compile line was:" $CC $OPTIONS $HEADER_INCLUDE $SOURCE_LIB $FILE $LIBS
let "fail+=1" fail=$(($fail+1))
rm ./$TEST_EXE rm ./$TEST_EXE
fi fi
else else
echo "`pwd`/$FILE failed to compile" echo "`pwd`/$FILE failed to compile"
echo "Compile line was:" $CC $OPTIONS $HEADER_INCLUDE $SOURCE_LIB $FILE $LIBS echo "Compile line was:" $CC $OPTIONS $HEADER_INCLUDE $SOURCE_LIB $FILE $LIBS
let "fail+=1" fail=$(($fail+1))
fi fi
done done
fi fi
@ -115,24 +114,24 @@ function afunc
if [ $fail -gt 0 ] if [ $fail -gt 0 ]
then then
echo "failed $fail tests in `pwd`" echo "failed $fail tests in `pwd`"
let "IMPLEMENTED_FAIL+=1" IMPLEMENTED_FAIL=$(($IMPLEMENTED_FAIL+1))
fi fi
if [ $pass -gt 0 ] if [ $pass -gt 0 ]
then then
echo "passed $pass tests in `pwd`" echo "passed $pass tests in `pwd`"
if [ $fail -eq 0 ] if [ $fail -eq 0 ]
then then
let "IMPLEMENTED_PASS+=1" IMPLEMENTED_PASS=$((IMPLEMENTED_PASS+1))
fi fi
fi fi
if [ $fail -eq 0 -a $pass -eq 0 ] if [ $fail -eq 0 -a $pass -eq 0 ]
then then
echo "not implemented: `pwd`" echo "not implemented: `pwd`"
let "UNIMPLEMENTED+=1" UNIMPLEMENTED=$(($UNIMPLEMENTED+1))
fi fi
let "FAIL+=$fail" FAIL=$(($FAIL+$fail))
let "PASS+=$pass" PASS=$(($PASS+$pass))
for FILE in * for FILE in *
do do