sed -i 's#\/\* .* tmp.* \*\/# #g' $i
sed -i 's#\/\* tmp.* \*\/# #g' $i
-
#!/bin/bash
-
-
# This shell script is used to run 'test' binary and diff
-
# the execute result with the expected 'result' file.
-
#
-
#
-
# The 'result' file example:
-
# ArithmeticConversions_Vectors_uintn: uintn vs bool: (2, 2)
-
# ArithmeticConversions_Vectors_uintn: uintn vs char: (2, 2)
-
# ArithmeticConversions_Vectors_uintn: uintn vs uchar: (2, 2)
-
-
-
topdir=`pwd`
-
-
########################################################
-
## log file definations, user can change them
-
logfile_dir=log_dir
-
ok_log_file=ok_item.log
-
ng_log_file=ng_item.log
-
warning_log_file=warning_item.log
-
########################################################
-
-
-
-
# the following is important for test, user do not
-
logfile=$topdir/$logfile_dir/$ng_log_file
-
okfile=$topdir/$logfile_dir/$ok_log_file
-
Warningfile=$topdir/$logfile_dir/$warning_log_file
-
-
linefile=$topdir/linefile
-
diff_file=$topdir/diff.log
-
tmplog=$topdir/tmplog
-
-
-
## variable used for count
-
OK_CNT=0
-
NG_CNT=0
-
TOTAL_CNT=0
-
num=0
-
ok_num=0
-
-
## function definations
-
log_title()
-
{
-
# creat log dir
-
mkdir -p $logfile_dir
-
-
#Test result log file title
-
echo "Test result log:" >$logfile
-
echo "" >>$logfile
-
-
#echo "[NG Item Directory Path]:[item in test case]" >>$logfile
-
-
-
#OK log file title
-
echo "OK item:" >$okfile
-
echo "Warning item:" >$Warningfile
-
#echo "=========" >>$okfile
-
}
-
-
print_note()
-
{
-
#echo ""
-
#echo "----- Printing the log file '$logfile': -----"
-
#cat $logfile
-
-
echo ""
-
echo -e "\033[41;37m**********************************************\033[0m"
-
echo -e "\033[41;37m* Please see the test result in the directory:\033[0m"
-
echo -e "\033[41;37m* $logfile_dir \033[0m"
-
# echo "'$logfile'"
-
# echo "*And see the OK items for detail in file:"
-
# echo "'$okfile'"
-
echo -e "\033[41;37m**********************************************\033[0m"
-
#echo "********************************************"
-
echo ""
-
}
-
-
count()
-
{
-
# print to ng log file
-
((TOTAL_CNT=OK_CNT+NG_CNT))
-
echo "" >>$logfile
-
echo "========================" >>$logfile
-
echo "Total items count: $TOTAL_CNT" >> $logfile
-
echo "OK items count: $OK_CNT" >> $logfile
-
echo "NG items count: $NG_CNT" >> $logfile
-
echo "========================" >>$logfile
-
-
# print to ok log file
-
echo "" >>$okfile
-
echo "========================" >>$okfile
-
echo "Total items count: $TOTAL_CNT" >> $okfile
-
echo "OK items count: $OK_CNT" >> $okfile
-
echo "NG items count: $NG_CNT" >> $okfile
-
echo "========================" >>$okfile
-
}
-
-
ok_case()
-
{
-
while read line
-
do
-
echo $line >$linefile
-
ok_case_str=`awk -F '[:]' '{printf $2}' $linefile`
-
-
# add Directory for each item:
-
echo "" >>$okfile
-
#echo " - Directory: -" >>$okfile
-
((ok_num++))
-
echo "-- OK item$ok_num --" >>$okfile
-
#echo " - : -" >>$okfile
-
#ng_item=`pwd`
-
#ng_dir=${ng_item#*"$topdir/"}
-
ok_item=`pwd`
-
ok_dir=${ok_item#*"$topdir/"}
-
echo "$ok_dir" >>$okfile
-
# echo "################## $ok_case_str"
-
if [[ $ok_case_str != *Makefil* ]];then
-
echo "Case:$ok_case_str" >> $okfile
-
else
-
# echo '@@@@@@@@@@@@@@@@@@@@@@'
-
echo 'Case: *' >> $okfile
-
fi
-
-
# awk -F '[:]' '{printf substr($1,3)}' $linefile >> $logfile
-
-
#record the test items in the test case if exist
-
done < result
-
}
-
-
exec_diff()
-
{
-
./test &> $tmplog
-
diff_ret=`diff -a $tmplog result|grep -a \>`
-
diff_ret2=`diff -a $tmplog result|grep -a \<`
-
diff -a $tmplog result|grep -a \> >$diff_file
-
case_item_cnt=`wc -l result|awk '{printf $1}'`
-
-
-
if [ -z "$diff_ret" ];then
-
if [ -n "$diff_ret2" ]; then
-
echo "Warning! in '`pwd`'" >> $Warningfile
-
# exit 1
-
else
-
#run OK.
-
#record OK item:
-
ok_item=`pwd`
-
ok_dir=${ok_item#*"$topdir/"}
-
#echo "@@@@@@@@@@@@@@@@@@@@@@" >>$okfile
-
#echo "" >>$okfile
-
#echo "-111 Directory: -" >>$okfile #mv to else
-
#echo "$ok_dir" >>$okfile
-
-
#record OK cases:
-
if [ $case_item_cnt -gt 1 ];then
-
# there are more than one test cases.
-
ok_case
-
else
-
# there is only one test case.
-
echo "" >>$okfile
-
((ok_num++))
-
echo "-- OK item$ok_num --" >>$okfile
-
#echo "- Directory: -" >>$okfile
-
echo "$ok_dir" >>$okfile
-
fi
-
-
((OK_CNT=OK_CNT+case_item_cnt)) #add OK item count number.
-
fi
-
else
-
#run NG.
-
case_ng_cnt=`wc -l $diff_file|awk '{printf $1}'`
-
((NG_CNT=NG_CNT+case_ng_cnt))
-
((OK_CNT=OK_CNT+case_item_cnt-case_ng_cnt))
-
-
# cat $diff_file|
-
while read line
-
do
-
(( num++ ))
-
#echo "----------" >>$logfile
-
echo "-- NG item$num --" >>$logfile
-
# echo "In test directroy:" >>$logfile
-
-
#record the Directory Structure of test case
-
echo $line >$linefile
-
# awk -F '[:]' '{printf substr($1,3)}' $linefile >> $logfile
-
ng_item=`pwd`
-
ng_dir=${ng_item#*"$topdir/"}
-
echo "$ng_dir" >>$logfile
-
-
-
#record the test items in the test case if exist
-
case_str=`awk -F '[:]' '{printf $2}' $linefile`
-
#judge test items exist and test items is not none case
-
#if [ -n "$case_str" -a "$case_str" != "none" ];then
-
if [ -n "$case_str" ];then
-
if [ "$case_str" != "none" ];then
-
echo "Case:$case_str" >> $logfile
-
#else
-
#enter newline
-
# echo "" >> $logfile
-
# echo "" #do nothing
-
fi
-
fi
-
# #echo "------------------------------------------------" >>$logfile
-
echo "" >>$logfile
-
done <$diff_file
-
-
#record ok item cases:
-
if [ $case_item_cnt -gt 1 ];then
-
#echo "****************************" >>$okfile
-
# echo "" >>$okfile
-
# echo "- Directory: -" >>$okfile #mv to each item
-
# echo "$ng_dir" >>$okfile
-
-
#ok_case
-
while read line
-
do
-
echo $line >$linefile
-
ok_case_str=`awk -F '[:]' '{printf $2}' $linefile`
-
-
while read line
-
do
-
echo $line >$linefile
-
#record the test items in the test case if exist
-
case_str=`awk -F '[:]' '{printf $2}' $linefile`
-
#judge test items exist and test items is not none case
-
if [ "$ok_case_str" == "$case_str" ];then
-
#echo "Case:$ok_case_str" >> $okfile
-
ok_case_str="NG"
-
fi
-
done <$diff_file
-
-
if [ "$ok_case_str" != "NG" ];then
-
# there are ok test cases.
-
echo "" >>$okfile
-
((ok_num++))
-
echo "-- OK item$ok_num --" >>$okfile
-
#echo " - Directory: -" >>$okfile
-
echo "$ng_dir" >>$okfile
-
echo "Case:$ok_case_str" >> $okfile
-
fi
-
-
done < result #end while
-
-
#echo "))))))))))))))))))))))))))))" >>$okfile
-
fi
-
#end record ok item
-
-
fi
-
}
-
-
main_fun()
-
{
-
if [ -f Makefile ];then # if Makefile exist
-
list=`grep SUBDIRS.*= Makefile |awk -F= '{printf $2}'`
-
if [ -z "$list" ];then
-
#there is no sub dir any more
-
if [ $OK_CNT != $ok_num ];then
-
# echo "error found: ok_item_count is error! in: `pwd`" >> $Warningfile
-
# exit 1
-
echo ""
-
fi
-
exec_diff
-
#cd ../
-
else
-
# echo "There is sub dir in [`pwd`]--- $list ---"
-
# echo "Entering directory '`pwd`'"
-
# echo "Testing subdir '$list'"
-
for dir in $list
-
do
-
if [ -d $dir ];then
-
cd $dir
-
echo "Entering directory '`pwd`'"
-
main_fun
-
cd ..
-
else
-
echo "Warning: no such directory: `pwd`/$dir" >>$logfile
-
fi
-
done
-
fi
-
else
-
echo "Warning: there is no 'Makefile' find in '`pwd`'" >>$logfile
-
fi #end if Makefile exist
-
}
-
-
del_log()
-
{
-
rm -f $linefile
-
rm -f $diff_file
-
rm -f $tmplog
-
}
-
-
usage_help()
-
{
-
while true;do
-
echo ""
-
echo "The work top directory is:"
-
echo -e "\033[41;37m $WORKTOP_DIR\033[0m"
-
# echo "$WORKTOP_DIR"
-
# echo ""
-
echo "---------------------------------------------------"
-
echo "Please make sure that is right?(y/n)"
-
echo "---------------------------------------------------"
-
# echo " source setup_env.sh (y/n)"
-
#echo "(y/n)"
-
read Arg
-
case $Arg in
-
Y|y|yes|YES)
-
break
-
;;
-
N|n|NO|no)
-
echo "Please modify environment setting in 'setup_env.sh'"
-
echo "See how to modify according to the User Manual."
-
echo ""
-
exit
-
;;
-
esac
-
done
-
}
-
-
#Main flow
-
-
source setup_env.sh
-
usage_help
-
make clean;make
-
touch /tmp/test_opencl.h
-
log_title
-
main_fun
-
count
-
del_log
-
make clean;
-
print_note
- rm -f /tmp/test_opencl.h
-
#target="1409_s16.c"
-
target="1409_s16.c 1417_s32.c 1428_s32.c 1440_su.c 1449_s16.c 1512_i8.c 1516_s16.c 1409_s8.c 1417_u32.c 1428_u32.c 1441_s16.c 1449_s8.c 1513_s16.c 1517_s16.c 1409_u16.c 1420_s8.c 1429_s9.c 1441_s8.c 1450_su16.c 1513_s32.c 1518_s16.c 1409_u8.c 1421_su8.c 1430_su9.c 1442_su8.c 1450_su8.c 1513_s8.c 1519_s16.c 1410_su16.c 1422_s16.c 1431_u16.c 1443_s16.c 1451_s32.c 1513_u16.c 1520_s16.c 1410_su8.c 1422_s8.c 1431_u8.c 1443_s8.c 1451_u32.c 1513_u32.c 1521_s16.c 1411_s32.c 1423_su8.c 1432_s16.c 1443_u16.c 1454_s8.c 1513_u8.c 1522_s16.c 1411_u32.c 1424_s16.c 1432_s8.c 1443_u8.c 1455_su8.c 1514_i16.c 1523_s16.c 1412_s9.c 1424_s8.c 1433_su16.c 1444_su16.c 1456_s16.c 1514_i32.c 1524_s16.c 1413_su9.c 1425_su8.c 1433_su8.c 1444_su8.c 1456_s8.c 1514_i8.c 1414_u16.c 1426_s16.c 1434_s32.c 1445_s32.c 1457_su.c 1515_s16.c 1414_u8.c 1426_s8.c 1434_u32.c 1445_u32.c 1458_s16.c 1515_s32.c 1415_s16.c 1426_u16.c 1437_s8.c 1446_s9.c 1458_s8.c 1515_s8.c 1415_s8.c 1426_u8.c 1438_su8.c 1447_su9.c 1459_su8.c 1515_u16.c 1416_su16.c 1427_su16.c 1439_s16.c 1448_u16.c 1512_i16.c 1515_u32.c 1416_su8.c 1427_su8.c 1439_s8.c 1448_u8.c 1512_i32.c 1515_u8.c"
-
-
-
for i in $target
-
do
-
#ls $i > aa
-
#num=`cat aa| awk -F '_' '{print $1}'`
-
#echo $num
-
-
#grep -rn "void optimize_asm_" $i > bb
-
#str=`cat bb|awk -F '_' '{print $4}'`
-
#echo $str > cc
-
#str1=`cat cc|awk -F '(' '{print $1}'`
-
#echo $str1
-
#sed -i "s/$str1(/${str1}_$num(/g" $i
-
#sed -i 's/static void expect_/void expect_/g' $i
-
-
#line=`grep -rn "main" $i`
-
#echo $line > dd
-
#line1=`cat dd|awk -F ':' '{print $1}'`
-
#echo $line1
-
#re=$(($line1+5))
-
#echo $re
-
#sed -i "${re}a#endif" $i
-
#sed -i "${line1}i#ifndef COMBINE" $i
-
#sed -i 's/vr0:vr1/vxd0/g' $i
-
#sed -i 's/vr2:vr3/vxd1/g' $i
-
sed -i 's/vr4:vr5/vxd2/g' $i
-
sed -i 's/vr6:vr7/vxd3/g' $i
-
sed -i 's/vr8:vr9/vxd4/g' $i
-
sed -i 's/vr10:vr11/vxd5/g' $i
-
#sed -i 's/, xq/, vxq/g' $i
-
#sed -i 's/,xq/,vxq/g' $i
-
#sed -i 's/:xq/:vxq/g' $i
- done