security/nss/tests/qa_stat

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rwxr-xr-x

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 #! /bin/sh 
     2 ########################################################################
     3 #
     4 # /u/sonmi/bin/qa_stat - /u/svbld/bin/init/nss/qa_stat
     5 #
     6 # this script is supposed to automatically run QA for NSS on all required
     7 # Unix platforms
     8 #
     9 # parameters
    10 # ----------
    11 #    nssversion (supported: 30b, 31, tip)
    12 #    builddate  (default - today)
    13 #
    14 # options
    15 # -------
    16 #    -y answer all questions with y - use at your own risk...ignores warnings
    17 #    -s silent (only usefull with -y)
    18 #    -h, -? - you guessed right - displays this text
    19 #    -d debug
    20 #    -f <filename> - write the (error)output to filename
    21 #    -m <mailinglist> - send filename to mailinglist (csl) only useful
    22 #        with -f
    23 #    -cron equivalient to -y -s -d -f $RESULTDIR/$HOST.qa_stat
    24 #
    25 ########################################################################
    27 O_OPTIONS=ON
    29 TBX_EXIT=49          # in case we are running on a tinderbox build, any
    30                           # early exit needs to return an error
    31 if [ -z "$O_TBX" -o "$O_TBX" = "OFF" ] ; then
    32     if [ -z "$O_LOCAL" -o "$O_LOCAL" = "OFF" ] ; then
    33         . `dirname $0`/header
    34     fi
    35 fi
    36 Debug "Sourced header O_TBX=$O_TBX O_LOCAL=$O_LOCAL"
    37 TBX_EXIT=48
    38 EARLY_EXIT=TRUE
    40 URL="cindercone.red.iplanet.com"
    42 DOCDIR=/u/sonmi/doc
    44 HTML_ERRORCOLOR=\"#FF0000\"
    45 HTML_ERRORMSG=Failed
    47 HTML_MISSINGCOLOR=\"#FFFFCC\"
    48 HTML_MISSINGMSG=Missing
    50 HTML_INCOMPLETECOLOR=$HTML_MISSINGCOLOR
    51 HTML_INCOMPLETEMSG=Incomplete
    53 HTML_PASSEDCOLOR=\"#66FF99\"
    54 HTML_PASSEDMSG=Passed
    56 # this file is used to deal with hanging rsh - a new shell is started 
    57 # for each rsh, and a function is called after it is finished - they
    58 # communicate with this file
    60 RSH_FILE=$TMP/rsh.$$
    61 echo >$RSH_FILE
    62 TMPFILES="$TMPFILES $WARNINGLIST $RSH_FILE "
    63 RSH_WAIT_TIME=80 #maximum time allowed for the 2 rsh to finish...
    64 #TOTAL_TESTS=106
    65 TOTAL_TESTS=252 #tip
    66 #TOTAL_TESTS=244 #3.4
    67 #TOTAL_TESTS=123 #3.3.2
    68 BCT_TOTAL_TESTS=122 #3.2.2
    69 #TOTAL_TESTS=133 #tip
    71 Debug "NTDIST $NTDIST"
    72 Debug "UXDIST $UXDIST"
    73 Debug "TESTSCRIPTDIR $TESTSCRIPTDIR"
    74 Debug "RESULTDIR $RESULTDIR"
    76 ############################### watch_rsh ##############################
    77 # local shell function, deals with a hanging rsh (kills it...)
    78 # this function is started as a backgroundprocess before the rsh is started,
    79 # and writes info to the RSH_FILE, after the rsh is finished it writes finish
    80 # info to the same file (this time called as a function, forground). 
    81 # the backgroundprocess stays around for RSH_WAIT_TIME, if then the finish 
    82 # information is not there attempts to kill the rsh
    83 #
    84 # watch_rsh start qa_computername &
    85 # watch_rsh stop qa_computername 
    86 #
    87 ########################################################################
    88 watch_rsh()
    89 {
    90     case $1 in
    91         start)
    92             echo "$2 started" >>$RSH_FILE
    93             sleep $RSH_WAIT_TIME
    94             O_ALWAYS_YES=ON # may modify global flags because this is a 
    95                             # forked off bg process - kill_by_name otherwise
    96                             # will ask the user if it really should be killed 
    97             grep "$2 finished" $RSH_FILE >/dev/null || kill_by_name "rsh $2"
    98             exit
    99             ;;
   100         stop)
   101             echo "$2 finished" >>$RSH_FILE
   102             ;;
   103     esac
   104 }
   106 ############################### find_qa_systems ########################
   107 # local shell function, tries to determine the QA operating system
   108 # works remotely, and for Windows machines
   109 ########################################################################
   110 find_qa_systems()
   111 {
   112 for QA_SYS in `ls $RESULTDIR | grep '\.1$' | sed -e "s/\..*//" | sort -u`
   113 do
   114     NO_RSH="FALSE"
   115     QA_OS=""
   116     QA_RHVER=""
   117     IS_64=""
   118     IS_WIN=""
   120     grep OS-LINE ${RESULTDIR}/${QA_SYS}.nssqa >/dev/null && NO_RSH=TRUE
   122     if [ "$NO_RSH" = "TRUE" ]
   123     then
   125         QA_OS=`grep OS-LINE ${RESULTDIR}/${QA_SYS}.nssqa | sort -u | sed \
   126             -e "s/.*-OS-LINE: /${QA_SYS}/"`
   127         QA_OS_STRING=`echo $QA_OS | sed -e "s/^[_ ]//" -e "s/ /_/g"`
   128         echo $QA_OS_STRING >>$PLATFORMLIST
   129         if [ "$O_SILENT" != ON ] ; then
   130             echo $QA_OS
   131         fi
   133         #grep OS-LINE ${RESULTDIR}/${QA_SYS}.nssqa | sort -u | sed \
   134              #-e "s/.*-OS-LINE: /${QA_SYS}_/" >>$PLATFORMLIST
   135         #if [ "$O_SILENT" != ON ] ; then
   136             #grep OS-LINE ${RESULTDIR}/${QA_SYS}.nssqa | sort -u | sed \
   137                  #-e "s/.*-OS-LINE:/${QA_SYS}/" 
   138         #fi
   139     else
   140         REM_SYSNAME=$QA_SYS
   141         watch_rsh start $REM_SYSNAME &
   142         qa_stat_get_sysinfo $QA_SYS
   143         watch_rsh stop $REM_SYSNAME 
   144         echo $QA_OS_STRING >>$PLATFORMLIST
   145                           # use later for missing list
   146     fi
   147 done
   149 }
   151 ################################### qa_stat_init ##########################
   152 # local shell function, sets the name of the resultfile to:
   153 #    <filename> if option -f <filename>
   154 #    $RESULTDIR/result if write permission 
   155 #        (mozilla/tests_results/security/result)
   156 #    $HOME/resultNSS${NSSVER}-${BUILDDATE} if no write permission in $RESULTDIR
   157 ########################################################################
   158 qa_stat_init()
   159 {
   160     if [ $O_FILE = ON -a $O_CRON = OFF ]    # if -f was specified write there 
   161     then
   162         RFILE=$FILENAME    
   163     else
   164         RFILE=${RESULTDIR}/result.$$
   165         if [ ! -w $RESULTDIR ]
   166         then
   167             RFILE=$HOME/resultNSS${NSSVER}-${BUILDDATE}.$$
   168             Debug "Using alternate resultfile $RFILE"
   169         #elif [ $O_CRON = ON ]
   170         #then
   171              ##find ${RESULTDIR} -exec chmod a+rw {} \;    #FIXME - umask 
   172                             ##doesn't seem to work - this is a tmp workaround
   173         fi
   175         if [ ! -x $RESULTDIR -o ! -r  $RESULTDIR -o ! -w $RESULTDIR ]
   176         then
   177             glob_usage "$RESULTDIR does not have the right permissions `ls -l $RESULTDIR`"
   178         fi
   179         if [ -d $RESULTDIR ]
   180         then
   181             cd $RESULTDIR
   182         else
   183             glob_usage "$RESULTDIR does not exist"
   184         fi
   185     fi
   187     ERRORLIST=${RFILE}.E
   188     PLATFORMLIST=${RFILE}.P
   189     PERFLIST=${RFILE}.PE
   190     TMP_HTML_FILE=${RFILE}.html
   191     HTML_FILE=${RESULTDIR}/result.html
   192     WARNINGLIST=${RFILE}.W
   193     BCMISSINGLIST=${RFILE}.BCM
   194     BCERRORLIST=${RFILE}.BCE
   195     TMPFILE=${RFILE}.T
   196     ML_FILE=${RFILE}.ML
   198     TMPFILES="$TMPFILES $TMPFILE"
   199     TMPFILES="$TMPFILES $ERRORLIST $PLATFORMLIST $PERFLIST $WARNINGLIST \
   200        $BCMISSINGLIST $BCERRORLIST $ML_FILE" #FIXME uncomment
   202     FILENAME=$RFILE        #we might want to mail it...later switch to html file
   203     O_FILE="ON"
   205     rm $ERRORLIST $PLATFORMLIST $PERFLIST $WARNINGLIST \
   206        $BCMISSINGLIST $BCERRORLIST $TMP_HTML_FILE  2>/dev/null
   207     touch $ERRORLIST $PLATFORMLIST $PERFLIST $WARNINGLIST \
   208        $BCMISSINGLIST $BCERRORLIST $TMP_HTML_FILE  2>/dev/null
   210     if [  $O_WIN = "ON" -a "$O_TBX" = "ON" ] ; then
   211         HTML_PATH="http://${URL}${UX_D0}/nss${NSSVER}/tinderbox/tests_results/security/`basename $RESULTDIR`"
   212     else
   213         HTML_PATH="http://${URL}${RESULTDIR}"
   214     fi
   215     HREF_TMP_HTML_FILE="${HTML_PATH}/`basename $HTML_FILE`"
   217     write_qa_header_html >$TMP_HTML_FILE
   218 }
   220 ################################# html_footer #########################
   221 # local shell function, writes end of the html body
   222 #######################################################################
   223 write_qa_header_html()
   224 {
   225 echo 'Subject: QA Report ' $NSSVER $BUILDDATE '
   226 From: sonmi@iplanet.com
   227 Reply-To: sonmi@iplanet.com
   228 Content-Type: text/html; charset=us-ascii
   229 <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
   230 <html>
   231 <head>
   232    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   233    <meta name="GENERATOR" content="Mozilla/4.7 [en] (X11; U; SunOS 5.8 sun4u) [N
   234 etscape]">
   235 </head>
   236 <body>
   237 <br>
   238 &nbsp;
   239 <br>&nbsp;
   240 <h2>
   241 <a href="http://tinderbox.mozilla.org/showbuilds.cgi?tree=NSS">Tinderbox</a
   242 ><br>
   243 <a href="http://cindercone.red.iplanet.com/share/builds/mccrel3/nss/nsstip/tinderbox/tests_results/security/">Tinderbox QA&nbsp;result</a><br>
   244 <a href="ftp://ftp.mozilla.org/pub/security/nss/daily_qa">Mozilla Daily NSS QA&nbsp;result</a></h2>
   245 &nbsp;
   247 &nbsp;
   248 <br>&nbsp;
   249 <center>
   250 <h1>
   251 <a NAME="Top"></a><b><font size=+2>QA&nbsp;Results</font></b></h1></center>
   254 <table BORDER WIDTH="100%" NOSAVE >
   255 <tr>
   256 <td>&nbsp;<b><font size=+1>Build-OS and version</font></b></td>
   257 <td><b><font size=+1>QA-OS</font></b></td>
   258 <td><b><font size=+1>Systemname</font></b></td>
   259 <td><b><font size=+1>P/F</font></b></td>
   260 <td><b><font size=+1>result</font></b></td>
   261 <td><b><font size=+1>output</font></b></td>
   262 <td><b><font size=+1>errors</font></b></td>
   263 <td><b><font size=+1>QA time / #</font></b></td>
   264 </tr>
   265 '
   266 }
   268 ################################# html_footer #########################
   269 # local shell function, writes end of the html body
   270 #######################################################################
   271 html_footer()
   272 {
   273   echo '</body>'
   274   echo '</html>'
   275 }
   277 ################################# setQAsysvars #########################
   278 # local shell function, sets system specific variables
   279 ########################################################################
   280 setQAsysvars()
   281 {
   282     if [ "$MACHINE" != "0" ]
   283     then
   284         MACHINE=`echo $MACHINE | sed -e 's/^bct.//g'`
   285         TESTDATE=`ls -ld $MACHINE | awk '{ print $6, $7, $8 }'`
   286         TESTNUMBER=`echo $MACHINE | sed -e 's/.*\.//'`
   287         SYSNAME=`echo $MACHINE | sed -e 's/\..*//'`
   288         Debug "SYSNAME= $SYSNAME"
   290         if [  "$O_TBX" = "ON" -o "$O_LOCAL" = "ON" ] ; then
   291             QA_SYS_OS=$QA_OS
   292         else
   293             QA_SYS_OS=`grep $SYSNAME $PLATFORMLIST |
   294                 sed -e 's/
   295 //' | \
   296                 sort | uniq | sed  -e "s/$SYSNAME//" \
   297                 -e "s/^_//" | sort | uniq`
   298         fi
   299         Debug "QA_SYS_OS= $QA_SYS_OS"
   300     fi
   301     BUILD_SYS=`echo $BUILDPLATFORM | sed -e 's/\.OBJ//' -e 's/_DBG/ Debug/' \
   302             -e 's/_OPT/ Optimized/'  -e 's/_64/ 64bit/' -e 's/_glibc_PTH//' \
   303             -e 's/_/ /'`
   304     Debug "BUILD_SYS=$BUILD_SYS"
   305     if [ -f "${RESULTDIR}/${MACHINE}/results.html" ] ; then
   306         RESULT="${HTML_PATH}/${MACHINE}/results.html"
   307     else
   308         RESULT="0"
   309     fi
   310     if [ -f "${RESULTDIR}/bct/${MACHINE}/results.html" ] ; then
   311         BCB_RESULT="${HTML_PATH}/bct/${MACHINE}/results.html"
   312     else
   313       BCB_RESULT="0"
   314     fi
   316     if [ -f "${RESULTDIR}/${MACHINE}/output.log" ] ; then
   317         LOG="${HTML_PATH}/${MACHINE}/output.log"
   318     else
   319         LOG="0"
   320     fi
   321     if [ -f "${RESULTDIR}/bct/${MACHINE}/output.log" ] ; then
   322         BCB_LOG="${HTML_PATH}/bct/${MACHINE}/output.log"
   323     else
   324         BCB_LOG="0"
   325     fi
   326 }
   328 ################################# html_line() #########################
   329 # local shell function, writes a line in the html table
   330 ########################################################################
   331 html_line()
   332 {
   333   echo '<tr NOSAVE>'
   334   echo '<td NOSAVE>'$BUILD_SYS'</td>'
   335   echo ''
   336   if [ "$QA_SYS_OS" != "0" ] ; then
   337       echo '<td NOSAVE>'$QA_SYS_OS'</td>'
   338   else
   339       echo '<td></td>'
   340   fi
   341   echo ''
   342   if [ "$SYSNAME" != "0" ] ; then
   343       echo '<td>'$SYSNAME'</td>'
   344   else
   345       echo '<td></td>'
   346   fi
   347   #echo '<td>'$SYSNAME $TESTNUMBER $TESTDATE'</td>'
   348   echo ''
   349   # hopefully we never run more different tests on a tinderbox build...
   350   # on win some shells can not handle exit codes greater then 52 (64???)
   351   # so for very early exits the codes are set 50-45, for failures later
   352   # in the process the higher the number, the more failures
   353   if [ "$O_TBX" = "ON" -a "$TBX_EXIT" -gt 45 ] ; then
   354       TBX_EXIT=0
   355   fi
   356   if [ "$1" = "failed" ]
   357   then
   358       TBX_EXIT=`expr $TBX_EXIT + 1`
   359       echo '<td BGCOLOR='$HTML_ERRORCOLOR' NOSAVE><b>'$HTML_ERRORMSG'</b></td>'
   360   elif [ "$1" = "passed" ]
   361   then
   362       echo '<td BGCOLOR='$HTML_PASSEDCOLOR' NOSAVE>'$HTML_PASSEDMSG'</td>'
   363   elif [ "$1" = "incomplete" ]
   364   then
   365       TBX_EXIT=`expr $TBX_EXIT + 1`
   366       echo '<td BGCOLOR='$HTML_INCOMPLETECOLOR' NOSAVE>'$HTML_INCOMPLETEMSG'</td>'
   367   else
   368       TBX_EXIT=`expr $TBX_EXIT + 1`
   369       echo '<td BGCOLOR='$HTML_MISSINGCOLOR' NOSAVE>'$HTML_MISSINGMSG'</td>'    
   370   fi
   371   if [ "$CURRENT_TABLE" != "BC" ] ; then
   372       if [ "$RESULT" = "0" ] ; then
   373           echo '<td BGCOLOR='$HTML_MISSINGCOLOR' NOSAVE>'$HTML_MISSINGMSG'</td>'
   374       else
   375           echo '<td>&nbsp;<a href="'$RESULT'">result</a>&nbsp;</td>'
   376       fi
   377       if [ "$LOG" = "0" ] ; then
   378           echo '<td BGCOLOR='$HTML_MISSINGCOLOR' NOSAVE>'$HTML_MISSINGMSG'</td>'
   379       else
   380           echo '<td>&nbsp;<a href="'$LOG'">log</a>&nbsp;</td>'
   381       fi
   382       if [ "$1" = "failed" ] ; then
   383           echo '<td>&nbsp;<a href="'${HREF_TMP_HTML_FILE}'#errorlist">error</a>&nbsp;</td>'
   384       else
   385           echo '<td></td>'
   386       fi
   387   else
   388      #<td><b><font size=+1>errors</font></b></td>
   389      #<td><b><font size=+1>P/F</font></b></td>
   390      #<td><b><font size=+1>P/F</font></b></td>
   392      #echo '<td><b><font size=+1>All Current</font></b></td>'
   393      #echo '<td><b><font size=+1>old dlls</font></b></td>'
   394      #echo '<td><b><font size=+1>old executables</font></b></td>'
   395       #if [ "$RESULT" != "0" -a "$LOG" != "0" ] ; then
   396           #echo '<td><a href="'$RESULT'">result</a>, <a href="'$LOG'">log</td>'
   397       #elif [ "$RESULT" = "0" -a "$LOG" != "0" ] ; then
   398           #echo '<td BGCOLOR='$HTML_MISSINGCOLOR' NOSAVE><a href="'$LOG'">log</a></td>'
   399       #elif [ "$RESULT" != "0" -a "$LOG" = "0" ] ; then
   400           #echo '<td BGCOLOR='$HTML_MISSINGCOLOR' NOSAVE><a href="'$RESULT'">result</a></td>'
   401       #else
   402           #echo '<td BGCOLOR='$HTML_MISSINGCOLOR' NOSAVE>'$HTML_MISSINGMSG'</td>'
   403       #fi
   404       #if [ "$BCB_RESULT" != "0" -a "$BCB_LOG" != "0" ] ; then
   405           #echo '<td><a href="'$BCB_RESULT'">result</a>, <a href="'$BCB_LOG'"> log</td>'
   406       #elif [ "$BCB_RESULT" = "0" -a "$BCB_LOG" != "0" ] ; then
   407           #echo '<td BGCOLOR='$HTML_MISSINGCOLOR' NOSAVE><a href="'$BCB_LOG'">log</a></td>'
   408       #elif [ "$BCB_RESULT" != "0" -a "$BCB_LOG" = "0" ] ; then
   409           #echo '<td BGCOLOR='$HTML_MISSINGCOLOR' NOSAVE><a href="'$BCB_RESULT'">result</a></td>'
   410       #else
   411           #echo '<td BGCOLOR='$HTML_MISSINGCOLOR' NOSAVE>'$HTML_MISSINGMSG'</td>'
   412       #fi
   413       if [ "$BCB_RESULT" = "0" ] ; then
   414           echo '<td BGCOLOR='$HTML_MISSINGCOLOR' NOSAVE>'$HTML_MISSINGMSG'</td>'
   415       else
   416           echo '<td>&nbsp;<a href="'$BCB_RESULT'">result</a>&nbsp;</td>'
   417       fi
   418       if [ "$BCB_LOG" = "0" ] ; then
   419           echo '<td BGCOLOR='$HTML_MISSINGCOLOR' NOSAVE>'$HTML_MISSINGMSG'</td>'
   420       else
   421           echo '<td>&nbsp;<a href="'$BCB_LOG'">log</a>&nbsp;</td>'
   422       fi
   423   fi
   424   echo '<td>'$TESTDATE $TESTNUMBER'</td>'
   425   echo '</tr>'
   426 }
   428 ################################# qa_errorlist #########################
   429 # local shell function, finds problems in the previously run QA
   430 # linux:the gnu grep, on Linux can output 10 lines above and 3 lines below 
   431 # the errormessage
   432 ########################################################################
   433 qa_errorlist()
   434 {
   435     grep "bgcolor=red" ${MACHINES_TO_CHECK}*/results.html | 
   436         sed -e 's/.results.html:<TR><TD>/ /' -e 's/<[^>]*>/ /g'
   437     grep 'cache hits; .* cache misses, .* cache not reusable' \
   438         ${MACHINES_TO_CHECK}*/output.log | 
   439         grep strsclnt |
   440         grep -v '0 cache hits; 0 cache misses, 0 cache not reusable' | 
   441         grep -v ' cache hits; 1 cache misses, 0 cache not reusable'
   442     for logfile in ${MACHINES_TO_CHECK}*/output.log; do
   443         grep -vi "write to SSL socket" $logfile |
   444             grep -vi "HDX PR_Read returned error" |
   445             grep -vi "no error" |
   446             grep -vi "12285" |
   447             grep -i  $BEFORE_CONTEXT_GREP $AFTER_CONTEXT_GREP error 
   448             #grep -vi "5938" |  needed for -v option
   449             #grep -vi "HDX PR_Read hit EOF" | 
   450         grep  -vi "write to SSL socket" $logfile |
   451             grep -vi "peer cannot verify" |
   452             grep -vi "error" |
   453             grep -vi "fatal" |
   454             grep -vi "TCP Connection aborted" |
   455             grep -vi "TCP connection reset" |
   456             grep  $BEFORE_CONTEXT_GREP $AFTER_CONTEXT_GREP  -i failed
   457     done
   458     grep -i $BEFORE_CONTEXT_GREP $AFTER_CONTEXT_GREP "segmentation violation" \
   459         ${MACHINES_TO_CHECK}*/output.log
   460     grep -i $BEFORE_CONTEXT_GREP $AFTER_CONTEXT_GREP "memory fault" \
   461         ${MACHINES_TO_CHECK}*/output.log
   462     grep -i $BEFORE_CONTEXT_GREP $AFTER_CONTEXT_GREP "bus error" \
   463         ${MACHINES_TO_CHECK}*/output.log
   464     grep -i $BEFORE_CONTEXT_GREP $AFTER_CONTEXT_GREP "core dumped" \
   465         ${MACHINES_TO_CHECK}*/output.log
   466     grep -i $BEFORE_CONTEXT_GREP $AFTER_CONTEXT_GREP fatal \
   467         ${MACHINES_TO_CHECK}*/output.log
   468     grep -i  $BEFORE_CONTEXT_GREP $AFTER_CONTEXT_GREP -i\
   469         "PKCS12 decode not verified"   ${MACHINES_TO_CHECK}*/output.log
   471     if [ -n "${MACHINES_TO_CHECK}" ] ; then
   472         find ${MACHINES_TO_CHECK}* -name core -print 2>/dev/null |
   473             grep -v bct 
   474     else
   475         find . -name core -print 2>/dev/null |
   476             grep -v bct 
   477     fi
   478 }
   480 tbx_missing_platforms ()
   481 {
   482     QA_MISSING="QA report missing"
   483     MACHINE="0"
   485     if [ "$QA_OS_STRING" = "WINNT4.0" ] ; then
   486         QA_OS_STRING="Windows-NT-4.0"
   487     fi
   488     for BUILDPLATFORM in `grep $QA_OS_STRING $TESTSCRIPTDIR/platformlist.tbx`
   489     do
   490         if [ "$BUILDPLATFORM" != "$QA_OS_STRING" ] ; then
   491             Debug  "BUILDPLATFORM = $BUILDPLATFORM QA_OS_STRING = $QA_OS_STRING"
   492             grep $BUILDPLATFORM ${MACHINES_TO_CHECK}*/results.html \
   493                 >/dev/null || {
   494                 setQAsysvars
   495                 html_line missing >>$TMP_HTML_FILE
   496             }
   497         fi
   498     done
   499 }
   501 ############################ platform _list ###########################
   502 # local shell function, generate pass/fail information for each Platform
   503 ########################################################################
   504 platformlist()
   505 {
   506     grep Platform ${MACHINES_TO_CHECK}*/results.html | 
   507         sed -e 's/.results.html:<H4>Platform: /---/' \
   508             -e 's/<BR>//' >$TMPFILE
   509     # this is done a little complicated to avoid starting a subshell in 
   510     # a while read that gets the input from a pipeline, and variables set 
   511     #in or underneath this function get unset after done...
   512     for  MB in `cat $TMPFILE` ; do
   513         MACHINE=`echo $MB | sed -e "s/---.*//"`
   514         BUILDPLATFORM=`echo $MB | sed -e "s/.*---//"`
   515         grep "${MACHINE}[^0-9]" $ERRORLIST >/dev/null
   516         ret=$?
   517         setQAsysvars
   518         if [ $ret -eq 0 ]
   519         then
   520             echo "Failed $MACHINE $BUILDPLATFORM" >>$RFILE
   521             html_line failed >>$TMP_HTML_FILE
   522         else
   523             echo "Passed $MACHINE $BUILDPLATFORM" >>$RFILE
   524             html_line passed >>$TMP_HTML_FILE
   525         fi
   526     done 
   527 }
   529 ############################ missing_platforms ###########################
   530 # local shell function, finds out if we ran on all required platforms
   531 ########################################################################
   532 missing_platforms()
   533 {
   534     QA_MISSING="QA report missing"
   535     MACHINE="0"
   536     SYSNAME="0"
   537     QA_SYS_OS="0"
   539     for BUILDPLATFORM in `cat $TESTSCRIPTDIR/platformlist`
   540     do
   541         grep $BUILDPLATFORM $PLATFORMLIST > /dev/null || {
   542             setQAsysvars
   543             html_line missing >>$TMP_HTML_FILE
   544         }
   545     done
   546 }
   548 ############################ incomplete_results ###########################
   549 # local shell function, finds out if all qa runs were complete
   550 ########################################################################
   551 incomplete_results ()
   552 {
   554     for w in `ls ${MACHINES_TO_CHECK}*/results.html`
   555     do
   556       grep bgcolor=red $w || {
   557         PASSED_LINES=""
   558         PASSED_LINES=`grep bgcolor=lightGreen $w | wc -l`
   559         if [ -n "$PASSED_LINES" -a "$PASSED_LINES" -lt "$TOTAL_TESTS" ] ; then
   560             BUILDPLATFORM=`grep Platform $w | sed -e 's/<H4>Platform:/    /'                   -e 's/<BR>//'` 
   561             MACHINE=`echo $w | sed -e "s/.results.html//"`
   562             #MACHINE=`echo $w | sed -e "s/\.[0-9]*.results.html//"`
   563             setQAsysvars
   564             html_line incomplete >>$TMP_HTML_FILE
   565         elif [ "$PASSED_LINES" -gt "$TOTAL_TESTS" ] ; then
   566             echo "WARNING - more tests than expected on $w ($PASSED_LINES)" >>$WARNINGLIST
   567 	fi
   568       }
   569     done
   570 }
   572 qa_stat_table()
   573 {
   574     echo '&nbsp;'
   575     echo '<br>&nbsp;'
   576     echo '<center>'
   577     echo '<h1>'
   578     echo '<a NAME="'$1'"></a>'$1'</h1></center>'
   579     echo '&nbsp;'
   580     echo '<table BORDER WIDTH="100%" NOSAVE >'
   581     echo '<tr NOSAVE>'
   582 }
   584 ############################### psaperf ########################
   585 # local shell function, copies results of the daily performance test
   586 # into a table in the QA report
   587 ########################################################################
   588 rsaperf()
   589 {
   590     grep RSAPERF */output.log | grep -v "_DBG" > $PERFLIST
   592     qa_stat_table "Performance list"
   594     echo '<td NOSAVE><b><font size=+1>Build-OS and version</font></b></td>'
   595     echo '<td><b><font size=+1>Systemname</font></b></td>'
   596     echo '<td><b><font size=+1># of iterations</font></b></td>'
   597     echo '<td><b><font size=+1>average for one op</font></b></td>'
   598     echo '<td><b><font size=+1>Total</font></b></td>'
   599     echo '<td><b><font size=+1>QA time / #</font></b></td>'
   600     echo '</tr>'
   601     cat $PERFLIST | 
   602     while read MACHINE BUILDPLATFORM no_iter t1 t2 total total_unit t3 \
   603                t4 t5 average average_unit
   604     do
   605         #caution subshell, variables local to this loop
   606         BUILD_SYS=`echo $BUILDPLATFORM | sed -e 's/\.OBJ//' \
   607             -e 's/_DBG/ Debug/' \
   608             -e 's/_OPT/ Optimized/'  -e 's/_64/ 64bit/' -e 's/_glibc_PTH//' \
   609             -e 's/_/ /'`
   610         TESTNUMBER=`echo $MACHINE | sed -e 's/[^\.]*\.//' -e 's/\/.*//'`
   611         MACHINE=`echo $MACHINE | sed -e 's/\..*//'`
   612         TESTDATE=`ls -ld ${MACHINE}.${TESTNUMBER} | awk '{ print $6, $7, $8 }'`
   613         echo '<tr>'
   614         echo '<td>'$BUILD_SYS'</td>'
   615         echo ''
   616         echo '<td>'$MACHINE'</td>'
   617         echo ''
   618         echo '<td>'$no_iter'</td>'
   619         echo ''
   620         echo '<td>'$average' '$average_unit'</td>'
   621         echo ''
   622         echo '<td>'$total' '$total_unit'</td>'
   623         echo ''
   624         echo '<td>'$TESTDATE $TESTNUMBER'</td>'
   625         echo ''
   626         echo '</tr>'
   627     done
   628     echo '</table>'
   629 }
   631 ############################### qa_stat_cleanup ########################
   632 # local shell function, finishes html file, sets variables for global Exit
   633 ########################################################################
   634 qa_stat_cleanup()
   635 {
   637     html_footer >>$TMP_HTML_FILE
   639     O_DEBUG=OFF
   641     EARLY_EXIT=FALSE
   642     cp $TMP_HTML_FILE $HTML_FILE
   643     FILENAME=$HTML_FILE        #we might want to mail it...
   644     Exit
   645 }
   648 ############################### bc_test ########################
   649 # local shell function, evaluates the results of the backward u
   650 # compatibility tests
   651 ########################################################################
   652 bc_header()
   653 {
   654 CURRENT_TABLE="BC"   #so html_line can determine which fields to write
   656   qa_stat_table "Backward Compatibility Test"
   657   echo '<td NOSAVE><b><font size=+1>Build-OS and version</font></b></td>'
   658   echo '<td><b><font size=+1>QA-OS</font></b></td>'
   659   echo '<td><b><font size=+1>Systemname</font></b></td>'
   660   echo '<td><b><font size=+1>P/F</font></b></td>'
   661   #echo '<td><b><font size=+1>All Current</font></b></td>'
   662   #echo '<td><b><font size=+1>backward comp. test</font></b></td>'
   663   echo '<td><b><font size=+1>result</font></b></td>'
   664   echo '<td><b><font size=+1>output</font></b></td>'
   665   echo '<td><b><font size=+1>QA time / #</font></b></td>'
   666   echo '</tr>'
   668 }
   670 old_bc_test()
   671 {
   672 CURRENT_TABLE="BC"   #so html_line can determine which fields to write
   674   qa_stat_table "Backward Compatibility Test"
   675   echo '<td NOSAVE><b><font size=+1>Build-OS and version</font></b></td>'
   676   echo '<td><b><font size=+1>QA-OS</font></b></td>'
   677   echo '<td><b><font size=+1>Systemname</font></b></td>'
   678   echo '<td><b><font size=+1>P/F</font></b></td>'
   679   #echo '<td><b><font size=+1>All Current</font></b></td>'
   680   #echo '<td><b><font size=+1>backward comp. test</font></b></td>'
   681   echo '<td><b><font size=+1>result</font></b></td>'
   682   echo '<td><b><font size=+1>output</font></b></td>'
   683   echo '<td><b><font size=+1>QA time / #</font></b></td>'
   684   echo '</tr>'
   686   for w in `ls */results.html`
   687   do
   688       TMP_RESULT="`dirname $w`/results.tmp"
   689       TMP_BC_RESULT="`dirname bct/$w`/results.tmp"
   690       rm $TMP_RESULT $TMP_BC_RESULT 2>/dev/null
   691       cat $w | sed -e 's/<[^>]*>//g'  -e 's/ /_/g' \
   692                    -e 's/signtool_-[vw]/signtool_-vw/' |
   693                grep '_[PF]a[si][sl]ed' >$TMP_RESULT
   694       cat bct/$w   | sed -e 's/<[^>]*>//g'  -e 's/ /_/g' \
   695                          -e 's/signtool_-[vw]/signtool_-vw/' |
   696                      grep '_[PF]a[si][sl]ed' >$TMP_BC_RESULT
   697       diff $TMP_RESULT $TMP_BC_RESULT    2>>$BCMISSINGLIST |
   698            grep -v "Create_objsign_cert_.signtool_-G.*Passed" |
   699            grep -v "porting_Alice.s_email_cert" |
   700            grep -v "^[0-9,cad]*$" | grep -v "^---$" | grep -v "^---.$" |
   701            grep -v "Can.t_run_pk12util_tests_for_NSS_3.2"  >/dev/null && (
   702                 echo "$w differs" >> $BCMISSINGLIST
   703                 echo "========================================="
   704                 echo "diff $w bct/$w"
   705                 echo "========================================="
   706                 diff $TMP_RESULT $TMP_BC_RESULT 2>&1 |
   707                      grep -v "Create_objsign_cert_.signtool_-G.*Passed" |
   708                      grep -v "porting_Alice.s_email_cert" |
   709                      grep -v "Can.t_run_pk12util_tests_for_NSS_3.2"  
   710            )  2>&1 >>$BCERRORLIST
   712       #diff -b $w bct/$w  2>>$BCMISSINGLIST | 
   713            #grep -v "Create objsign cert .signtool -G.*Passed" |
   714            #grep -v "Listing signed files in jar .signtool -v.*Passed" |
   715            #grep -v "Listing signed files in jar .signtool -w.*Passed" |
   716            #grep -v "backward compatibility" |
   717            #grep -v "Can.t run pk12util tests for NSS 3.2" |
   718            #grep -v "porting Alice.s email cert " |
   719            #grep -v "^---$" | grep -v "^[<> ] $" | 
   720            #grep -v "^---.$" | grep -v "^[<> ] .$" | 
   721            #grep -v '< </BODY></HTML>' |
   722            #grep -v "^[0-9,cad]*$" 2>>$BCMISSINGLIST >/dev/null &&  (
   723                 #echo "$w differs" >> $BCMISSINGLIST
   724                 #echo "========================================="
   725                 #echo "diff $w bct/$w"
   726                 #echo "========================================="
   727                 #diff -b $w bct/$w 2>&1 | 
   728                      #grep -v "Listing signed files in jar .signtool -v.*Passed" |
   729                      #grep -v "Listing signed files in jar .signtool -w.*Passed" |
   730                      #grep -v "backward compatibility" |
   731                      #grep -v "Can.t run pk12util tests for NSS 3.2" |
   732                      #grep -v "porting Alice.s email cert " |
   733                      #grep -v "^---$" | grep -v "^[<> ] $" | 
   734                      #grep -v "^---.$" | grep -v "^[<> ] .$" | 
   735                      #grep -v '< </BODY></HTML>' |
   736                      #grep -v "^[0-9,cad]*$" \
   737            #)  2>&1 >>$BCERRORLIST
   738       rm $TMP_RESULT $TMP_BC_RESULT 2>/dev/null
   739   done
   740   rm $ERRORLIST
   741   cat $BCMISSINGLIST | sed -e "s/^diff: bc_...s.//" \
   742                     -e "s/.results.html.*/\/results.html/" | 
   743                 sort -u > $ERRORLIST
   745   platformlist  
   746   echo '</table>' >>$TMP_HTML_FILE
   748   head -200 $BCERRORLIST | sed -e 's/<[^>]*>//g' -e "s/^/<br>/" 
   749 }
   751 bc_test()
   752 {
   753 CURRENT_TABLE="BC"   #so html_line can determine which fields to write
   755   qa_stat_table "Backward Compatibility Test"
   756   echo '<td NOSAVE><b><font size=+1>Build-OS and version</font></b></td>'
   757   echo '<td><b><font size=+1>QA-OS</font></b></td>'
   758   echo '<td><b><font size=+1>Systemname</font></b></td>'
   759   echo '<td><b><font size=+1>P/F</font></b></td>'
   760   #echo '<td><b><font size=+1>All Current</font></b></td>'
   761   #echo '<td><b><font size=+1>backward comp. test</font></b></td>'
   762   echo '<td><b><font size=+1>result</font></b></td>'
   763   echo '<td><b><font size=+1>output</font></b></td>'
   764   echo '<td><b><font size=+1>QA time / #</font></b></td>'
   765   echo '</tr>'
   767 set -x
   768   for w in `ls */results.html`
   769   do
   770       BCT_DIR=`dirname "bct/$w"`
   771       BCT_RESULT="bct/$w"
   772       BCT_LOG="$BCT_DIR/output.log"
   773       grep "bgcolor=red" $BCT_RESULT | 
   774            sed -e 's/.results.html:<TR><TD>/ /' -e 's/<[^>]*>/ /g'
   775       grep 'cache hits; .* cache misses, .* cache not reusable' \
   776         $BCT_LOG |
   777         grep -v selfserv |
   778         grep -v '0 cache hits; 1 cache misses, 0 cache not reusable' |
   779         grep -v '0 cache hits; 0 cache misses, 0 cache not reusable' |
   780         grep -v ' cache hits; 1 cache misses, 0 cache not reusable'
   781       grep -vi "write to SSL socket" $BCT_LOG |
   782         grep -vi "HDX PR_Read returned error" |
   783         grep -vi "no error" |
   784         grep -vi "12285" |
   785         grep -i  $BEFORE_CONTEXT_GREP $AFTER_CONTEXT_GREP error
   786       grep  -vi "write to SSL socket" $BCT_LOG |
   787         grep -vi "peer cannot verify" |
   788         grep -vi "TCP Connection aborted" |
   789         grep -vi "error" |
   790         grep -vi "fatal" |
   791         grep -vi "TCP connection reset" |
   792         grep  $BEFORE_CONTEXT_GREP $AFTER_CONTEXT_GREP  -i failed $BCT_LOG
   793       grep -i $BEFORE_CONTEXT_GREP $AFTER_CONTEXT_GREP "segmentation violation"  $BCT_LOG
   794       grep -i $BEFORE_CONTEXT_GREP $AFTER_CONTEXT_GREP "memory fault" $BCT_LOG
   795       grep -i $BEFORE_CONTEXT_GREP $AFTER_CONTEXT_GREP "bus error" $BCT_LOG
   796       grep -i $BEFORE_CONTEXT_GREP $AFTER_CONTEXT_GREP "core dumped" $BCT_LOG
   797       grep -i $BEFORE_CONTEXT_GREP $AFTER_CONTEXT_GREP fatal  $BCT_LOG
   798       grep -i  $BEFORE_CONTEXT_GREP $AFTER_CONTEXT_GREP -i "PKCS12 decode not verified"   $BCT_LOG
   799       find ${BTC_DIR} -name core -print
   801   done 2>&1 >>$BCERRORLIST
   802   rm $ERRORLIST
   803   cat $BCMISSINGLIST | sed -e "s/^diff: bc_...s.//" \
   804                     -e "s/.results.html.*/\/results.html/" | 
   805                 sort -u > $ERRORLIST
   807   platformlist  
   808   echo '</table>' >>$TMP_HTML_FILE
   810   head -200 $BCERRORLIST | sed -e 's/<[^>]*>//g' -e "s/^/<br>/" 
   811 }
   814 ############################### bc_test ########################
   815 # local shell function, evaluates the results of the backward u
   816 # compatibility tests
   817 # move the whole function to old to tests a new solution
   818 ########################################################################
   819 bc_test_old()
   820 {
   821 CURRENT_TABLE="BC"   #so html_line can determine which fields to write
   823   qa_stat_table "Backward Compatibility Test"
   824   echo '<td NOSAVE><b><font size=+1>Build-OS and version</font></b></td>'
   825   echo '<td><b><font size=+1>QA-OS</font></b></td>'
   826   echo '<td><b><font size=+1>Systemname</font></b></td>'
   827   echo '<td><b><font size=+1>P/F</font></b></td>'
   828   #echo '<td><b><font size=+1>All Current</font></b></td>'
   829   #echo '<td><b><font size=+1>backward comp. test</font></b></td>'
   830   echo '<td><b><font size=+1>result</font></b></td>'
   831   echo '<td><b><font size=+1>output</font></b></td>'
   832   echo '<td><b><font size=+1>QA time / #</font></b></td>'
   833   echo '</tr>'
   835   for w in `ls */results.html`
   836   do
   837       diff -b $w bct/$w  2>>$BCMISSINGLIST | 
   838            grep -v "Create objsign cert .signtool -G.*Passed" |
   839            grep -v "Listing signed files in jar .signtool -v.*Passed" |
   840            grep -v "Listing signed files in jar .signtool -w.*Passed" |
   841            grep -v "backward compatibility" |
   842            grep -v "Can.t run pk12util tests for NSS 3.2" |
   843            grep -v "porting Alice.s email cert " |
   844            grep -v "^---$" | grep -v "^[<> ] $" | 
   845            grep -v "^---.$" | grep -v "^[<> ] .$" | 
   846            grep -v '< </BODY></HTML>' |
   847            grep -v "^[0-9,cad]*$" 2>>$BCMISSINGLIST >/dev/null &&  (
   848                 echo "$w differs" >> $BCMISSINGLIST
   849                 echo "========================================="
   850                 echo "diff $w bct/$w"
   851                 echo "========================================="
   852                 diff -b $w bct/$w 2>&1 | 
   853                      grep -v "Listing signed files in jar .signtool -v.*Passed" |
   854                      grep -v "Listing signed files in jar .signtool -w.*Passed" |
   855                      grep -v "backward compatibility" |
   856                      grep -v "Can.t run pk12util tests for NSS 3.2" |
   857                      grep -v "porting Alice.s email cert " |
   858                      grep -v "^---$" | grep -v "^[<> ] $" | 
   859                      grep -v "^---.$" | grep -v "^[<> ] .$" | 
   860                      grep -v '< </BODY></HTML>' |
   861                      grep -v "^[0-9,cad]*$" \
   862            )  2>&1 >>$BCERRORLIST
   863   done
   864   rm $ERRORLIST
   865   cat $BCMISSINGLIST | sed -e "s/^diff: bc_...s.//" \
   866                     -e "s/.results.html.*/\/results.html/" | 
   867                 sort -u > $ERRORLIST
   869   platformlist  
   870   echo '</table>' >>$TMP_HTML_FILE
   872   head -200 $BCERRORLIST | sed -e 's/<[^>]*>//g' -e "s/^/<br>/" 
   874 }
   876 ############################### tbx_main ########################
   877 # local shell function, tinderbox variation of the qa status script
   878 ########################################################################
   879 tbx_main()
   880 {
   881     TBX_EXIT=47
   882     qa_stat_get_sysinfo # find out the OS we are running and all required tests
   883                         # on this OS
   885     MACHINES_TO_CHECK=$HOST  #`uname -n` only search the local tests for errors
   886     qa_errorlist > $ERRORLIST        # 
   887     platformlist 
   888     #tbx_missing_platforms  #temp. taken out until we find a better way to
   889     #determine if all necessary QA ran - right now we run different 
   890     #tinderboxes on one machine
   891     incomplete_results 
   892     echo '</table>' >>$TMP_HTML_FILE
   893     echo '<a NAME="errorlist"></a>' >> $TMP_HTML_FILE
   894     cat $ERRORLIST  | sed -e "s/^/<br>/" >>$TMP_HTML_FILE
   896 }
   898 ############################### qa_stat_main ########################
   899 # local shell function, main flow of the qa status script
   900 ########################################################################
   901 qa_stat_main()
   902 {
   903     find_qa_systems 2>/dev/null
   904     MACHINES_TO_CHECK=""   # check all founf qa runs
   905     qa_errorlist > $ERRORLIST
   906     platformlist 
   907     missing_platforms 
   908     incomplete_results 
   909     echo '</table>' >>$TMP_HTML_FILE
   910     echo '<a NAME="errorlist"></a>' >> $TMP_HTML_FILE
   911     cat $ERRORLIST  | sed -e "s/^/<br>/" >>$TMP_HTML_FILE
   912     cat $WARNINGLIST 2>/dev/null | sed -e "s/^/<br>/" >>$TMP_HTML_FILE 2>/dev/null
   913     rsaperf >>$TMP_HTML_FILE
   914     bc_header >>$TMP_HTML_FILE
   915     MACHINES_TO_CHECK="bct/"
   916     TOTAL_TESTS=$BCT_TOTAL_TESTS
   917     BEFORE_CONTEXT_GREP="" #WORKAROUND - errors in one outputlog within the first 
   918     AFTER_CONTEXT_GREP=""  # or last lines will show up in the next/previos file
   919     qa_errorlist > $ERRORLIST
   920     platformlist 
   921     missing_platforms 
   922     incomplete_results 
   923     echo '</table>' >>$TMP_HTML_FILE
   924     echo '<a NAME="errorlist"></a>' >> $TMP_HTML_FILE
   925     cat $ERRORLIST  | sed -e "s/^/<br>/" >>$TMP_HTML_FILE
   926     cat $WARNINGLIST 2>/dev/null | sed -e "s/^/<br>/" >>$TMP_HTML_FILE 2>/dev/null
   927     #bc_test >>$TMP_HTML_FILE
   928 }
   930 CURRENT_TABLE="Standard"
   931 qa_stat_init
   933 if [  "$O_TBX" = "ON" -o "$O_LOCAL" = "ON" ] ; then
   934     tbx_main
   935 else
   936     qa_stat_main
   937 fi
   939 qa_stat_cleanup

mercurial