3 ########################################################################
7 # this script is supposed to automatically run - now a sanity test, later QA for
8 # JSS on all required Unix and Windows (NT and 2000) platforms
12 # jssversion (supported: 31, tip)
13 # builddate (default - today)
17 # -y answer all questions with y - use at your own risk...ignores warnings
18 # -s silent (only usefull with -y)
19 # -h, -? - you guessed right - displays this text
21 # -f <filename> - write the (error)output to filename
22 # -cron equivalient to -y -s -d -f $RESULTDIR/$HOST.nssqa
24 ########################################################################
26 O_OPTIONS
=ON
# accept options (see above for listing)
27 WIN_WAIT_FOREVER
=OFF
# don't wait for the NSS testdir
29 JSS_NSPR_DIR
="/share/builds/components/nspr20/v4.1.2"
30 JSS_NSS_DIR
="/share/builds/components/nss/NSS_3_3_1_RTM"
31 JSS_NSS_UX_SRC_DIR
="nss331/builds/20010928.2.331-RTM/booboo_Solaris8"
32 JSS_NSS_NT_SRC_DIR
="nss331/builds/20010928.2.331-RTM/blowfish_NT4.0_Win95"
33 JSS_NSS_SRC_DIR
=$JSS_NSS_UX_SRC_DIR
36 .
`dirname $0`/header
# utilities, shellfunctions etc, global to NSS and JSS QA
38 if [ -z "$O_TBX" -o "$O_TBX" != "ON" ] ; then
39 is_running
${TMP}/jssqa
40 # checks if the file exists, if yes Exits, if not
41 # creates to implement a primitive locking mechanism
44 INTERNAL_TOKEN
="NSS Certificate DB"
45 SIGTEST_INTERNAL_TOKEN
="Internal Key Storage Token"
47 ################################ jss_init #########################
49 # Most of the procedure is setting up the test environment.
50 # set all necessary dir and file variables, set all paths, copy the shared libs
51 # Put all the shared libraries into a lib directory, <libdir>.
52 # including the libjss3.so that was built by the build process.
53 # set LD_LIBRARY PATH and CLASSPATH
54 # The xpclass.jar produced by the JSS build needs to be in the classpath.
55 # The classpath must also include the current directory so we can run our test
57 ################################################################################
62 #correct all directories that the header has set...
63 NTDIST
=`echo $NTDIST | sed -e 's/nss/jss/g'`
64 UXDIST
=`echo $UXDIST | sed -e 's/nss/jss/g'`
65 RESULTDIR
=`echo $RESULTDIR | sed -e 's/nss/jss/g'`
66 mkdir
-p ${RESULTDIR} 2>/dev
/null
67 JSS_LOGFILE
=${RESULTDIR}/${HOST}.txt
71 MOZILLA_ROOT
=`echo $MOZILLA_ROOT | sed -e 's/nss/jss/g'`
73 JSS_SAMPLES
="$MOZILLA_ROOT/security/jss/samples"
74 JSS_CLASSPATH
=`echo $MOZILLA_ROOT |
75 sed -e "s/jss$NSSVER.builds/jss$NSSVER\/ships/g" -e "s/mozilla/jss\/${QAYEAR}${BUILDDATE}/"`
76 Debug
"JSS_CLASSPATH=$JSS_CLASSPATH"
77 Debug
"JSS_SAMPLES=$JSS_SAMPLES"
79 if [ ! -d $JSS_SAMPLES ] ; then
80 if [ "$O_WIN" = "ON" -a "$WIN_WAIT_FOREVER" = "ON" ]
82 WaitForever
$JSS_SAMPLES/TestKeyGen.java
1
84 Exit
"Test directory $JSS_SAMPLES does not exist"
88 PWFILE
="$JSS_SAMPLES/passwd"
89 EMPTYFILE
="$JSS_SAMPLES/emptyfile"
90 rm $PWFILE $EMPTYFILE 2>/dev
/null
97 INIT_LD_LIBRARY_PATH
=$LD_LIBRARY_PATH
103 OBJDIR
=`cd ${TESTSCRIPTDIR}/common; gmake objdir_name`
105 LOCALDIST_BIN
=`echo $LOCALDIST_BIN | sed -e 's/nss/jss/g'`
106 LOCALDIST_LIB
=$LOCALDIST_BIN/..
/lib
111 JSS_LIBDIR
=${RESULTDIR}/${HOST}.libdir/${OBJDIR}
112 mkdir
-p ${JSS_LIBDIR} 2>/dev
/null
113 Debug
"JSS_LIBDIR=$JSS_LIBDIR"
115 #Put all the shared libraries into a lib directory
116 Debug
"copy all needed libs to ${JSS_LIBDIR}"
117 cp $JSS_NSPR_DIR/${OBJDIR}/lib
/* ${JSS_LIBDIR}
118 cp $JSS_NSS_DIR/${OBJDIR}/lib
/* ${JSS_LIBDIR}
119 cp $LOCALDIST_LIB/libjss3.
* ${JSS_LIBDIR}
120 #FIXME uncomment above
122 if [ $O_DEBUG = ON
] ; then
123 Debug
"ls $JSS_LIBDIR"
127 #LD_LIBRARY_PATH=$INIT_LD_LIBRARY_PATH:${JSS_LIBDIR}
128 LD_LIBRARY_PATH
=${JSS_LIBDIR} #remove to avoid HP coredump
129 CLASSPATH
="$JSS_CLASSPATH/xpclass.jar:."
131 SHLIB_PATH
=${LD_LIBRARY_PATH}
132 LIBPATH
=${LD_LIBRARY_PATH}
134 PATH
=$JSS_NSPR_DIR/${OBJDIR}/bin
:$JSS_NSS_DIR/${OBJDIR}//bin
:$INIT_PATH
136 Debug
"LD_LIBRARY_PATH $LD_LIBRARY_PATH"
137 Debug
"CLASSPATH=$CLASSPATH"
139 export CLASSPATH LD_LIBRARY_PATH SHLIB_PATH LIBPATH
140 export TESTSCRIPTDIR COMMON
145 ################################ jss_test #########################
147 # go into the build tree. cd to mozilla/security/jss/samples.
148 # Create NSS directories in this directory with modutil and set the password
150 #6. Create an alias for the "java" and "javac" commands. You'll need to set
151 #it to whatever version of the JDK you used to build on this platform. For
153 #alias java /share/builds/components/cms_jdk/AIX/1.3.0/jre/bin/java
154 #alias javac /share/builds/components/cms_jdk/AIX/1.3.0/bin/javac
155 # instead $JAVA and $JAVAC
156 # 7. Compile the tests.
157 #####################################################################
161 Debug
"JSS main test"
165 Debug
"Cleaning $JSS_SAMPLES"
166 rm cert7.db key3.db
2>/dev
/null
168 Debug
"echo | modutil -dbdir . -create -force"
169 echo | modutil
-dbdir .
-create -force
170 Debug
"modutil returned $?"
172 modutil
-dbdir .
-list
174 Debug
"echo | modutil -dbdir . -changepw \"$INTERNAL_TOKEN\" -newpwfile $PWFILE -force"
175 modutil
-dbdir .
-changepw "$INTERNAL_TOKEN" -newpwfile $PWFILE -force <$EMPTYFILE
176 #modutil -dbdir . -changepw "$INTERNAL_TOKEN" -pwfile $PWFILE -newpwfile $PWFILE <$EMPTYFILE
177 Debug
"modutil returned $?"
179 Debug
"$JAVAC TestKeyGen.java"
180 $JAVAC TestKeyGen.java
181 Debug
"$JAVAC TestKeyGen.java returned $?"
183 Debug
"$JAVAC SigTest.java"
185 Debug
"$JAVAC SigTest.java returned $?"
187 echo "Starting new jss test on $HOST"
190 # Run the actual tests
192 Debug
"$JAVA $NATIVE_FLAG TestKeyGen ."
193 $JAVA $NATIVE_FLAG TestKeyGen .
194 Debug
"$JAVA TestKeyGen returned $?"
196 Debug
"$JAVA $NATIVE_FLAG SigTest . \"$SIGTEST_INTERNAL_TOKEN\""
197 $JAVA $NATIVE_FLAG SigTest .
"$SIGTEST_INTERNAL_TOKEN"
198 Debug
"$JAVA SigTest returned $?"
206 if [ "$O_CRON" = "ON" -o "$O_WIN" = "ON" ]
208 jss_test
>>$JSS_LOGFILE 2>&1
210 jss_test
2>&1 |
tee -a $JSS_LOGFILE
212 BUILD_OPT
=1; export BUILD_OPT
; Debug
"BUILD_OPT $BUILD_OPT"
214 if [ "$O_CRON" = "ON" -o "$O_WIN" = "ON" ]
216 jss_test
>>$JSS_LOGFILE 2>&1
218 jss_test
2>&1 |
tee -a $JSS_LOGFILE
220 Exit
"jssqa completed. Done `uname -n` $QA_OS_STRING"