Blame nss/tests/nssqa

Packit 40b132
#! /bin/sh
Packit 40b132
Packit 40b132
########################################################################
Packit 40b132
#
Packit 40b132
# /u/sonmi/bin/nssqa - /u/svbld/bin/init/nss/nssqa
Packit 40b132
#
Packit 40b132
# this script is supposed to automatically run QA for NSS on all required
Packit 40b132
# Unix and Windows (NT and 2000) platforms
Packit 40b132
#
Packit 40b132
# parameters
Packit 40b132
# ----------
Packit 40b132
#   nssversion  (supported: 30b, 31, tip)
Packit 40b132
#   builddate   (default - today)
Packit 40b132
#
Packit 40b132
# options
Packit 40b132
# -------
Packit 40b132
#   -y answer all questions with y - use at your own risk...ignores warnings
Packit 40b132
#   -s silent (only usefull with -y)
Packit 40b132
#   -h, -? - you guessed right - displays this text
Packit 40b132
#   -d debug
Packit 40b132
#   -f <filename> - write the (error)output to filename
Packit 40b132
#   -cron equivalient to -y -s -d -f $RESULTDIR/$HOST.nssqa
Packit 40b132
# 
Packit 40b132
# 12/1/00
Packit 40b132
# took out the (unused) local directory for releasebuild QA on NT
Packit 40b132
# cleaned up 32 - 64 bit issues
Packit 40b132
# took hardcoded machinenames out
Packit 40b132
########################################################################
Packit 40b132
Packit 40b132
O_OPTIONS=ON            # accept options (see above for listing)
Packit 40b132
WIN_WAIT_FOREVER=ON     # first we wait forever for a TESTDIR to appear, than 
Packit 40b132
                        # we wait forever for the build to finish...
Packit 40b132
Packit 40b132
TBX_EXIT=50             # in case we are running on a tinderbox build, any 
Packit 40b132
                        # early exit needs to return an error
Packit 40b132
. `dirname $0`/header   # utilities, shellfunctions etc, global to NSS QA
Packit 40b132
Packit 40b132
if [ -z "$O_TBX" -o "$O_TBX" != "ON" ] ; then
Packit 40b132
    is_running ${TMP}/nssqa 
Packit 40b132
                        # checks if the file exists, if yes Exits, if not 
Packit 40b132
                        # creates to implement a primitive locking mechanism
Packit 40b132
fi
Packit 40b132
Packit 40b132
KILL_SELFSERV=OFF       # cleanup will also kill the leftover selfserv processes
Packit 40b132
Packit 40b132
################################ check_distdir #########################
Packit 40b132
# local shell function to check if the DIST directory exists, if not there 
Packit 40b132
# is no use to continue the test
Packit 40b132
########################################################################
Packit 40b132
check_distdir()
Packit 40b132
{
Packit 40b132
    set_objdir
Packit 40b132
Packit 40b132
    if [ ! -d "$LOCALDIST_BIN" ]
Packit 40b132
    then
Packit 40b132
        Debug "Dist $DIST"
Packit 40b132
        Warning "$LOCALDIST_BIN (the dist binaries dir) does not exist"
Packit 40b132
        return 1
Packit 40b132
    fi
Packit 40b132
Packit 40b132
    if [ ! -d "$LOCALDIST" -a ! -h "$LOCALDIST" ]
Packit 40b132
    then
Packit 40b132
        Debug "Dist $DIST"
Packit 40b132
        Warning "$LOCALDIST (the dist directory) does not exist"
Packit 40b132
        return 1
Packit 40b132
    fi
Packit 40b132
Packit 40b132
    Debug "LOCALDIST_BIN $LOCALDIST_BIN"
Packit 40b132
    Debug "Dist $DIST"
Packit 40b132
    return 0
Packit 40b132
}
Packit 40b132
Packit 40b132
################################ run_all ###############################
Packit 40b132
# local shell function to start the all.sh after asking user and redirect 
Packit 40b132
# the output apropriately
Packit 40b132
########################################################################
Packit 40b132
run_all()        
Packit 40b132
{
Packit 40b132
    check_distdir || return 1
Packit 40b132
    #kill_by_name selfserv
Packit 40b132
    ask "Testing $OBJDIR continue with all.sh" "y" "n" || Exit
Packit 40b132
Packit 40b132
    Debug "running all.sh in `pwd`"
Packit 40b132
    if [ $O_SILENT = ON ]
Packit 40b132
    then
Packit 40b132
        if [ $O_DEBUG = ON -a $O_FILE = ON ]
Packit 40b132
        then
Packit 40b132
            all.sh >>$FILENAME 2>>$FILENAME
Packit 40b132
        else
Packit 40b132
            all.sh >/dev/null 2>/dev/null
Packit 40b132
        fi
Packit 40b132
    else
Packit 40b132
        all.sh
Packit 40b132
    fi
Packit 40b132
    Debug "Done with all.sh "
Packit 40b132
    line
Packit 40b132
}
Packit 40b132
Packit 40b132
all_sh()
Packit 40b132
{
Packit 40b132
    echo
Packit 40b132
}
Packit 40b132
Packit 40b132
Packit 40b132
########################### wait_for_build #############################
Packit 40b132
# local shell function to wait until the build is finished
Packit 40b132
########################################################################
Packit 40b132
wait_for_build()
Packit 40b132
{
Packit 40b132
  if [ $O_WIN = "ON" ]
Packit 40b132
  then
Packit 40b132
      WaitForever ${OSDIR}/SVbuild.InProgress.1 0 
Packit 40b132
                     #Wait for the build to finish Windows a lot longer
Packit 40b132
      OS_TARGET=WINNT;export OS_TARGET;Debug "OS_TARGET set to $OS_TARGET"
Packit 40b132
      QA_OS_NAME=`cd ${TESTSCRIPTDIR}/common; gmake objdir_name | \
Packit 40b132
          sed -e "s/WINNT4.0.*/Windows-NT-4.0/" -e "s/WINNT5.0.*/Windows-2000/"`
Packit 40b132
      Echo "WINDOWS-OS-LINE: $QA_OS_NAME"
Packit 40b132
  else
Packit 40b132
      Wait ${OSDIR}/SVbuild.InProgress.1 0     
Packit 40b132
                     #Wait for the build to finish... Unix a few hours
Packit 40b132
      qa_stat_get_sysinfo
Packit 40b132
      Echo "UNIX-OS-LINE: $QA_OS"
Packit 40b132
  fi
Packit 40b132
  find_nt_masterbuild
Packit 40b132
}
Packit 40b132
Packit 40b132
Packit 40b132
########################### map_os #############################
Packit 40b132
# local shell function: From the operatingsystem figure out the name of 
Packit 40b132
#     the build ; needed to detemine if the build finished, passed and for
Packit 40b132
#     the directory names
Packit 40b132
########################################################################
Packit 40b132
map_os32()
Packit 40b132
{
Packit 40b132
    case `uname -s` in
Packit 40b132
        SunOS)
Packit 40b132
            S_REL=`uname -r | sed -e "s/^[^\.]*\.//g"`
Packit 40b132
            if [ `uname -p` = "i386" ] ; then
Packit 40b132
                MAPPED_OS=Solaris8_x86
Packit 40b132
            elif [ "$S_REL" -lt 8 ] ; then
Packit 40b132
                MAPPED_OS=Solaris2.6
Packit 40b132
            else
Packit 40b132
                MAPPED_OS=Solaris8_forte6
Packit 40b132
            fi
Packit 40b132
            ;;
Packit 40b132
        OSF1)
Packit 40b132
            MAPPED_OS=OSF1V4.0
Packit 40b132
            ;;
Packit 40b132
        Darwin)
Packit 40b132
            MAPPED_OS=Darwin6.5
Packit 40b132
            ;;	
Packit 40b132
        AIX)
Packit 40b132
            MAPPED_OS=AIX4.3
Packit 40b132
            ;;
Packit 40b132
        Linux)
Packit 40b132
            RH_MR=`cat /etc/redhat-release | sed \
Packit 40b132
                -e "s/Red Hat Linux release //" -e "s/ .*//g" \
Packit 40b132
                -e "s/\..*//g"`
Packit 40b132
            
Packit 40b132
            if [ "$RH_MR" = "6" ] ; then
Packit 40b132
                MAPPED_OS=Linux2.2
Packit 40b132
            else
Packit 40b132
                MAPPED_OS=Linux2.4
Packit 40b132
                LD_ASSUME_KERNEL="2.2.5"
Packit 40b132
                export LD_ASSUME_KERNEL
Packit 40b132
            fi
Packit 40b132
            ;;
Packit 40b132
        HP-UX)
Packit 40b132
            MAPPED_OS=HPUX11.00
Packit 40b132
            ;;
Packit 40b132
        *)
Packit 40b132
            if [ "$os_name" = "Windows" ]
Packit 40b132
            then
Packit 40b132
                MAPPED_OS=NT4.0
Packit 40b132
            else
Packit 40b132
                Exit "Sorry, operating system `uname -s` is not supported yet"
Packit 40b132
            fi
Packit 40b132
            ;;
Packit 40b132
    esac
Packit 40b132
    set_osdir
Packit 40b132
    Debug "Mapped OS to $MAPPED_OS"
Packit 40b132
}
Packit 40b132
Packit 40b132
############################# nssqa_main ###############################
Packit 40b132
# local shell function main controlling function of the nss qa
Packit 40b132
########################################################################
Packit 40b132
nssqa_main()
Packit 40b132
{
Packit 40b132
  Debug "In function nssqa_main"
Packit 40b132
Packit 40b132
  if [ $O_WIN = "OFF" -a "$O_TBX" = "OFF" -a $O_LOCAL = "OFF" ] ; then
Packit 40b132
      if [ ! -h ${NTDIST}/WINNT5.0_DBG.OBJ -o \
Packit 40b132
              ! -h ${UXDIST}/SunOS5.8_OPT.OBJ -o \
Packit 40b132
              ! -h ${UXDIST}/OSF1V5.0_DBG.OBJ ] ; then
Packit 40b132
          # determine if all needed symbolic links are present, in case
Packit 40b132
          # we build on one platform and QA on another
Packit 40b132
          # create the symbolic links
Packit 40b132
          #mksymlinks $* ||
Packit 40b132
          `dirname $0`/mksymlinks  $NSSVER $BUILDDATE ||
Packit 40b132
              Warning "Can't make the neccessary symbolic links"
Packit 40b132
      fi
Packit 40b132
  fi
Packit 40b132
Packit 40b132
  if [ -d $TESTSCRIPTDIR ]    #the directory mozilla/security/nss/tests, 
Packit 40b132
  then            # where all.sh lives
Packit 40b132
      cd $TESTSCRIPTDIR
Packit 40b132
  else
Packit 40b132
      Exit "cant cd to $TESTSCRIPTDIR Exiting"
Packit 40b132
  fi
Packit 40b132
Packit 40b132
  Debug "Testing from `pwd`"
Packit 40b132
  line
Packit 40b132
  Debug "HOST: $HOST, DOMSUF: $DOMSUF"
Packit 40b132
Packit 40b132
  if [  "$O_TBX" = "OFF" ] ; then
Packit 40b132
      map_os32 # From the operatingsystem figure out the name of the build 
Packit 40b132
      Debug Testing build for $MAPPED_OS in $OSDIR
Packit 40b132
      wait_for_build
Packit 40b132
  fi
Packit 40b132
  run_all
Packit 40b132
  BUILD_OPT=1; export BUILD_OPT; Debug "BUILD_OPT $BUILD_OPT"
Packit 40b132
  run_all
Packit 40b132
  
Packit 40b132
  # now for the 64 bit build!
Packit 40b132
  map_os64 # From the operatingsystem figure out the name of the build 
Packit 40b132
  if [ -n "$IS_64" ] ; then #Wait for the 64 bit build to finish...
Packit 40b132
      Debug "This is a $IS_64 platform"
Packit 40b132
      USE_64=1;export USE_64;Debug "Use_64 set to $USE_64"
Packit 40b132
      unset BUILD_OPT;export BUILD_OPT;Debug "BUILD_OPT $BUILD_OPT"
Packit 40b132
Packit 40b132
      run_all
Packit 40b132
      BUILD_OPT=1; export BUILD_OPT; Debug "BUILD_OPT $BUILD_OPT"
Packit 40b132
      run_all
Packit 40b132
  elif [ "$O_WIN" = "ON" ] ; then
Packit 40b132
      OS_TARGET=WIN95;export OS_TARGET
Packit 40b132
      Debug "OS_TARGET set to $OS_TARGET"
Packit 40b132
      #Echo "WINDOWS-OS-LINE: $os_name $os_full $OS_TARGET"
Packit 40b132
      unset BUILD_OPT;export BUILD_OPT;Debug "BUILD_OPT $BUILD_OPT"
Packit 40b132
      #if [ "$TEST_LEVEL" = "0" ] ; then
Packit 40b132
          #QA_OS_NAME=`cd ${TESTSCRIPTDIR}/common; gmake objdir_name | \
Packit 40b132
              #sed -e "s/WINNT4.0.*/Windows-NT-4.0/" -e \
Packit 40b132
                     #"s/WINNT5.0.*/Windows-2000/"`
Packit 40b132
          #Echo "WINDOWS-OS-LINE: $QA_OS_NAME $OS_TARGET"
Packit 40b132
      #fi
Packit 40b132
      run_all
Packit 40b132
      BUILD_OPT=1; export BUILD_OPT; Debug "BUILD_OPT $BUILD_OPT"
Packit 40b132
      run_all
Packit 40b132
  else
Packit 40b132
      Debug "This is a 32 bit platform"
Packit 40b132
  fi
Packit 40b132
}
Packit 40b132
  
Packit 40b132
TEST_LEVEL=0
Packit 40b132
Packit 40b132
while [ $TEST_LEVEL -lt 2 ] ; do 
Packit 40b132
    export TEST_LEVEL
Packit 40b132
    unset BUILD_OPT;export BUILD_OPT;Debug "BUILD_OPT $BUILD_OPT"
Packit 40b132
    unset USE_64;export USE_64;Debug "USE_64 $USE_64"
Packit 40b132
    bc $TEST_LEVEL
Packit 40b132
    Debug "About to start nssqa_main"
Packit 40b132
    if [ $O_FILE = ON -a "$O_WIN" != "ON" ] ; then
Packit 40b132
        nssqa_main 2>>$FILENAME
Packit 40b132
    else
Packit 40b132
        nssqa_main
Packit 40b132
    fi
Packit 40b132
    if [  "$O_TBX" = "ON" ] ; then      # do not do backward compatibility 
Packit 40b132
         TEST_LEVEL=3                   # testing on tinderbox
Packit 40b132
    else
Packit 40b132
         TEST_LEVEL=`expr $TEST_LEVEL + 1 `
Packit 40b132
    fi
Packit 40b132
done
Packit 40b132
Packit 40b132
if [  "$O_TBX" = "ON" -o "$O_LOCAL" = "ON" ] ; then
Packit 40b132
#FIXME - maybe it should be copied back to the networkdrive later (-ln)
Packit 40b132
    if [ -n "${TMPFILES}" ] ; then #caused problems on tinderbox machines
Packit 40b132
        Debug "rm -f ${TMPFILES}"
Packit 40b132
        rm -f $TMPFILES 2>/dev/null
Packit 40b132
    fi
Packit 40b132
    Debug "running qa_stat"
Packit 40b132
    . `dirname $0`/qa_stat
Packit 40b132
fi
Packit 40b132
Packit 40b132
  
Packit 40b132
qa_stat_get_sysinfo
Packit 40b132
Packit 40b132
Exit "nssqa completed. Done `uname -n` $QA_OS_STRING"