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