michael@0: #! /bin/sh michael@0: michael@0: ######################################################################## michael@0: # michael@0: # /u/sonmi/bin/jssqa michael@0: # michael@0: # this script is supposed to automatically run - now a sanity test, later QA for michael@0: # JSS on all required Unix and Windows (NT and 2000) platforms michael@0: # michael@0: # parameters michael@0: # ---------- michael@0: # jssversion (supported: 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: ######################################################################## michael@0: michael@0: O_OPTIONS=ON # accept options (see above for listing) michael@0: WIN_WAIT_FOREVER=OFF # don't wait for the NSS testdir michael@0: PRODUCT_TO_TEST="JSS" michael@0: JSS_NSPR_DIR="/share/builds/components/nspr20/v4.1.2" michael@0: JSS_NSS_DIR="/share/builds/components/nss/NSS_3_3_1_RTM" michael@0: JSS_NSS_UX_SRC_DIR="nss331/builds/20010928.2.331-RTM/booboo_Solaris8" michael@0: JSS_NSS_NT_SRC_DIR="nss331/builds/20010928.2.331-RTM/blowfish_NT4.0_Win95" michael@0: JSS_NSS_SRC_DIR=$JSS_NSS_UX_SRC_DIR michael@0: NATIVE_FLAG="" michael@0: michael@0: . `dirname $0`/header # utilities, shellfunctions etc, global to NSS and JSS QA michael@0: michael@0: if [ -z "$O_TBX" -o "$O_TBX" != "ON" ] ; then michael@0: is_running ${TMP}/jssqa 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: INTERNAL_TOKEN="NSS Certificate DB" michael@0: SIGTEST_INTERNAL_TOKEN="Internal Key Storage Token" michael@0: michael@0: ################################ jss_init ######################### michael@0: # michael@0: # Most of the procedure is setting up the test environment. michael@0: # set all necessary dir and file variables, set all paths, copy the shared libs michael@0: # Put all the shared libraries into a lib directory, . michael@0: # including the libjss3.so that was built by the build process. michael@0: # set LD_LIBRARY PATH and CLASSPATH michael@0: # The xpclass.jar produced by the JSS build needs to be in the classpath. michael@0: # The classpath must also include the current directory so we can run our test michael@0: # programs. michael@0: ################################################################################ michael@0: michael@0: jss_init() michael@0: { michael@0: Debug "Jss init" michael@0: #correct all directories that the header has set... michael@0: NTDIST=`echo $NTDIST | sed -e 's/nss/jss/g'` michael@0: UXDIST=`echo $UXDIST | sed -e 's/nss/jss/g'` michael@0: RESULTDIR=`echo $RESULTDIR | sed -e 's/nss/jss/g'` michael@0: mkdir -p ${RESULTDIR} 2>/dev/null michael@0: JSS_LOGFILE=${RESULTDIR}/${HOST}.txt michael@0: FILENAME=$JSS_LOGFILE michael@0: O_FILE=ON michael@0: michael@0: MOZILLA_ROOT=`echo $MOZILLA_ROOT | sed -e 's/nss/jss/g'` michael@0: michael@0: JSS_SAMPLES="$MOZILLA_ROOT/security/jss/samples" michael@0: JSS_CLASSPATH=`echo $MOZILLA_ROOT | michael@0: sed -e "s/jss$NSSVER.builds/jss$NSSVER\/ships/g" -e "s/mozilla/jss\/${QAYEAR}${BUILDDATE}/"` michael@0: Debug "JSS_CLASSPATH=$JSS_CLASSPATH" michael@0: Debug "JSS_SAMPLES=$JSS_SAMPLES" michael@0: michael@0: if [ ! -d $JSS_SAMPLES ] ; then michael@0: if [ "$O_WIN" = "ON" -a "$WIN_WAIT_FOREVER" = "ON" ] michael@0: then michael@0: WaitForever $JSS_SAMPLES/TestKeyGen.java 1 michael@0: else michael@0: Exit "Test directory $JSS_SAMPLES does not exist" michael@0: fi michael@0: fi michael@0: michael@0: PWFILE="$JSS_SAMPLES/passwd" michael@0: EMPTYFILE="$JSS_SAMPLES/emptyfile" michael@0: rm $PWFILE $EMPTYFILE 2>/dev/null michael@0: echo "jss" >$PWFILE michael@0: echo "" >$EMPTYFILE michael@0: echo "" >>$EMPTYFILE michael@0: echo "" >>$EMPTYFILE michael@0: michael@0: INIT_PATH=$PATH michael@0: INIT_LD_LIBRARY_PATH=$LD_LIBRARY_PATH michael@0: } michael@0: michael@0: michael@0: jss_mode_init() michael@0: { michael@0: OBJDIR=`cd ${TESTSCRIPTDIR}/common; gmake objdir_name` michael@0: michael@0: LOCALDIST_BIN=`echo $LOCALDIST_BIN | sed -e 's/nss/jss/g'` michael@0: LOCALDIST_LIB=$LOCALDIST_BIN/../lib michael@0: debug_dirs michael@0: michael@0: #make testdir/libdir michael@0: michael@0: JSS_LIBDIR=${RESULTDIR}/${HOST}.libdir/${OBJDIR} michael@0: mkdir -p ${JSS_LIBDIR} 2>/dev/null michael@0: Debug "JSS_LIBDIR=$JSS_LIBDIR" michael@0: michael@0: #Put all the shared libraries into a lib directory michael@0: Debug "copy all needed libs to ${JSS_LIBDIR}" michael@0: cp $JSS_NSPR_DIR/${OBJDIR}/lib/* ${JSS_LIBDIR} michael@0: cp $JSS_NSS_DIR/${OBJDIR}/lib/* ${JSS_LIBDIR} michael@0: cp $LOCALDIST_LIB/libjss3.* ${JSS_LIBDIR} michael@0: #FIXME uncomment above michael@0: michael@0: if [ $O_DEBUG = ON ] ; then michael@0: Debug "ls $JSS_LIBDIR" michael@0: ls $JSS_LIBDIR michael@0: fi michael@0: michael@0: #LD_LIBRARY_PATH=$INIT_LD_LIBRARY_PATH:${JSS_LIBDIR} michael@0: LD_LIBRARY_PATH=${JSS_LIBDIR} #remove to avoid HP coredump michael@0: CLASSPATH="$JSS_CLASSPATH/xpclass.jar:." michael@0: michael@0: SHLIB_PATH=${LD_LIBRARY_PATH} michael@0: LIBPATH=${LD_LIBRARY_PATH} michael@0: michael@0: PATH=$JSS_NSPR_DIR/${OBJDIR}/bin:$JSS_NSS_DIR/${OBJDIR}//bin:$INIT_PATH michael@0: Debug "PATH $PATH" michael@0: Debug "LD_LIBRARY_PATH $LD_LIBRARY_PATH" michael@0: Debug "CLASSPATH=$CLASSPATH" michael@0: michael@0: export CLASSPATH LD_LIBRARY_PATH SHLIB_PATH LIBPATH michael@0: export TESTSCRIPTDIR COMMON michael@0: export_dirs michael@0: } michael@0: michael@0: michael@0: ################################ jss_test ######################### michael@0: # michael@0: # go into the build tree. cd to mozilla/security/jss/samples. michael@0: # Create NSS directories in this directory with modutil and set the password michael@0: # michael@0: #6. Create an alias for the "java" and "javac" commands. You'll need to set michael@0: #it to whatever version of the JDK you used to build on this platform. For michael@0: #example, michael@0: #alias java /share/builds/components/cms_jdk/AIX/1.3.0/jre/bin/java michael@0: #alias javac /share/builds/components/cms_jdk/AIX/1.3.0/bin/javac michael@0: # instead $JAVA and $JAVAC michael@0: # 7. Compile the tests. michael@0: ##################################################################### michael@0: jss_test() michael@0: { michael@0: O_FILE=OFF michael@0: Debug "JSS main test" michael@0: #set -x michael@0: cd $JSS_SAMPLES michael@0: michael@0: Debug "Cleaning $JSS_SAMPLES" michael@0: rm cert7.db key3.db 2>/dev/null michael@0: michael@0: Debug "echo | modutil -dbdir . -create -force" michael@0: echo | modutil -dbdir . -create -force michael@0: Debug "modutil returned $?" michael@0: michael@0: modutil -dbdir . -list michael@0: michael@0: Debug "echo | modutil -dbdir . -changepw \"$INTERNAL_TOKEN\" -newpwfile $PWFILE -force" michael@0: modutil -dbdir . -changepw "$INTERNAL_TOKEN" -newpwfile $PWFILE -force <$EMPTYFILE michael@0: #modutil -dbdir . -changepw "$INTERNAL_TOKEN" -pwfile $PWFILE -newpwfile $PWFILE <$EMPTYFILE michael@0: Debug "modutil returned $?" michael@0: michael@0: Debug "$JAVAC TestKeyGen.java" michael@0: $JAVAC TestKeyGen.java michael@0: Debug "$JAVAC TestKeyGen.java returned $?" michael@0: michael@0: Debug "$JAVAC SigTest.java" michael@0: $JAVAC SigTest.java michael@0: Debug "$JAVAC SigTest.java returned $?" michael@0: michael@0: echo "Starting new jss test on $HOST" michael@0: date michael@0: michael@0: # Run the actual tests michael@0: michael@0: Debug "$JAVA $NATIVE_FLAG TestKeyGen ." michael@0: $JAVA $NATIVE_FLAG TestKeyGen . michael@0: Debug "$JAVA TestKeyGen returned $?" michael@0: michael@0: Debug "$JAVA $NATIVE_FLAG SigTest . \"$SIGTEST_INTERNAL_TOKEN\"" michael@0: $JAVA $NATIVE_FLAG SigTest . "$SIGTEST_INTERNAL_TOKEN" michael@0: Debug "$JAVA SigTest returned $?" michael@0: michael@0: O_FILE=ON michael@0: } michael@0: michael@0: jss_init michael@0: jss_mode_init michael@0: michael@0: if [ "$O_CRON" = "ON" -o "$O_WIN" = "ON" ] michael@0: then michael@0: jss_test >>$JSS_LOGFILE 2>&1 michael@0: else michael@0: jss_test 2>&1 | tee -a $JSS_LOGFILE michael@0: fi michael@0: BUILD_OPT=1; export BUILD_OPT; Debug "BUILD_OPT $BUILD_OPT" michael@0: jss_mode_init michael@0: if [ "$O_CRON" = "ON" -o "$O_WIN" = "ON" ] michael@0: then michael@0: jss_test >>$JSS_LOGFILE 2>&1 michael@0: else michael@0: jss_test 2>&1 | tee -a $JSS_LOGFILE michael@0: fi michael@0: Exit "jssqa completed. Done `uname -n` $QA_OS_STRING"