nss: import at 3.0.1 beta 1
[mozilla-nss.git] / security / nss / tests / all.sh
blob746f845abc1de26bd61820dda085772edbc8997a
1 #!/bin/sh
3 # ***** BEGIN LICENSE BLOCK *****
4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 # The contents of this file are subject to the Mozilla Public License Version
7 # 1.1 (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
9 # http://www.mozilla.org/MPL/
11 # Software distributed under the License is distributed on an "AS IS" basis,
12 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 # for the specific language governing rights and limitations under the
14 # License.
16 # The Original Code is the Netscape security libraries.
18 # The Initial Developer of the Original Code is
19 # Netscape Communications Corporation.
20 # Portions created by the Initial Developer are Copyright (C) 1994-2000
21 # the Initial Developer. All Rights Reserved.
23 # Contributor(s):
25 # Alternatively, the contents of this file may be used under the terms of
26 # either the GNU General Public License Version 2 or later (the "GPL"), or
27 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 # in which case the provisions of the GPL or the LGPL are applicable instead
29 # of those above. If you wish to allow use of your version of this file only
30 # under the terms of either the GPL or the LGPL, and not to allow others to
31 # use your version of this file under the terms of the MPL, indicate your
32 # decision by deleting the provisions above and replace them with the notice
33 # and other provisions required by the GPL or the LGPL. If you do not delete
34 # the provisions above, a recipient may use your version of this file under
35 # the terms of any one of the MPL, the GPL or the LGPL.
37 # ***** END LICENSE BLOCK *****
39 ########################################################################
41 # mozilla/security/nss/tests/all.sh
43 # Script to start all available NSS QA suites on one machine
44 # this script is called or sourced by nssqa which runs on all required
45 # platforms
47 # needs to work on all Unix and Windows platforms
49 # currently available NSS QA suites:
50 # --------------------------------------------------
51 # cert.sh - exercises certutil and creates certs necessary for all
52 # other tests
53 # ssl.sh - tests SSL V2 SSL V3 and TLS
54 # smime.sh - S/MIME testing
55 # crmf.sh - CRMF/CMMF testing
56 # sdr.sh - test NSS SDR
57 # cipher.sh - test NSS ciphers
58 # perf.sh - Nightly performance measurments
59 # tools.sh - Tests the majority of the NSS tools
60 # fips.sh - Tests basic functionallity of NSS in FIPS-compliant mode
62 # special strings
63 # ---------------
64 # FIXME ... known problems, search for this string
65 # NOTE .... unexpected behavior
67 # NOTE:
68 # -----
69 # Unlike the old QA this is based on files sourcing each other
70 # This is done to save time, since a great portion of time is lost
71 # in calling and sourcing the same things multiple times over the
72 # network. Also, this way all scripts have all shell function available
73 # and a completely common environment
75 # file tells the test suite that the output is going to a log, so any
76 # forked() children need to redirect their output to prevent them from
77 # being over written.
79 ########################################################################
81 run_tests()
83 for i in ${TESTS}
85 SCRIPTNAME=${i}.sh
86 if [ "$O_CRON" = "ON" ]; then
87 echo "Running tests for $i" >> ${LOGFILE}
88 echo "TIMESTAMP $i BEGIN: `date`" >> ${LOGFILE}
89 (cd ${QADIR}/$i ; . ./$SCRIPTNAME all file >> ${LOGFILE} 2>&1)
90 echo "TIMESTAMP $i END: `date`" >> ${LOGFILE}
91 else
92 echo "Running tests for $i" | tee -a ${LOGFILE}
93 echo "TIMESTAMP $i BEGIN: `date`" | tee -a ${LOGFILE}
94 (cd ${QADIR}/$i ; . ./$SCRIPTNAME all file 2>&1 | tee -a ${LOGFILE})
95 echo "TIMESTAMP $i END: `date`" | tee -a ${LOGFILE}
97 done
100 tests="cipher perf libpkix cert dbtests tools fips sdr crmf smime ssl ocsp merge pkits"
101 if [ -z "$BUILD_LIBPKIX_TESTS" ] ; then
102 tests=`echo "${tests}" | sed -e "s/libpkix//"`
104 TESTS=${TESTS:-$tests}
105 ALL_TESTS=${TESTS}
107 SCRIPTNAME=all.sh
108 CLEANUP="${SCRIPTNAME}"
109 cd `dirname $0` # will cause problems if sourced
111 # all.sh should be the first one to try to source the init
112 if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
113 cd common
114 . ./init.sh
117 # Since in make at the top level, modutil is the last file
118 # created, we check for modutil to know whether the build
119 # is complete. If a new file is created after that, the
120 # following test for modutil should check for that instead.
122 if [ ! -f ${DIST}/${OBJDIR}/bin/modutil -a \
123 ! -f ${DIST}/${OBJDIR}/bin/modutil.exe ]; then
124 echo "Build Incomplete. Aborting test." >> ${LOGFILE}
125 html_head "Testing Initialization"
126 Exit "Checking for build"
129 # backup selected environment variables
130 ENV_BACKUP=${HOSTDIR}/env.sh
131 env_backup > ${ENV_BACKUP}
133 # standard tests, no pkix, no sharedb
134 if [ -z "$NSS_TEST_DISABLE_STANDARD" ] ; then
135 TEST_MODE=STANDARD
136 run_tests
139 # PKIX tests
140 if [ -z "$NSS_TEST_DISABLE_PKIX" ] ; then
141 TABLE_ARGS="bgcolor=cyan"
142 html_head "Testing with PKIX"
143 html "</TABLE><BR>"
145 HOSTDIR="${HOSTDIR}/pkix"
146 mkdir -p "${HOSTDIR}"
147 init_directories
149 NSS_TEST_SERVER_CLIENT_BYPASS="1"
150 NSS_TEST_DISABLE_FIPS="1"
151 NSS_ENABLE_PKIX_VERIFY="1"
152 export NSS_ENABLE_PKIX_VERIFY
154 TESTS=`echo "${ALL_TESTS}" | sed -e "s/cipher//" -e "s/libpkix//" \
155 -e "s/dbupgrade//"`
156 TEST_MODE=PKIX
157 run_tests
159 . ${ENV_BACKUP}
162 # upgrade cert dbs to shared db + run tests there
163 if [ -z "$NSS_TEST_DISABLE_UPGRADE_DB" ] ; then
164 # upgrade certs dbs to shared db
165 TESTS="dbupgrade"
166 TEST_MODE=UPGRADE_DB
167 run_tests
169 TABLE_ARGS="bgcolor=pink"
170 html_head "Testing with upgraded library"
171 html "</TABLE><BR>"
173 NSS_DEFAULT_DB_TYPE="sql"
174 export NSS_DEFAULT_DB_TYPE
176 # run the subset of tests with the upgraded database
177 TESTS=`echo "${ALL_TESTS}" | sed -e "s/cipher//" -e "s/perf//" \
178 -e "s/libpkix//" -e "s/cert//" -e "s/dbtests//" -e "s/dbupgrade//"`
179 run_tests
181 . ${ENV_BACKUP}
184 # tests for native sharedb support
185 if [ -z "$NSS_TEST_DISABLE_SHARED_DB" ] ; then
186 TABLE_ARGS="bgcolor=yellow"
187 html_head "Testing with shared library"
188 html "</TABLE><BR>"
190 HOSTDIR="${HOSTDIR}/sharedb"
191 mkdir -p "${HOSTDIR}"
192 init_directories
194 NSS_DEFAULT_DB_TYPE="sql"
195 export NSS_DEFAULT_DB_TYPE
197 # run the tests for native sharedb support
198 TESTS=`echo "${ALL_TESTS}" | sed -e "s/libpkix//" -e "s/dbupgrade//"`
199 TEST_MODE=SHARED_DB
200 run_tests
202 . ${ENV_BACKUP}
205 SCRIPTNAME=all.sh
207 . ${QADIR}/common/cleanup.sh