security/nss/tests/jssqa

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rwxr-xr-x

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 #! /bin/sh
michael@0 2
michael@0 3 ########################################################################
michael@0 4 #
michael@0 5 # /u/sonmi/bin/jssqa
michael@0 6 #
michael@0 7 # this script is supposed to automatically run - now a sanity test, later QA for
michael@0 8 # JSS on all required Unix and Windows (NT and 2000) platforms
michael@0 9 #
michael@0 10 # parameters
michael@0 11 # ----------
michael@0 12 # jssversion (supported: 31, tip)
michael@0 13 # builddate (default - today)
michael@0 14 #
michael@0 15 # options
michael@0 16 # -------
michael@0 17 # -y answer all questions with y - use at your own risk...ignores warnings
michael@0 18 # -s silent (only usefull with -y)
michael@0 19 # -h, -? - you guessed right - displays this text
michael@0 20 # -d debug
michael@0 21 # -f <filename> - write the (error)output to filename
michael@0 22 # -cron equivalient to -y -s -d -f $RESULTDIR/$HOST.nssqa
michael@0 23 #
michael@0 24 ########################################################################
michael@0 25
michael@0 26 O_OPTIONS=ON # accept options (see above for listing)
michael@0 27 WIN_WAIT_FOREVER=OFF # don't wait for the NSS testdir
michael@0 28 PRODUCT_TO_TEST="JSS"
michael@0 29 JSS_NSPR_DIR="/share/builds/components/nspr20/v4.1.2"
michael@0 30 JSS_NSS_DIR="/share/builds/components/nss/NSS_3_3_1_RTM"
michael@0 31 JSS_NSS_UX_SRC_DIR="nss331/builds/20010928.2.331-RTM/booboo_Solaris8"
michael@0 32 JSS_NSS_NT_SRC_DIR="nss331/builds/20010928.2.331-RTM/blowfish_NT4.0_Win95"
michael@0 33 JSS_NSS_SRC_DIR=$JSS_NSS_UX_SRC_DIR
michael@0 34 NATIVE_FLAG=""
michael@0 35
michael@0 36 . `dirname $0`/header # utilities, shellfunctions etc, global to NSS and JSS QA
michael@0 37
michael@0 38 if [ -z "$O_TBX" -o "$O_TBX" != "ON" ] ; then
michael@0 39 is_running ${TMP}/jssqa
michael@0 40 # checks if the file exists, if yes Exits, if not
michael@0 41 # creates to implement a primitive locking mechanism
michael@0 42 fi
michael@0 43
michael@0 44 INTERNAL_TOKEN="NSS Certificate DB"
michael@0 45 SIGTEST_INTERNAL_TOKEN="Internal Key Storage Token"
michael@0 46
michael@0 47 ################################ jss_init #########################
michael@0 48 #
michael@0 49 # Most of the procedure is setting up the test environment.
michael@0 50 # set all necessary dir and file variables, set all paths, copy the shared libs
michael@0 51 # Put all the shared libraries into a lib directory, <libdir>.
michael@0 52 # including the libjss3.so that was built by the build process.
michael@0 53 # set LD_LIBRARY PATH and CLASSPATH
michael@0 54 # The xpclass.jar produced by the JSS build needs to be in the classpath.
michael@0 55 # The classpath must also include the current directory so we can run our test
michael@0 56 # programs.
michael@0 57 ################################################################################
michael@0 58
michael@0 59 jss_init()
michael@0 60 {
michael@0 61 Debug "Jss init"
michael@0 62 #correct all directories that the header has set...
michael@0 63 NTDIST=`echo $NTDIST | sed -e 's/nss/jss/g'`
michael@0 64 UXDIST=`echo $UXDIST | sed -e 's/nss/jss/g'`
michael@0 65 RESULTDIR=`echo $RESULTDIR | sed -e 's/nss/jss/g'`
michael@0 66 mkdir -p ${RESULTDIR} 2>/dev/null
michael@0 67 JSS_LOGFILE=${RESULTDIR}/${HOST}.txt
michael@0 68 FILENAME=$JSS_LOGFILE
michael@0 69 O_FILE=ON
michael@0 70
michael@0 71 MOZILLA_ROOT=`echo $MOZILLA_ROOT | sed -e 's/nss/jss/g'`
michael@0 72
michael@0 73 JSS_SAMPLES="$MOZILLA_ROOT/security/jss/samples"
michael@0 74 JSS_CLASSPATH=`echo $MOZILLA_ROOT |
michael@0 75 sed -e "s/jss$NSSVER.builds/jss$NSSVER\/ships/g" -e "s/mozilla/jss\/${QAYEAR}${BUILDDATE}/"`
michael@0 76 Debug "JSS_CLASSPATH=$JSS_CLASSPATH"
michael@0 77 Debug "JSS_SAMPLES=$JSS_SAMPLES"
michael@0 78
michael@0 79 if [ ! -d $JSS_SAMPLES ] ; then
michael@0 80 if [ "$O_WIN" = "ON" -a "$WIN_WAIT_FOREVER" = "ON" ]
michael@0 81 then
michael@0 82 WaitForever $JSS_SAMPLES/TestKeyGen.java 1
michael@0 83 else
michael@0 84 Exit "Test directory $JSS_SAMPLES does not exist"
michael@0 85 fi
michael@0 86 fi
michael@0 87
michael@0 88 PWFILE="$JSS_SAMPLES/passwd"
michael@0 89 EMPTYFILE="$JSS_SAMPLES/emptyfile"
michael@0 90 rm $PWFILE $EMPTYFILE 2>/dev/null
michael@0 91 echo "jss" >$PWFILE
michael@0 92 echo "" >$EMPTYFILE
michael@0 93 echo "" >>$EMPTYFILE
michael@0 94 echo "" >>$EMPTYFILE
michael@0 95
michael@0 96 INIT_PATH=$PATH
michael@0 97 INIT_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
michael@0 98 }
michael@0 99
michael@0 100
michael@0 101 jss_mode_init()
michael@0 102 {
michael@0 103 OBJDIR=`cd ${TESTSCRIPTDIR}/common; gmake objdir_name`
michael@0 104
michael@0 105 LOCALDIST_BIN=`echo $LOCALDIST_BIN | sed -e 's/nss/jss/g'`
michael@0 106 LOCALDIST_LIB=$LOCALDIST_BIN/../lib
michael@0 107 debug_dirs
michael@0 108
michael@0 109 #make testdir/libdir
michael@0 110
michael@0 111 JSS_LIBDIR=${RESULTDIR}/${HOST}.libdir/${OBJDIR}
michael@0 112 mkdir -p ${JSS_LIBDIR} 2>/dev/null
michael@0 113 Debug "JSS_LIBDIR=$JSS_LIBDIR"
michael@0 114
michael@0 115 #Put all the shared libraries into a lib directory
michael@0 116 Debug "copy all needed libs to ${JSS_LIBDIR}"
michael@0 117 cp $JSS_NSPR_DIR/${OBJDIR}/lib/* ${JSS_LIBDIR}
michael@0 118 cp $JSS_NSS_DIR/${OBJDIR}/lib/* ${JSS_LIBDIR}
michael@0 119 cp $LOCALDIST_LIB/libjss3.* ${JSS_LIBDIR}
michael@0 120 #FIXME uncomment above
michael@0 121
michael@0 122 if [ $O_DEBUG = ON ] ; then
michael@0 123 Debug "ls $JSS_LIBDIR"
michael@0 124 ls $JSS_LIBDIR
michael@0 125 fi
michael@0 126
michael@0 127 #LD_LIBRARY_PATH=$INIT_LD_LIBRARY_PATH:${JSS_LIBDIR}
michael@0 128 LD_LIBRARY_PATH=${JSS_LIBDIR} #remove to avoid HP coredump
michael@0 129 CLASSPATH="$JSS_CLASSPATH/xpclass.jar:."
michael@0 130
michael@0 131 SHLIB_PATH=${LD_LIBRARY_PATH}
michael@0 132 LIBPATH=${LD_LIBRARY_PATH}
michael@0 133
michael@0 134 PATH=$JSS_NSPR_DIR/${OBJDIR}/bin:$JSS_NSS_DIR/${OBJDIR}//bin:$INIT_PATH
michael@0 135 Debug "PATH $PATH"
michael@0 136 Debug "LD_LIBRARY_PATH $LD_LIBRARY_PATH"
michael@0 137 Debug "CLASSPATH=$CLASSPATH"
michael@0 138
michael@0 139 export CLASSPATH LD_LIBRARY_PATH SHLIB_PATH LIBPATH
michael@0 140 export TESTSCRIPTDIR COMMON
michael@0 141 export_dirs
michael@0 142 }
michael@0 143
michael@0 144
michael@0 145 ################################ jss_test #########################
michael@0 146 #
michael@0 147 # go into the build tree. cd to mozilla/security/jss/samples.
michael@0 148 # Create NSS directories in this directory with modutil and set the password
michael@0 149 #
michael@0 150 #6. Create an alias for the "java" and "javac" commands. You'll need to set
michael@0 151 #it to whatever version of the JDK you used to build on this platform. For
michael@0 152 #example,
michael@0 153 #alias java /share/builds/components/cms_jdk/AIX/1.3.0/jre/bin/java
michael@0 154 #alias javac /share/builds/components/cms_jdk/AIX/1.3.0/bin/javac
michael@0 155 # instead $JAVA and $JAVAC
michael@0 156 # 7. Compile the tests.
michael@0 157 #####################################################################
michael@0 158 jss_test()
michael@0 159 {
michael@0 160 O_FILE=OFF
michael@0 161 Debug "JSS main test"
michael@0 162 #set -x
michael@0 163 cd $JSS_SAMPLES
michael@0 164
michael@0 165 Debug "Cleaning $JSS_SAMPLES"
michael@0 166 rm cert7.db key3.db 2>/dev/null
michael@0 167
michael@0 168 Debug "echo | modutil -dbdir . -create -force"
michael@0 169 echo | modutil -dbdir . -create -force
michael@0 170 Debug "modutil returned $?"
michael@0 171
michael@0 172 modutil -dbdir . -list
michael@0 173
michael@0 174 Debug "echo | modutil -dbdir . -changepw \"$INTERNAL_TOKEN\" -newpwfile $PWFILE -force"
michael@0 175 modutil -dbdir . -changepw "$INTERNAL_TOKEN" -newpwfile $PWFILE -force <$EMPTYFILE
michael@0 176 #modutil -dbdir . -changepw "$INTERNAL_TOKEN" -pwfile $PWFILE -newpwfile $PWFILE <$EMPTYFILE
michael@0 177 Debug "modutil returned $?"
michael@0 178
michael@0 179 Debug "$JAVAC TestKeyGen.java"
michael@0 180 $JAVAC TestKeyGen.java
michael@0 181 Debug "$JAVAC TestKeyGen.java returned $?"
michael@0 182
michael@0 183 Debug "$JAVAC SigTest.java"
michael@0 184 $JAVAC SigTest.java
michael@0 185 Debug "$JAVAC SigTest.java returned $?"
michael@0 186
michael@0 187 echo "Starting new jss test on $HOST"
michael@0 188 date
michael@0 189
michael@0 190 # Run the actual tests
michael@0 191
michael@0 192 Debug "$JAVA $NATIVE_FLAG TestKeyGen ."
michael@0 193 $JAVA $NATIVE_FLAG TestKeyGen .
michael@0 194 Debug "$JAVA TestKeyGen returned $?"
michael@0 195
michael@0 196 Debug "$JAVA $NATIVE_FLAG SigTest . \"$SIGTEST_INTERNAL_TOKEN\""
michael@0 197 $JAVA $NATIVE_FLAG SigTest . "$SIGTEST_INTERNAL_TOKEN"
michael@0 198 Debug "$JAVA SigTest returned $?"
michael@0 199
michael@0 200 O_FILE=ON
michael@0 201 }
michael@0 202
michael@0 203 jss_init
michael@0 204 jss_mode_init
michael@0 205
michael@0 206 if [ "$O_CRON" = "ON" -o "$O_WIN" = "ON" ]
michael@0 207 then
michael@0 208 jss_test >>$JSS_LOGFILE 2>&1
michael@0 209 else
michael@0 210 jss_test 2>&1 | tee -a $JSS_LOGFILE
michael@0 211 fi
michael@0 212 BUILD_OPT=1; export BUILD_OPT; Debug "BUILD_OPT $BUILD_OPT"
michael@0 213 jss_mode_init
michael@0 214 if [ "$O_CRON" = "ON" -o "$O_WIN" = "ON" ]
michael@0 215 then
michael@0 216 jss_test >>$JSS_LOGFILE 2>&1
michael@0 217 else
michael@0 218 jss_test 2>&1 | tee -a $JSS_LOGFILE
michael@0 219 fi
michael@0 220 Exit "jssqa completed. Done `uname -n` $QA_OS_STRING"

mercurial