1#!/bin/bash 2# 3# @echo off 4# 5# Run specified set of test cases in all enabled modes 6# 7# DESCRIPTION: 8# 9# 1. A set of test cases to be run is manually 10# specified in INIT_SET_OF_TEST_CASES() routine 11# 12# 2. Modes of runs to be executed are manually 13# specified by non-zero variables: 14# ENABLESLACK32 - 32-bit slack 15# ENABLESLACK64 - 64-bit slack 16# ENABLENORM32 - 32-bit non-slack (normal) 17# ENABLENORM64 - 64-bit non-slack (normal) 18# 19# 3. You can exclude log out to RESULTS directory 20# by setting to zero the variable: 21# ENABLELOG 22# 23# External definitions required: 24# 25# acpiexec - AcpiExec utility 26# ASLTSDIR - the pathname of root directory of aslts test suite 27# 28# Concepts: 29# 30# bitmap of mode - 31# 0-th bit - [0 - 32-bit, 1 - 64-bit] 32# 1-th bit - [0 - non-slack, 1 - slack] 33# 34# See comment of Do utility for more information. 35 36# Includes 37 38. common 39. settings 40. diffproc 41 42 43# Store message to the common multi-result log file 44# arg1 - message 45multi_log() 46{ 47 if [ -f "$COMMONLOGFILE" ]; then 48 echo "$1" >> "$COMMONLOGFILE" 49 else 50 echo "$1" 51 fi 52} 53 54# Convert {h:m:s:cs} string to centisecond time units 55# [arg1-arg4] - centisecond time string {h:m:s:cs} 56cent_str_to_cent_units() 57{ 58 local rval 59 60 # Note: '1' before arguments (hours - exception took place) 61 # added to mask first '0' in cases '08' and '09' 62 63 eval "rval=$[ (((1$1 - 100) * 60 + (1$2 - 100)) * 60 + (1$3 - 100)) * 100 + (1$4 - 100) ]" 64 echo "$rval" 65} 66 67# Convert {h:m:s} string to centisecond time units 68# arg1 - time string {h:m:s} 69sec_str_to_cent_units() 70{ 71 local rval hmscS=$1:00 _ifs="$IFS" 72 73 IFS=: 74 rval=`cent_str_to_cent_units $hmscS` 75 IFS="$_ifs" 76 77 echo "$rval" 78} 79 80# Return the length ot time period in centisecond time units 81# Note: assumed the total running time is less than 24 hours 82# arg1 - start time in centisecond time units 83# arg2 - finish time in centisecond time units 84get_cent_units_diff() 85{ 86 local rval 87 local hmscU=$2 88 89 # Check crossing 24-hour boundary 90 91 if [ $hmscU -lt $1 ]; then 92 hmscU=$[ $hmscU + 8640000 ] 93 fi 94 95 eval "rval=$[ $hmscU - $1 ]" 96 97 echo "$rval" 98} 99 100# Calculate and return the length ot time period as string {[h:]m:s.c} 101# arg1 - start time string {h:m:s} 102# arg2 - finish time string {h:m:s} 103get_cent_str_diff() 104{ 105 local rval 106 107 RAW_INITIME=`sec_str_to_cent_units $1` 108 RAW_ENDTIME=`sec_str_to_cent_units $2` 109 RAW_RUNTIME=`get_cent_units_diff $RAW_INITIME $RAW_ENDTIME` 110 rval=`cent_units_to_cent_str $RAW_RUNTIME` 111 112 echo "$rval" 113} 114 115# Get version of AcpiExec 116get_acpiexec_version() 117{ 118 local x version 119 120 x=`"$acpiexec" -bex,MAIN | grep "Utility version"` 121 if [ x"$x" == x ]; then 122 version=00000000 123 else 124 version=`echo "$x" | awk -F" " '{print $5}'` 125 fi 126 127 echo $version 128} 129 130# Get the patname of AML code of test case 131# arg1 - the name of test case 132# arg2 - bitmap of mode 133get_aml_code_path() 134{ 135 local BITMODE=`get_mode_string $2 2` 136 137 path="$ASLTSDIR/tmp/aml/$EXECVERSION/opt/$BITMODE/$1.aml" 138 echo "$path" 139} 140 141# Run particular test case 142# arg1 - the name of test case 143# arg2 - bitmap of mode 144run_test_case() 145{ 146 local amlcodepath tcase=$1 modepart modename SLMODE BITMODE 147 local options method commandline 148 149 150 modepart=`get_mode_string $2 0` 151 modename=`get_mode_string $2 1` 152 BITMODE=`get_mode_string $2 2` 153 SLMODE=`get_mode_string $2 3` 154 155 TEST_TITLE="$tcase $modename" 156 157 # Start time 158 159 FMT_INITIME=$(date +%T) 160 161 # Initial message 162 163 echo "ASLTS: START, $TEST_TITLE, $FMT_INITIME" 164 165 # Simulate test by acpiexec 166 167 amlcodepath=`get_aml_code_path $tcase $2` 168 169 if [ ! -f "$amlcodepath" ]; then 170 echo "Test doesn't exist: $amlcodepath" 171 AML_DONT_EXIST=$[ $AML_DONT_EXIST + 1 ] 172 TEST_RET=1 173 else 174 options="" 175 if [ $SLMODE == "norm" ]; then 176 method=MN00 177 options="" 178 else 179 method=MN01 180 options="-es" 181 fi 182 183 if [ "$DO_MEMSTAT" == "yes" ]; then 184 options="$options -ef" 185 fi 186 187 if [[ "$tcase" == mt_* ]]; then 188 commandline="thr,6,1" 189 else 190 commandline=ex 191 fi 192 193 echo "" 194 echo "acpiexec options to reproduce:" 195 echo " $options -b\"$commandline,$method\"" 196 echo "ASLTS aml tables to reproduce:" 197 echo " $amlcodepath" 198 echo "" 199 200 "$acpiexec" $options -b"$commandline,$method" "$amlcodepath" 201 TEST_RET=$? 202 fi 203 204 # Finish time 205 206 FMT_ENDTIME=$(date +%T) 207 208 # Calculate the run time 209 210 FMT_RUNTIME=`get_cent_str_diff $FMT_INITIME $FMT_ENDTIME` 211 212 # Report the status message 213 214 if [ $TEST_RET != 0 ]; then 215 echo "ASLTS: FINISH, $TEST_TITLE, FAIL, $FMT_ENDTIME ($FMT_RUNTIME)" 216 UTILSTATUS=1 217 else 218 echo "ASLTS: FINISH, $TEST_TITLE, SUCCESS, $FMT_ENDTIME ($FMT_RUNTIME)" 219 fi 220 221 return $TEST_RET 222} 223 224# Run a set of test cases (specified by INIT_SET_OF_TEST_CASES) 225# in one particular mode. 226# arg1 - bitmap of mode 227# arg2 - multi-result directory 228# arg3 - a list of test cases to be run 229run_set_of_test_cases() 230{ 231 local x y z q status=0 total modepart modename tcase amlcodepath 232 233 modepart=`get_mode_string $1 0` 234 modename=`get_mode_string $1 1` 235 236 x=$(date +%F) 237 y=$(date +%T) 238 239 multi_log "$modename started $x $y" 240 241 total="$x $y" 242 243 for tcase in $3; do 244 amlcodepath=`get_aml_code_path $tcase $1` 245 if [ ! -f "$amlcodepath" ]; then 246 echo "Test doesn't exist: $amlcodepath" 247 AML_DONT_EXIST=$[ $AML_DONT_EXIST + 1 ] 248 else 249 if [ $ENABLELOG != 0 ]; then 250 run_test_case $tcase $1 > "$2/$modepart/$tcase" 251 else 252 run_test_case $tcase $1 253 fi 254 # See comment below. 255 # if [ $? -ne 0 ]; then 256 # status=1 257 # fi 258 fi 259 done 260 261 z=$(date +%T) 262 q=`get_cent_str_diff $y $z` 263 264 # AcpiExec doesn't provide status of test execution, 265 # so dont report STATUS of AcpiExec execution here 266 # not to mislead as if it means STATUS of the tests 267 # execution. 268 # if [ $status == 0 ]; then 269 # status=PASS 270 # else 271 # status=FAIL 272 # fi 273 x="$(date +%F)" 274 multi_log "$modename finished $x $z, ($q)" 275 276 total="$modename, $total, $x $z ($q)" 277 278 MODES_SUMMARIES[$1]="$total" 279 280 MODES_TIMES[$1]="$q" 281} 282 283# Get the date-time-like name (used 284# as a multi-result directory name) 285# arg1 - time string {h:m:s} 286# arg2 - date string {y-m-d} 287get_date_time_like_name() 288{ 289 local x y rval 290 291 x=`echo $1 | sed 's/-//g'` 292 y=`echo $2 | sed 's/://g'` 293 rval="$x.$y.$EXECVERSION" 294 295 echo "$rval" 296} 297 298# Check-make multi-result directory 299# arg1 - multi-result directory name 300make_multi_result_dir() 301{ 302 local srcdir=`pwd` path 303 304 cd "$ASLTSDIR" 305 306 make_dir "./tmp" tmp tmp 307 308 cd "./tmp" 309 310 make_dir "./RESULTS" RESULTS RESULTS 311 312 cd "./RESULTS" 313 314 make_dir "./$1" "$1" "RESULTS/$1" 315 316 cd "./$1" 317 318 if [ $ENABLENORM32 != 0 -o $ENABLENORM64 != 0 ]; then 319 path="RESULTS/$1/norm" 320 make_dir "./norm" norm "$path" 321 cd "./norm" 322 if [ $ENABLENORM32 != 0 ]; then 323 make_dir "./32" 32 "$path/32" 324 fi 325 if [ $ENABLENORM64 != 0 ]; then 326 make_dir "./64" 64 "$path/64" 327 fi 328 329 cd ".." 330 fi 331 332 if [ $ENABLESLACK32 != 0 -o $ENABLESLACK64 != 0 ]; then 333 path="RESULTS/$1/slack" 334 make_dir "./slack" slack "$path" 335 cd "./slack" 336 if [ $ENABLESLACK32 != 0 ]; then 337 make_dir "./32" 32 "$path/32" 338 fi 339 if [ $ENABLESLACK64 != 0 ]; then 340 make_dir "./64" 64 "$path/64" 341 fi 342 fi 343 344 cd "$srcdir" 345} 346 347# Report to multi-log all the specified modes 348# the tests to be run in. 349report_specified_modes() 350{ 351 local flag=0 x=" " 352 353 multi_log "Modes specified for running:" 354 multi_log "" 355 356 if [ $ENABLENORM32 != 0 ]; then 357 multi_log "${x}`get_mode_string $NORM32 1`" 358 flag=1 359 fi 360 if [ $ENABLENORM64 != 0 ]; then 361 multi_log "${x}`get_mode_string $NORM64 1`" 362 flag=1 363 fi 364 if [ $ENABLESLACK32 != 0 ]; then 365 multi_log "${x}`get_mode_string $SLACK32 1`" 366 flag=1 367 fi 368 if [ $ENABLESLACK64 != 0 ]; then 369 multi_log "${x}`get_mode_string $SLACK64 1`" 370 flag=1 371 fi 372 373 if [ $flag == 0 ]; then 374 multi_log "${x}No any run mode" 375 fi 376} 377 378# Report all status lines encountered in the test case 379# run log file and count and report the summary status 380# line of the test case. 381# arg1 - resulting log file of particular test case run 382# arg2 - the name of test case 383# arg3 - file where to store summary information 384do_summary_of_test_case() 385{ 386 local status cnt=0 pass=0 fail=0 skip=0 start=0 finish=0 total=0 387 local outstand0=0 blck=0 outstand1=0 388 local memcnt=0 memtotal=0 389 local max0=0 max1=0 max2=0 max3=0 max4=0 max5=0 390 local out0=0 out1=0 out2=0 out3=0 out4=0 out5=0 391 local LargeRefCount=0 392 local x=0 exceptionsnum=0 393 394 OLD_IFS=$IFS 395 IFS=" " 396 397 cat "$1" |\ 398 while [ 1 ] 399 do 400 read s0 s1 s2 s3 line 401 if [ $? -ne 0 ] ; then 402 echo "|$2|$cnt|$pass|$fail|$skip|$start|$finish|$total|$outstand0|$blck|$memtotal|$max0|$max1|$max2|$max3|$max4|$max5|$out0|$out1|$out2|$out3|$out4|$out5|$outstand1|$LargeRefCount|$exceptionsnum|" >> "$3" 403 break 404 fi 405 if [[ "$line" == *STST* ]]; then 406 echo "$line" 407 cnt=$[ $cnt + 1 ] 408 status=`echo "$line" | awk -F: '{print $6}'` 409 if [ "$status" == PASS ]; then 410 pass=$[ $pass + 1 ] 411 elif [ "$status" == FAIL ]; then 412 fail=$[ $fail + 1 ] 413 elif [ "$status" == BLOCKED ]; then 414 blck=$[ $blck + 1 ] 415 elif [ "$status" == SKIPPED ]; then 416 skip=$[ $skip + 1 ] 417 fi 418 elif [[ "$s0" == ASLTS: ]]; then 419 if [ "$s1" == "START," ]; then 420 start=`echo "$line" | awk -F" " '{print $3}'` 421 elif [ "$s1" == "FINISH," ]; then 422 finish=`echo "$line" | awk -F" " '{print $4}'` 423 total=`echo "$line" | awk -F" " '{print $5}'` 424 fi 425 elif [[ "$s0" == Outstanding: ]]; then 426 outstand0=$s1 427 elif [[ "$s0" == Mem: ]]; then 428 if [ $memcnt == 0 ]; then 429 memtotal=`echo "$line" | awk -F" " '{print $9}'` 430 memtotal=$[ 0 + 0x$memtotal ] 431 max0=`echo "$line" | awk -F" " '{print $6}'` 432 out0=`echo "$line" | awk -F" " '{print $8}'` 433 max0=$[ 0 + 0x$max0 ] 434 out0=$[ 0 + 0x$out0 ] 435 elif [ $memcnt == 1 ]; then 436 max1=`echo "$line" | awk -F" " '{print $5}'` 437 out1=`echo "$line" | awk -F" " '{print $7}'` 438 max1=$[ 0 + 0x$max1 ] 439 out1=$[ 0 + 0x$out1 ] 440 elif [ $memcnt == 2 ]; then 441 max2=`echo "$line" | awk -F" " '{print $5}'` 442 out2=`echo "$line" | awk -F" " '{print $7}'` 443 max2=$[ 0 + 0x$max2 ] 444 out2=$[ 0 + 0x$out2 ] 445 elif [ $memcnt == 3 ]; then 446 max3=`echo "$line" | awk -F" " '{print $5}'` 447 out3=`echo "$line" | awk -F" " '{print $7}'` 448 max3=$[ 0 + 0x$max3 ] 449 out3=$[ 0 + 0x$out3 ] 450 elif [ $memcnt == 4 ]; then 451 max4=`echo "$line" | awk -F" " '{print $5}'` 452 out4=`echo "$line" | awk -F" " '{print $7}'` 453 max4=$[ 0 + 0x$max4 ] 454 out4=$[ 0 + 0x$out4 ] 455 elif [ $memcnt == 5 ]; then 456 max5=`echo "$line" | awk -F" " '{print $5}'` 457 out5=`echo "$line" | awk -F" " '{print $7}'` 458 max5=$[ 0 + 0x$max5 ] 459 out5=$[ 0 + 0x$out5 ] 460 fi 461 memcnt=$[ $memcnt + 1 ] 462 elif [[ "$line" == "Outstanding allocations"* ]]; then 463 outstand1=`echo "$s3" | awk -F"(" '{print $1}'` 464 elif [[ "$line" == *"The total number of exceptions handled"* ]]; then 465 exceptionsnum=`echo "$line" | sed 's/^\[.*\]//g' | awk -F" " '{print $7}'` 466 x=`echo $exceptionsnum | sed 's/"//g'` 467 exceptionsnum=$[ 0 + $x ] 468 elif [[ "$s3" == Large ]]; then 469 if [[ "$line" == "Reference Count"* ]]; then 470 LargeRefCount=$[ $LargeRefCount + 1 ] 471 fi 472 fi 473 done 474 475 IFS=$OLD_IFS 476} 477 478# Report the status lines and summary information 479# for one particular mode of run for each test case 480# specified for running which have the test case run 481# log file located in the given directory. 482# arg1 - directory containing the test case run log files 483# corresponding to one particular mode of run 484# arg2 - a list of test cases the logs of which to be processed 485# arg3 - file where to store summary information 486do_summary_of_mode() 487{ 488 local path 489 490 for filename in $2 491 do 492 path="$1/$filename" 493 if [ -f "$path" ]; then 494 do_summary_of_test_case "$path" "$filename" "$3" 495 fi 496 done 497} 498 499# Prepare all summary information per each test case 500# specified by INIT_SET_OF_TEST_CASES for all the specified 501# modes of runs. 502# arg1 - multi-result directory pathname 503# arg2 - a list of test cases the logs of which to be processed 504do_all_summary() 505{ 506 local path summ 507 508 ls "$1" |\ 509 while [ 1 ] 510 do 511 read filename 512 if [ $? -ne 0 ] ; then 513 break 514 fi 515 516 if [ "$filename" == norm -o "$filename" == slack ]; then 517 path="$1/$filename" 518 if [ -d "$path/32" ]; then 519 summ="$path/32/__STATUS_OF_TEST_CASES" 520 echo -n "" > "$summ" 521 do_summary_of_mode "$path/32" "$2" "$summ" > "$path/32/__STATUS_OF_TESTS" 522 fi 523 if [ -d "$path/64" ]; then 524 summ="$path/64/__STATUS_OF_TEST_CASES" 525 echo -n "" > "$summ" 526 do_summary_of_mode "$path/64" "$2" "$summ" > "$path/64/__STATUS_OF_TESTS" 527 fi 528 fi 529 done 530} 531 532# Report summary information corresponding 533# to the given mode of run. 534# arg1 - ':' separated total information 535# corresponding to the given mode of run 536# returned by parse_status_of_test_cases() 537# arg2 - summary information corresponding 538# to the given mode of run 539report_total_of_mode() 540{ 541 local x y num memtotal 542 543 multi_log "TOTAL: ($2)" 544 545 x=`echo "$1" | awk -F: '{print $4}'` 546 multi_log " PASS : $x" 547 548 x=`echo "$1" | awk -F: '{print $5}'` 549 multi_log " FAIL : $x" 550 551 x=`echo "$1" | awk -F: '{print $12}'` 552 multi_log " BLOCKED : $x" 553 554 x=`echo "$1" | awk -F: '{print $6}'` 555 multi_log " SKIPPED : $x" 556 557 x=`echo "$1" | awk -F: '{print $3}'` 558 multi_log " Tests : $x" 559 560 get_num_of_available_test_cases 561 num=$? 562 563 x=`echo "$1" | awk -F: '{print $2}'` 564 multi_log " Test Cases : $x (of $num)" 565 566 NUM_DISABLED_BRANCHES=`echo "$1" | awk -F: '{print $7}'` 567 568 x=`echo "$1" | awk -F: '{print $8}'` 569 y=`echo "$1" | awk -F: '{print $9}'` 570 571 multi_log " Test Collections : $x (of $RUNTIME_COLLS_NUM), $y" 572 573 x=`echo "$1" | awk -F: '{print $11}'` 574 multi_log " Outstanding allocations after execution : $x" 575 576 x=`echo "$1" | awk -F: '{print $14}'` 577 multi_log " Outstanding allocations (ACPI Error) : $x" 578 579 x=`echo "$1" | awk -F: '{print $15}'` 580 multi_log " Large Reference Count (ACPI Error) : $x" 581 582 memtotal=`echo "$1" | awk -F: '{print $13}'` 583 multi_log " Memory consumption total : $memtotal Kb" 584} 585 586# Report the status of particular test case 587# and summarize the particular entries of the 588# test cases status lines. 589# arg1 - status line of one particular test case 590report_test_case_summary() 591{ 592 local x y z q l m n o p b u 593 local max0=0 max1=0 max2=0 max3=0 max4=0 max5=0 594 local out0=0 out1=0 out2=0 out3=0 out4=0 out5=0 595 local memtotal=0 596 local outstand1=0 597 local LargeRefCount=0 598 599 x=`echo "$1" | awk -F"|" '{print $2}'` 600 y=`echo "$1" | awk -F"|" '{print $7}'` 601 z=`echo "$1" | awk -F"|" '{print $8}'` 602 q=`echo "$1" | awk -F"|" '{print $9}'` 603 604 l=`echo "$1" | awk -F"|" '{print $4}'` 605 m=`echo "$1" | awk -F"|" '{print $5}'` 606 n=`echo "$1" | awk -F"|" '{print $6}'` 607 o=`echo "$1" | awk -F"|" '{print $3}'` 608 p=`echo "$1" | awk -F"|" '{print $10}'` 609 b=`echo "$1" | awk -F"|" '{print $11}'` 610 611 612 if [ $x == "condbranches" ]; then 613 multi_log "$x: (service-test not counted to TOTAL)" 614 N_DISABLED_BRANCHES="$m" 615 else 616 multi_log "$x:" 617 fi 618 619 multi_log " ($y-$z $q)" 620 multi_log " PASS : $l" 621 multi_log " FAIL : $m" 622 multi_log " BLOCKED : $b" 623 multi_log " SKIPPED : $n" 624 multi_log " total : $o" 625 626 p=$[ 0 + $p ] 627 outstand1=`echo "$1" | awk -F"|" '{print $25}'` 628 629 multi_log " Outstanding allocations after execution : $p" 630 multi_log " Outstanding allocations (ACPI Error) : $outstand1" 631 632 LargeRefCount=`echo "$1" | awk -F"|" '{print $26}'` 633 if [[ "$LargeRefCount" -gt 0 ]]; then 634 multi_log " Large Reference Count (ACPI Error) : $LargeRefCount" 635 fi 636 637 multi_log " Memory statistics (per cache type):" 638 639 memtotal=`echo "$1" | awk -F"|" '{print $12}'` 640 multi_log " Total : $memtotal Kb" 641 642 max0=`echo "$1" | awk -F"|" '{print $13}'` 643 max1=`echo "$1" | awk -F"|" '{print $14}'` 644 max2=`echo "$1" | awk -F"|" '{print $15}'` 645 max3=`echo "$1" | awk -F"|" '{print $16}'` 646 max4=`echo "$1" | awk -F"|" '{print $17}'` 647 max5=`echo "$1" | awk -F"|" '{print $18}'` 648 multi_log " Maximum occupied : $max0(Kb) $max1 $max2 $max3 $max4 $max5" 649 650 out0=`echo "$1" | awk -F"|" '{print $19}'` 651 out1=`echo "$1" | awk -F"|" '{print $20}'` 652 out2=`echo "$1" | awk -F"|" '{print $21}'` 653 out3=`echo "$1" | awk -F"|" '{print $22}'` 654 out4=`echo "$1" | awk -F"|" '{print $23}'` 655 out5=`echo "$1" | awk -F"|" '{print $24}'` 656 multi_log " Outstandings : $out0 $out1 $out2 $out3 $out4 $out5" 657 658 if [ $x != "condbranches" ]; then 659 N_TEST_CASES=$[ $N_TEST_CASES + 1 ] 660 N_PASS=$[ $N_PASS + $l ] 661 N_FAIL=$[ $N_FAIL + $m ] 662 N_SKIP=$[ $N_SKIP + $n ] 663 N_BLCK=$[ $N_BLCK + $b ] 664 N_TESTS=$[ $N_TESTS + $o ] 665 N_OUTSTAND=$[ $N_OUTSTAND + $p ] 666 N_OUTSTAND_1=$[ $N_OUTSTAND_1 + $outstand1 ] 667 N_LARGE_REF_CNT=$[ $N_LARGE_REF_CNT + $LargeRefCount ] 668 N_TOTAL=$[ $N_TOTAL + $memtotal ] 669 fi 670 671 mark_collection_flag "$x" 672} 673 674# Run reporting and summarizing the status lines 675# of test cases present in the given file. 676# arg1 - file containing the status lines of 677# all the test cases have been executed 678# in one particular mode. 679parse_status_of_test_cases() 680{ 681 local x 682 683 cat "$1" |\ 684 while [ 1 ] 685 do 686 read line 687 if [ $? -ne 0 ] ; then 688 x="`get_collections_total`" 689 echo ":$N_TEST_CASES:$N_TESTS:$N_PASS:$N_FAIL:$N_SKIP:$N_DISABLED_BRANCHES:$x:$N_OUTSTAND:$N_BLCK:$N_TOTAL:$N_OUTSTAND_1:$N_LARGE_REF_CNT" 690 break 691 fi 692 if [ -n "$line" ] ; then 693 report_test_case_summary "$line" 694 fi 695 done 696} 697 698# Generalization of summary information 699# prepared for test cases runs for the given 700# mode of run - prepare the convenient view 701# survey in the common multi-result log. 702# arg1 - multi-result directory pathname 703# arg2 - bitmap of mode 704# arg3 - summary information corresponding 705# to the given mode of run 706report_mode_summary() 707{ 708 local x memtotal outstand0 outstand1 LargeRefCount path modepart modename 709 710 modepart=`get_mode_string $2 0` 711 modename=`get_mode_string $2 1` 712 713 path="$1/$modepart/__STATUS_OF_TEST_CASES" 714 715 if [ -f "$path" ]; then 716 717 multi_log "$modename:" 718 multi_log "" 719 720 # Reset test collections involved flags 721 reset_collections_flags 722 723 x=`parse_status_of_test_cases "$path"` 724 725 report_total_of_mode "$x" "$3" 726 727 outstand0=`echo "$x" | awk -F: '{print $11}'` 728 outstand1=`echo "$x" | awk -F: '{print $14}'` 729 LargeRefCount=`echo "$x" | awk -F: '{print $15}'` 730 memtotal=`echo "$x" | awk -F: '{print $13}'` 731 732 if [[ "$LargeRefCount" -gt 0 ]]; then 733 HAVE_LARGE_REF_CNT=yes 734 fi 735 736 echo "|TOTAL|$outstand0|$memtotal|${MODES_TIMES[$2]}|$outstand1|$LargeRefCount|" >> "$path" 737 738 multi_log "" 739 740 else 741 multi_log "$modename: summary information is not present" 742 multi_log "" 743 fi 744} 745 746# Report the test cases specified (by INIT_SET_OF_TEST_CASES) 747# for running. 748# arg1 - a list of test cases to be run 749report_enabled_test_cases() 750{ 751 multi_log "Test cases specified for running:" 752 multi_log "" 753 for name in $1 754 do 755 multi_log " $name" 756 done 757} 758 759# Report comparing results of different mode runs 760# of the same multi-run. 761# arg1 - result of two modes comparing 762# arg2 - first bitmap of mode 763# arg3 - second bitmap of mode 764report_inner_modes_cmp() 765{ 766 local rval=0 767 local modename0 modename1 768 769 modename0=`get_mode_string $2 1` 770 modename1=`get_mode_string $3 1` 771 772 if [ $1 == $CMP_CMP_OP ]; then 773 rval=1 774 multi_log " Compared : <$modename0> and <$modename1>" 775 elif [ $1 == $CMP_MISCMP_OP ]; then 776 rval=1 777 multi_log " Miscompared : <$modename0> and <$modename1>" 778 fi 779 780 return $rval 781} 782 783# Compare results of different mode runs 784# of the same multi-result directory. 785# arg1 - multi-result directory 786do_inner_modes_cmp() 787{ 788 local CMP0 CMP1 CMP2 CMP3 CMP4 CMP5 789 790 # Compare results of different mode runs 791 # and report the summary of comparing. 792 793 multi_log "" 794 multi_log "Compare different mode runs of the same multi-run:" 795 multi_log "" 796 797 do_compare_two_runs "$1" $NORM32 "$1" $SLACK32 > /dev/null 798 report_inner_modes_cmp $? $NORM32 $SLACK32 799 CMP4=$? 800 do_compare_two_runs "$1" $NORM32 "$1" $NORM64 > /dev/null 801 report_inner_modes_cmp $? $NORM32 $NORM64 802 CMP0=$? 803 do_compare_two_runs "$1" $NORM32 "$1" $SLACK64 > /dev/null 804 report_inner_modes_cmp $? $NORM32 $SLACK64 805 CMP2=$? 806 do_compare_two_runs "$1" $SLACK32 "$1" $NORM64 > /dev/null 807 report_inner_modes_cmp $? $SLACK32 $NORM64 808 CMP3=$? 809 do_compare_two_runs "$1" $SLACK32 "$1" $SLACK64 > /dev/null 810 report_inner_modes_cmp $? $SLACK32 $SLACK64 811 CMP1=$? 812 do_compare_two_runs "$1" $NORM64 "$1" $SLACK64 > /dev/null 813 report_inner_modes_cmp $? $NORM64 $SLACK64 814 CMP5=$? 815 816 if [ $CMP0 == 0 -a $CMP1 == 0 -a $CMP2 == 0\ 817 -a $CMP3 == 0 -a $CMP4 == 0 -a $CMP5 == 0 ]; then 818 multi_log " Nothing to compare" 819 fi 820} 821 822# ############################## MAIN ############################### 823 824# Init variables of utility 825 826UTILSTATUS=0 827AML_DONT_EXIST=0 828DO_INNER_MODES_COMPARE=no 829 830MULTIPATH= 831EXECVERSION= 832COMMONLOGFILE= 833MODES_TIMES= 834MODES_SUMMARIES= 835NUM_DISABLED_BRANCHES= 836 837# Do settings: 838# - set up a list of test cases you want to be processed 839# - set up a set of modes to run the tests 840# - init log out results of runs 841 842RESET_SETTINGS 843INIT_ALL_AVAILABLE_CASES 844INIT_ALL_AVAILABLE_MODES 845INIT_SET_OF_TEST_CASES 846INIT_SET_OF_TEST_MODES 847INIT_LOG_RESULTS 848INIT_MEM_STAT 849 850# Check access to AcpiExec utility 851 852if [ ! -f "$acpiexec" ]; then 853 do_exit 1 "Undefined acpiexec variable! Set it to pathname of AcpiExec utility." 854fi 855 856# Determine the working directory and take precautions (last name should be aslts) 857 858if [ ! -d "$ASLTSDIR" ]; then 859 do_exit 1 "Undefined ASLTSDIR variable! Set it to pathname of root directory of aslts test suite." 860fi 861 862x=`basename "$ASLTSDIR"` 863if [ "$x" != aslts ]; then 864 do_exit 1 "The last name in ASLTSDIR should be 'aslts', but it is $x!" 865fi 866 867# Start date and time (used in name of result directory) 868 869TS_FMT_INIDATE=$(date +%F) 870TS_FMT_INITIME=$(date +%T) 871 872# Prepare directory for results 873 874if [ $ENABLELOG != 0 ]; then 875 876 EXECVERSION=`get_acpiexec_version` 877 878 MULTINAME=`get_date_time_like_name "$TS_FMT_INIDATE" "$TS_FMT_INITIME"` 879 880 make_multi_result_dir "$MULTINAME" 881 882 # Set up the common messages log file 883 884 MULTIPATH="$ASLTSDIR/tmp/RESULTS/$MULTINAME" 885 check_dir "$MULTIPATH" 886 echo "Generating ASLTS log into directory $MULTIPATH" 887 888 COMMONLOGFILE="$MULTIPATH/Summary" 889 echo "# Trace and summary of $MULTINAME bunch of test runs." > "$COMMONLOGFILE" 890 multi_log "" 891 multi_log "ASLTS_SYSTEM `uname -a`" 892 multi_log "" 893fi 894 895# Start of tests run 896 897report_enabled_test_cases "$ENABLED_TCASES" 898 899multi_log "" 900 901report_specified_modes 902 903multi_log "" 904 905multi_log "Execution started $TS_FMT_INIDATE $TS_FMT_INITIME" 906 907# Run tests in 32-bit norm mode 908if [ $ENABLENORM32 != 0 ]; then 909 run_set_of_test_cases $NORM32 "$MULTIPATH" "$ENABLED_TCASES" 910fi 911 912# Run tests in 64-bit norm mode 913if [ $ENABLENORM64 != 0 ]; then 914 run_set_of_test_cases $NORM64 "$MULTIPATH" "$ENABLED_TCASES" 915fi 916 917# Run tests in 32-bit slack mode 918if [ $ENABLESLACK32 != 0 ]; then 919 run_set_of_test_cases $SLACK32 "$MULTIPATH" "$ENABLED_TCASES" 920fi 921 922# Run tests in 64-bit slack mode 923if [ $ENABLESLACK64 != 0 ]; then 924 run_set_of_test_cases $SLACK64 "$MULTIPATH" "$ENABLED_TCASES" 925fi 926 927# Finish of tests run 928 929TS_FMT_ENDTIME=$(date +%T) 930TS_FMT_RUNTIME=`get_cent_str_diff $TS_FMT_INITIME $TS_FMT_ENDTIME` 931# AcpiExec doesn't provide status of test execution, 932# so dont report STATUS of AcpiExec execution here 933# not to mislead as it means STATUS of the tests 934# execution. 935# if [ $UTILSTATUS == 0 ]; then 936# status=PASS 937# else 938# status=FAIL 939# fi 940multi_log "Execution finished $(date +%F) $TS_FMT_ENDTIME ($TS_FMT_RUNTIME)" 941 942if [ $ENABLELOG != 0 ]; then 943 944 # Prepare all summaries 945 946 do_all_summary "$MULTIPATH" "$ENABLED_TCASES" 947 948 # Generalization of summaries 949 950 multi_log " " 951 multi_log " PER-MODE TEST CASES EXECUTION SUMMARY:" 952 multi_log " " 953 report_mode_summary "$MULTIPATH" $NORM32 "${MODES_SUMMARIES[$NORM32]}" 954 report_mode_summary "$MULTIPATH" $NORM64 "${MODES_SUMMARIES[$NORM64]}" 955 report_mode_summary "$MULTIPATH" $SLACK32 "${MODES_SUMMARIES[$SLACK32]}" 956 report_mode_summary "$MULTIPATH" $SLACK64 "${MODES_SUMMARIES[$SLACK64]}" 957 958 # Cross-compare results of runs of the same multi-result directory 959 960 if [ "$DO_INNER_MODES_COMPARE" == yes ]; then 961 do_inner_modes_cmp "$MULTIPATH" 962 fi 963 964 # Alarm the number of excluded testing branches 965 966 multi_log "" 967 968 if [ -n "$NUM_DISABLED_BRANCHES" ]; then 969 if [ "$NUM_DISABLED_BRANCHES" != 0 ]; then 970 multi_log "WARNING: the number of excluded testing branches is non-zero: $NUM_DISABLED_BRANCHES" 971 fi 972 fi 973 974 TS_FMT_ENDTIME=$(date +%T) 975 TS_FMT_TOTALTIME=`get_cent_str_diff $TS_FMT_INITIME $TS_FMT_ENDTIME` 976 multi_log "Summary prepared $(date +%F) $TS_FMT_ENDTIME ($TS_FMT_TOTALTIME)" 977fi 978 979if [ $AML_DONT_EXIST != 0 ]; then 980 msg="WARNING: some test cases dont have AML code! ($AML_DONT_EXIST)" 981 echo "$msg" 982 multi_log "$msg" 983fi 984 985if [ $HAVE_LARGE_REF_CNT == yes ]; then 986 msg="WARNING: <Large Reference Count> where detected!" 987 echo "$msg" 988 multi_log "" 989 multi_log "$msg" 990fi 991 992exit $UTILSTATUS 993