security/nss/tests/jssqa

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/nss/tests/jssqa	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,220 @@
     1.4 +#! /bin/sh  
     1.5 +
     1.6 +########################################################################
     1.7 +#
     1.8 +# /u/sonmi/bin/jssqa
     1.9 +#
    1.10 +# this script is supposed to automatically run - now a sanity test, later QA for 
    1.11 +# JSS on all required Unix and Windows (NT and 2000) platforms
    1.12 +#
    1.13 +# parameters
    1.14 +# ----------
    1.15 +#   jssversion  (supported: 31, tip)
    1.16 +#   builddate   (default - today)
    1.17 +#
    1.18 +# options
    1.19 +# -------
    1.20 +#   -y answer all questions with y - use at your own risk...ignores warnings
    1.21 +#   -s silent (only usefull with -y)
    1.22 +#   -h, -? - you guessed right - displays this text
    1.23 +#   -d debug
    1.24 +#   -f <filename> - write the (error)output to filename
    1.25 +#   -cron equivalient to -y -s -d -f $RESULTDIR/$HOST.nssqa
    1.26 +#
    1.27 +########################################################################
    1.28 +
    1.29 +O_OPTIONS=ON            # accept options (see above for listing)
    1.30 +WIN_WAIT_FOREVER=OFF    # don't wait for the NSS testdir
    1.31 +PRODUCT_TO_TEST="JSS"
    1.32 +JSS_NSPR_DIR="/share/builds/components/nspr20/v4.1.2"
    1.33 +JSS_NSS_DIR="/share/builds/components/nss/NSS_3_3_1_RTM"
    1.34 +JSS_NSS_UX_SRC_DIR="nss331/builds/20010928.2.331-RTM/booboo_Solaris8"
    1.35 +JSS_NSS_NT_SRC_DIR="nss331/builds/20010928.2.331-RTM/blowfish_NT4.0_Win95"
    1.36 +JSS_NSS_SRC_DIR=$JSS_NSS_UX_SRC_DIR
    1.37 +NATIVE_FLAG=""
    1.38 +
    1.39 +. `dirname $0`/header   # utilities, shellfunctions etc, global to NSS and JSS QA
    1.40 +
    1.41 +if [ -z "$O_TBX" -o "$O_TBX" != "ON" ] ; then
    1.42 +    is_running ${TMP}/jssqa
    1.43 +                        # checks if the file exists, if yes Exits, if not
    1.44 +                        # creates to implement a primitive locking mechanism
    1.45 +fi
    1.46 +
    1.47 +INTERNAL_TOKEN="NSS Certificate DB"
    1.48 +SIGTEST_INTERNAL_TOKEN="Internal Key Storage Token"
    1.49 +
    1.50 +################################ jss_init #########################
    1.51 +# 
    1.52 +# Most of the procedure is setting up the test environment.
    1.53 +# set all necessary dir and file variables, set all paths, copy the shared libs 
    1.54 +# Put all the shared libraries into a lib directory, <libdir>.
    1.55 +# including the libjss3.so that was built by the build process.
    1.56 +# set LD_LIBRARY PATH and CLASSPATH
    1.57 +# The xpclass.jar produced by the JSS build needs to be in the classpath.
    1.58 +# The classpath must also include the current directory so we can run our test
    1.59 +# programs.
    1.60 +################################################################################
    1.61 +
    1.62 +jss_init()
    1.63 +{
    1.64 +  Debug "Jss init"
    1.65 +  #correct all directories that the header has set...
    1.66 +  NTDIST=`echo $NTDIST | sed -e 's/nss/jss/g'`
    1.67 +  UXDIST=`echo $UXDIST | sed -e 's/nss/jss/g'`
    1.68 +  RESULTDIR=`echo $RESULTDIR | sed -e 's/nss/jss/g'`
    1.69 +  mkdir -p ${RESULTDIR} 2>/dev/null
    1.70 +  JSS_LOGFILE=${RESULTDIR}/${HOST}.txt
    1.71 +  FILENAME=$JSS_LOGFILE
    1.72 +  O_FILE=ON
    1.73 +
    1.74 +  MOZILLA_ROOT=`echo $MOZILLA_ROOT | sed -e 's/nss/jss/g'`
    1.75 +
    1.76 +  JSS_SAMPLES="$MOZILLA_ROOT/security/jss/samples"
    1.77 +  JSS_CLASSPATH=`echo $MOZILLA_ROOT | 
    1.78 +      sed -e "s/jss$NSSVER.builds/jss$NSSVER\/ships/g" -e "s/mozilla/jss\/${QAYEAR}${BUILDDATE}/"`
    1.79 +  Debug "JSS_CLASSPATH=$JSS_CLASSPATH"
    1.80 +  Debug "JSS_SAMPLES=$JSS_SAMPLES"
    1.81 +
    1.82 +  if [ ! -d $JSS_SAMPLES ] ; then
    1.83 +      if [ "$O_WIN" = "ON" -a "$WIN_WAIT_FOREVER" = "ON" ]
    1.84 +      then
    1.85 +          WaitForever $JSS_SAMPLES/TestKeyGen.java 1
    1.86 +      else
    1.87 +          Exit "Test directory $JSS_SAMPLES does not exist"
    1.88 +      fi
    1.89 +  fi
    1.90 +
    1.91 +  PWFILE="$JSS_SAMPLES/passwd"
    1.92 +  EMPTYFILE="$JSS_SAMPLES/emptyfile"
    1.93 +  rm $PWFILE $EMPTYFILE 2>/dev/null
    1.94 +  echo "jss" >$PWFILE
    1.95 +  echo "" >$EMPTYFILE
    1.96 +  echo "" >>$EMPTYFILE
    1.97 +  echo "" >>$EMPTYFILE
    1.98 +
    1.99 +  INIT_PATH=$PATH
   1.100 +  INIT_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
   1.101 +}
   1.102 +
   1.103 +
   1.104 +jss_mode_init()
   1.105 +{
   1.106 +  OBJDIR=`cd ${TESTSCRIPTDIR}/common; gmake objdir_name`
   1.107 +
   1.108 +  LOCALDIST_BIN=`echo $LOCALDIST_BIN | sed -e 's/nss/jss/g'`
   1.109 +  LOCALDIST_LIB=$LOCALDIST_BIN/../lib
   1.110 +  debug_dirs
   1.111 +
   1.112 +  #make testdir/libdir
   1.113 +
   1.114 +  JSS_LIBDIR=${RESULTDIR}/${HOST}.libdir/${OBJDIR}
   1.115 +  mkdir -p ${JSS_LIBDIR} 2>/dev/null
   1.116 +  Debug "JSS_LIBDIR=$JSS_LIBDIR"
   1.117 +
   1.118 +  #Put all the shared libraries into a lib directory
   1.119 +  Debug "copy all needed libs to ${JSS_LIBDIR}"
   1.120 +  cp $JSS_NSPR_DIR/${OBJDIR}/lib/* ${JSS_LIBDIR}
   1.121 +  cp $JSS_NSS_DIR/${OBJDIR}/lib/* ${JSS_LIBDIR}
   1.122 +  cp $LOCALDIST_LIB/libjss3.*  ${JSS_LIBDIR}
   1.123 +  #FIXME uncomment above
   1.124 +
   1.125 +  if [ $O_DEBUG = ON ] ; then
   1.126 +      Debug "ls $JSS_LIBDIR"
   1.127 +      ls $JSS_LIBDIR
   1.128 +  fi
   1.129 +
   1.130 +  #LD_LIBRARY_PATH=$INIT_LD_LIBRARY_PATH:${JSS_LIBDIR}
   1.131 +  LD_LIBRARY_PATH=${JSS_LIBDIR} #remove to avoid HP coredump
   1.132 +  CLASSPATH="$JSS_CLASSPATH/xpclass.jar:."
   1.133 +
   1.134 +  SHLIB_PATH=${LD_LIBRARY_PATH}
   1.135 +  LIBPATH=${LD_LIBRARY_PATH}
   1.136 +
   1.137 +  PATH=$JSS_NSPR_DIR/${OBJDIR}/bin:$JSS_NSS_DIR/${OBJDIR}//bin:$INIT_PATH
   1.138 +  Debug "PATH $PATH"
   1.139 +  Debug "LD_LIBRARY_PATH $LD_LIBRARY_PATH"
   1.140 +  Debug "CLASSPATH=$CLASSPATH"
   1.141 +
   1.142 +  export CLASSPATH LD_LIBRARY_PATH SHLIB_PATH LIBPATH
   1.143 +  export TESTSCRIPTDIR COMMON
   1.144 +  export_dirs
   1.145 +}
   1.146 +
   1.147 +  
   1.148 +################################ jss_test #########################
   1.149 +# 
   1.150 +# go into the build tree. cd to mozilla/security/jss/samples.
   1.151 +# Create NSS directories in this directory with modutil and set the password
   1.152 +#
   1.153 +#6. Create an alias for the "java" and "javac" commands. You'll need to set
   1.154 +#it to whatever version of the JDK you used to build on this platform. For
   1.155 +#example, 
   1.156 +      #alias java /share/builds/components/cms_jdk/AIX/1.3.0/jre/bin/java
   1.157 +        #alias javac /share/builds/components/cms_jdk/AIX/1.3.0/bin/javac
   1.158 +# instead $JAVA and $JAVAC
   1.159 +# 7. Compile the tests.
   1.160 +#####################################################################
   1.161 +jss_test()
   1.162 +{
   1.163 +  O_FILE=OFF
   1.164 +  Debug "JSS main test"
   1.165 +  #set -x
   1.166 +  cd $JSS_SAMPLES
   1.167 +
   1.168 +  Debug "Cleaning  $JSS_SAMPLES"
   1.169 +  rm cert7.db key3.db 2>/dev/null
   1.170 +
   1.171 +  Debug "echo | modutil -dbdir . -create -force"
   1.172 +  echo | modutil -dbdir . -create -force
   1.173 +  Debug "modutil returned $?"
   1.174 +
   1.175 +  modutil -dbdir . -list
   1.176 +
   1.177 +  Debug "echo | modutil -dbdir . -changepw \"$INTERNAL_TOKEN\" -newpwfile $PWFILE -force"
   1.178 +  modutil -dbdir . -changepw "$INTERNAL_TOKEN" -newpwfile $PWFILE  -force <$EMPTYFILE
   1.179 +  #modutil -dbdir . -changepw "$INTERNAL_TOKEN" -pwfile $PWFILE -newpwfile $PWFILE <$EMPTYFILE
   1.180 +  Debug "modutil returned $?"
   1.181 +
   1.182 +  Debug "$JAVAC TestKeyGen.java"
   1.183 +  $JAVAC TestKeyGen.java
   1.184 +  Debug "$JAVAC TestKeyGen.java returned $?"
   1.185 +
   1.186 +  Debug "$JAVAC SigTest.java"
   1.187 +  $JAVAC SigTest.java
   1.188 +  Debug "$JAVAC SigTest.java returned $?"
   1.189 +          
   1.190 +  echo "Starting new jss test on $HOST"  
   1.191 +  date
   1.192 +
   1.193 +  # Run the actual tests
   1.194 +
   1.195 +  Debug "$JAVA $NATIVE_FLAG TestKeyGen ." 
   1.196 +  $JAVA $NATIVE_FLAG TestKeyGen . 
   1.197 +  Debug "$JAVA TestKeyGen returned $?"
   1.198 +
   1.199 +  Debug "$JAVA $NATIVE_FLAG SigTest . \"$SIGTEST_INTERNAL_TOKEN\""
   1.200 +  $JAVA $NATIVE_FLAG SigTest . "$SIGTEST_INTERNAL_TOKEN"
   1.201 +  Debug "$JAVA SigTest returned $?"
   1.202 +
   1.203 +  O_FILE=ON
   1.204 +}
   1.205 +
   1.206 +jss_init
   1.207 +jss_mode_init
   1.208 +
   1.209 +if [ "$O_CRON" = "ON" -o "$O_WIN" = "ON" ]
   1.210 +then
   1.211 +    jss_test >>$JSS_LOGFILE  2>&1
   1.212 +else
   1.213 +    jss_test 2>&1 | tee -a $JSS_LOGFILE
   1.214 +fi
   1.215 +BUILD_OPT=1; export BUILD_OPT; Debug "BUILD_OPT $BUILD_OPT"
   1.216 +jss_mode_init
   1.217 +if [ "$O_CRON" = "ON" -o "$O_WIN" = "ON" ]
   1.218 +then
   1.219 +    jss_test >>$JSS_LOGFILE  2>&1
   1.220 +else
   1.221 +    jss_test 2>&1 | tee -a $JSS_LOGFILE
   1.222 +fi
   1.223 +Exit "jssqa completed. Done `uname -n` $QA_OS_STRING"

mercurial