1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308
|
#!/bin/sh
# Copyright (c) 2005, Wipro Technologies Ltd. All rights reserved.
# Created by: Dr. B. Thangaraju <balat.raju@wipro.com>
# Prashant P Yendigeri <prashant.yendigeri@wipro.com>
# This file is licensed under the GPL license. For the full content
# of this license, see the COPYING file at the top level of this
# source tree.
#
# This execute.sh script executes executables and format the results
# including time statistics like time taken to execute OPTS.
# This script doesn't use 'make' or 'gcc'. This script will be useful
# to run test cases on embedded target.
# Run all the tests in the conformance area.
# Function to calculate starting time
start_func()
{
START_DATE=`date`
START_HOUR=`date +%H`
START_MIN=`date +%M`
START_SEC=`date +%S`
if [ $START_HOUR -eq 0 ]
then
TOTAL_START_HOUR=0
else
TOTAL_START_HOUR=`expr $START_HOUR '*' 3600`
fi
if [ $START_MIN -eq 0 ]
then
TOTAL_START_MIN=0
else
TOTAL_START_MIN=`expr $START_MIN '*' 60`
fi
TOTAL_START_TEMP=`expr $TOTAL_START_HOUR + $TOTAL_START_MIN`
TOTAL_START_SECS=`expr $TOTAL_START_TEMP + $START_SEC`
}
end_func_noday_change()
{
END_DATE=`date`
END_HOUR=`date +%H`
END_MIN=`date +%M`
END_SEC=`date +%S`
TOTAL_END_HOUR=`expr $END_HOUR '*' 3600`
TOTAL_END_MIN=`expr $END_MIN '*' 60`
TOTAL_END_TEMP=`expr $TOTAL_END_HOUR + $TOTAL_END_MIN`
TOTAL_END_SECS=`expr $TOTAL_END_TEMP + $END_SEC`
TOTAL_TIME=`expr $TOTAL_END_SECS - $TOTAL_START_SECS`
TOTAL_HR=`expr $TOTAL_TIME / 3600`
TOTAL_MIN=`expr $TOTAL_TIME / 60`
TOTAL_SEC=$TOTAL_TIME
if [ $TOTAL_SEC -gt 60 ]
then
TOTAL_SEC=`expr $TOTAL_SEC % 60`
fi
if [ $TOTAL_MIN -gt 60 ]
then
TOTAL_MIN=`expr $TOTAL_MIN % 60`
fi
if [ $TOTAL_HR -gt 60 ]
then
TOTAL_HR=`expr $TOTAL_HR % 60`
fi
}
# Function to calculate end time
end_func()
{
END_DATE=`date`
END_HOUR=`date +%H`
END_MIN=`date +%M`
END_SEC=`date +%S`
if [ $END_HOUR -eq 0 ]
then
TOTAL_END_HOUR=0
else
TOTAL_END_HOUR=`expr $END_HOUR '*' 3600`
fi
if [ $END_MIN -eq 0 ]
then
TOTAL_END_MIN=0
else
TOTAL_END_MIN=`expr $END_MIN '*' 60`
fi
TOTAL_END_TEMP=`expr $TOTAL_END_HOUR + $TOTAL_END_MIN`
TOTAL_END_SECS=`expr $TOTAL_END_TEMP + $END_SEC`
TOTAL_START_SECS=`expr 86400 - $TOTAL_START_SECS`
TOTAL_TIME=`expr $TOTAL_END_SECS + $TOTAL_START_SECS`
TOTAL_HR=`expr $TOTAL_TIME / 3600`
TOTAL_MIN=`expr $TOTAL_TIME / 60`
TOTAL_SEC=$TOTAL_TIME
if [ $TOTAL_SEC -gt 60 ]
then
TOTAL_SEC=`expr $TOTAL_SEC % 60`
fi
if [ $TOTAL_MIN -gt 60 ]
then
TOTAL_MIN=`expr $TOTAL_MIN % 60`
fi
if [ $TOTAL_HR -gt 60 ]
then
TOTAL_HR=`expr $TOTAL_HR % 60`
fi
}
# Function to display the Execution Time Statistics
display_func()
{
echo -ne "\n\n\n\n\t\t*******************************************\n"
echo -ne "\t\t* EXECUTION TIME STATISTICS *\n"
echo -ne "\t\t*******************************************\n"
echo -ne "\t\t* START : $START_DATE *\n"
echo -ne "\t\t* END : $END_DATE *\n"
echo -ne "\t\t* DURATION : *\n"
echo -ne "\t\t* $TOTAL_HR hours *\n"
echo -ne "\t\t* $TOTAL_MIN minutes *\n"
echo -ne "\t\t* $TOTAL_SEC seconds *\n"
echo -ne "\t\t*******************************************\n"
}
# Variables for formatting the OPTS results
declare -i TOTAL=0
declare -i PASS=0
declare -i FAIL=0
declare -i UNRES=0
declare -i UNSUP=0
declare -i UNTEST=0
declare -i INTR=0
declare -i HUNG=0
declare -i SEGV=0
declare -i OTH=0
# Maximum Two minutes waiting time period to execute a test. If it exceeds, the test case will go into the 'HUNG' category.
TIMEOUT_VAL=120
# if gcc available then remove the below line comment else put the t0 in posixtestsuite directory.
#gcc -o t0 t0.c
./t0 0 > /dev/null 2>&1
TIMEVAL_RET=$?
# Find executable files from the conformance directory
# If you want to execute any specific test cases, you should modify here.
FINDFILESsh=`find ./conformance/ -name '*-*.sh' -print`
FINDFILES=`find ./conformance/ -name '*-*.test' -print | grep -v core`
NEWSTR=`echo $FINDFILES $FINDFILESsh`
# Main program
start_func
PM_TO_AM=`date +%P`
if [ $PM_TO_AM = "pm" ]
then
COUNT=1
fi
echo "Run the conformance tests"
echo "=========================================="
count=1
while $TRUE
do
FILE=`echo $NEWSTR | cut -f$count -d" "`
if [ -z $FILE ]
then
PM_TO_AM=`date +%P`
if [ $PM_TO_AM = "am" ]
then
COUNT=`expr $COUNT + 1`
fi
if [ $COUNT -eq 2 ]
then
end_func
else
end_func_noday_change
fi
echo
echo -ne "\t\t***************************\n"
echo -ne "\t\t CONFORMANCE TEST RESULTS\n"
echo -ne "\t\t***************************\n"
echo -ne "\t\t* TOTAL: " $TOTAL "\n"
echo -ne "\t\t* PASSED: " $PASS "\n"
echo -ne "\t\t* FAILED: " $FAIL "\n"
echo -ne "\t\t* UNRESOLVED: " $UNRES "\n"
echo -ne "\t\t* UNSUPPORTED: " $UNSUP "\n"
echo -ne "\t\t* UNTESTED: " $UNTEST "\n"
echo -ne "\t\t* INTERRUPTED: " $INTR "\n"
echo -ne "\t\t* HUNG: " $HUNG "\n"
echo -ne "\t\t* SEGV: " $SEGV "\n"
echo -ne "\t\t* OTHERS: " $OTH "\n"
echo -ne "\t\t***************************\n"
display_func
echo "Finished"
exit
elif [ -x $FILE ]
then
FILEcut=`echo $FILE | cut -b3-80`
TOTAL=$TOTAL+1
./t0 $TIMEOUT_VAL $FILE > /dev/null 2>&1
RET_VAL=$?
if [ $RET_VAL -gt 5 -a $RET_VAL -ne $TIMEVAL_RET ]
then
INTR_VAL=10
fi
case $RET_VAL in
0)
PASS=$PASS+1
echo "$FILEcut:execution:PASS "
;;
1)
FAIL=$FAIL+1
echo "$FILEcut:execution:FAIL "
;;
255)
FAIL=$FAIL+1
echo "$FILEcut:execution:FAIL "
;;
2)
UNRES=$UNRES+1
echo "$FILEcut:execution:UNRESOLVED "
;;
3)
;;
4)
UNSUP=$UNSUP+1
echo "$FILEcut:execution:UNSUPPORTED "
;;
5)
UNTEST=$UNTEST+1
echo "$FILEcut:execution:UNTESTED "
;;
10)
INTR=$INTR+1
echo "$FILEcut:execution:INTERRUPTED "
;;
$TIMEVAL_RET)
HUNG=$HUNG+1
echo "$FILEcut:execution:HUNG "
;;
139)
SEGV=$SEGV+1
echo "$FILEcut:execution:Segmentaion Fault "
;;
*)
OTH=$OTH+1
echo "OTHERS: RET_VAL for $FILE : $RET_VAL"
;;
esac
fi
count=`expr $count + 1`
done
######################################################################################
|