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
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.
24 # Slavomir Katuscak <slavomir.katuscak@sun.com>, Sun Microsystems
26 # Alternatively, the contents of this file may be used under the terms of
27 # either the GNU General Public License Version 2 or later (the "GPL"), or
28 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 # in which case the provisions of the GPL or the LGPL are applicable instead
30 # of those above. If you wish to allow use of your version of this file only
31 # under the terms of either the GPL or the LGPL, and not to allow others to
32 # use your version of this file under the terms of the MPL, indicate your
33 # decision by deleting the provisions above and replace them with the notice
34 # and other provisions required by the GPL or the LGPL. If you do not delete
35 # the provisions above, a recipient may use your version of this file under
36 # the terms of any one of the MPL, the GPL or the LGPL.
38 # ***** END LICENSE BLOCK *****
40 ########################################################################
42 # mozilla/security/nss/tests/all.sh
44 # Script to start selected available NSS QA suites on one machine
45 # this script is called or sourced by NSS QA which runs on all required
48 # Needs to work on all Unix and Windows platforms
50 # Currently available NSS QA suites:
51 # ----------------------------------
52 # cipher.sh - tests NSS ciphers
53 # libpkix.sh - tests PKIX functionality
54 # cert.sh - exercises certutil and creates certs necessary for
56 # dbtests.sh - tests related to certificate databases
57 # tools.sh - tests the majority of the NSS tools
58 # fips.sh - tests basic functionallity of NSS in FIPS-compliant
60 # sdr.sh - tests NSS SDR
61 # crmf.sh - CRMF/CMMF testing
62 # smime.sh - S/MIME testing
63 # ssl.sh - tests SSL V2 SSL V3 and TLS
64 # ocsp.sh - OCSP testing
65 # merge.sh - tests merging old and new shareable databases
66 # pkits.sh - NIST/PKITS tests
67 # dbupgrade.sh - upgrade databases to new shareable version (used
68 # only in upgrade test cycle)
69 # memleak.sh - memory leak testing (optional)
71 # NSS testing is now devided to 4 cycles:
72 # ---------------------------------------
73 # standard - run test suites with defaults settings
74 # pkix - run test suites with PKIX enabled
75 # upgradedb - upgrade existing certificate databases to shareable
76 # format (creates them if doesn't exist yet) and run
77 # test suites with those databases
78 # sharedb - run test suites with shareable database format
79 # enabled (databases are created directly to this
82 # Mandatory environment variables (to be set before testing):
83 # -----------------------------------------------------------
84 # HOST - test machine host name
85 # DOMSUF - test machine domain name
87 # Optional environment variables to specify build to use:
88 # -------------------------------------------------------
89 # BUILT_OPT - use optimized/debug build
90 # USE_64 - use 64bit/32bit build
92 # Optional environment variables to enable specific NSS features:
93 # ---------------------------------------------------------------
94 # NSS_ENABLE_ECC - enable ECC
95 # NSS_ECC_MORE_THAN_SUITE_B - enable extended ECC
97 # Optional environment variables to select which cycles/suites to test:
98 # ---------------------------------------------------------------------
99 # NSS_CYCLES - list of cycles to run (separated by space
101 # - by default all cycles are tested
103 # NSS_TESTS - list of all test suites to run (separated by space
104 # character, without trailing .sh)
105 # - this list can be reduced for individual test cycles
107 # NSS_SSL_TESTS - list of ssl tests to run (see ssl.sh)
108 # NSS_SSL_RUN - list of sss sub-tests to run (see ssl.sh)
114 # +------------+------------+-----------+ ~ run_cycles
116 # standard pkix upgradedb sharedb ~ run_cycle_*
118 # +------+------+------+-----> ~ run_tests
120 # cert tools fips ssl ... ~ . *.sh
124 # FIXME ... known problems, search for this string
125 # NOTE .... unexpected behavior
129 # Unlike the old QA this is based on files sourcing each other
130 # This is done to save time, since a great portion of time is lost
131 # in calling and sourcing the same things multiple times over the
132 # network. Also, this way all scripts have all shell function
133 # available and a completely common environment
135 ########################################################################
137 ############################## run_tests ###############################
138 # run test suites defined in TESTS variable, skip scripts defined in
139 # TESTS_SKIP variable
140 ########################################################################
145 echo "${TESTS_SKIP}" |
grep "${TEST}" > /dev
/null
146 if [ $?
-eq 0 ]; then
150 SCRIPTNAME
=${TEST}.sh
151 echo "Running tests for ${TEST}"
152 echo "TIMESTAMP ${TEST} BEGIN: `date`"
153 (cd ${QADIR}/${TEST}; . ./${SCRIPTNAME} 2>&1)
154 echo "TIMESTAMP ${TEST} END: `date`"
158 ########################## run_cycle_standard ##########################
159 # run test suites with defaults settings (no PKIX, no sharedb)
160 ########################################################################
171 ############################ run_cycle_pkix ############################
172 # run test suites with PKIX enabled
173 ########################################################################
178 TABLE_ARGS
="bgcolor=cyan"
179 html_head
"Testing with PKIX"
182 HOSTDIR
="${HOSTDIR}/pkix"
183 mkdir
-p "${HOSTDIR}"
186 NSS_ENABLE_PKIX_VERIFY
="1"
187 export NSS_ENABLE_PKIX_VERIFY
190 TESTS_SKIP
="cipher dbtests sdr crmf smime merge"
192 echo "${NSS_SSL_TESTS}" |
grep "_" > /dev
/null
194 NSS_SSL_TESTS
=`echo "${NSS_SSL_TESTS}" | sed -e "s/normal//g" -e "s/bypass//g" -e "s/fips//g" -e "s/_//g"`
195 [ ${RET} -eq 0 ] && NSS_SSL_TESTS
="${NSS_SSL_TESTS} bypass_bypass"
200 ######################### run_cycle_upgrade_db #########################
201 # upgrades certificate database to shareable format and run test suites
202 # with those databases
203 ########################################################################
204 run_cycle_upgrade_db
()
208 TABLE_ARGS
="bgcolor=pink"
209 html_head
"Testing with upgraded library"
212 OLDHOSTDIR
="${HOSTDIR}"
213 HOSTDIR
="${HOSTDIR}/upgradedb"
214 mkdir
-p "${HOSTDIR}"
217 if [ -r "${OLDHOSTDIR}/cert.log" ]; then
218 DIRS
="alicedir bobdir CA cert_extensions client clientCA dave eccurves eve ext_client ext_server fips SDR server serverCA tools/copydir cert.log cert.done tests.*"
221 cp -r ${OLDHOSTDIR}/${i} ${HOSTDIR} #2> /dev/null
225 # upgrade certs dbs to shared db
231 NSS_DEFAULT_DB_TYPE
="sql"
232 export NSS_DEFAULT_DB_TYPE
234 # run the subset of tests with the upgraded database
236 TESTS_SKIP
="cipher libpkix cert dbtests sdr ocsp pkits"
238 echo "${NSS_SSL_TESTS}" |
grep "_" > /dev
/null
240 NSS_SSL_TESTS
=`echo "${NSS_SSL_TESTS}" | sed -e "s/normal//g" -e "s/bypass//g" -e "s/fips//g" -e "s/_//g"`
241 [ ${RET} -eq 0 ] && NSS_SSL_TESTS
="${NSS_SSL_TESTS} bypass_bypass"
242 NSS_SSL_RUN
=`echo "${NSS_SSL_RUN}" | sed -e "s/cov//g" -e "s/auth//g"`
247 ########################## run_cycle_shared_db #########################
248 # run test suites with certificate databases set to shareable format
249 ########################################################################
250 run_cycle_shared_db
()
254 TABLE_ARGS
="bgcolor=yellow"
255 html_head
"Testing with shared library"
258 HOSTDIR
="${HOSTDIR}/sharedb"
259 mkdir
-p "${HOSTDIR}"
262 NSS_DEFAULT_DB_TYPE
="sql"
263 export NSS_DEFAULT_DB_TYPE
265 # run the tests for native sharedb support
267 TESTS_SKIP
="cipher libpkix dbupgrade sdr ocsp pkits"
269 echo "${NSS_SSL_TESTS}" |
grep "_" > /dev
/null
271 NSS_SSL_TESTS
=`echo "${NSS_SSL_TESTS}" | sed -e "s/normal//g" -e "s/bypass//g" -e "s/fips//g" -e "s/_//g"`
272 [ ${RET} -eq 0 ] && NSS_SSL_TESTS
="${NSS_SSL_TESTS} bypass_bypass"
273 NSS_SSL_RUN
=`echo "${NSS_SSL_RUN}" | sed -e "s/cov//g" -e "s/auth//g"`
278 ############################# run_cycles ###############################
279 # run test cycles defined in CYCLES variable
280 ########################################################################
283 for CYCLE
in ${CYCLES}
303 ############################## main code ###############################
305 cycles
="standard pkix upgradedb sharedb"
306 CYCLES
=${NSS_CYCLES:-$cycles}
308 tests
="cipher libpkix cert dbtests tools fips sdr crmf smime ssl ocsp merge pkits"
309 TESTS
=${NSS_TESTS:-$tests}
311 # FIXME: move check for ${BUILD_LIBPKIX_TESTS} to libpkix.sh
312 if [ -z "${BUILD_LIBPKIX_TESTS}" ] ; then
313 TESTS
=`echo "${TESTS}" | sed -e "s/libpkix//"`
317 nss_ssl_tests
="crl bypass_normal normal_bypass fips_normal normal_fips iopr"
318 NSS_SSL_TESTS
="${NSS_SSL_TESTS:-$nss_ssl_tests}"
320 nss_ssl_run
="cov auth stress"
321 NSS_SSL_RUN
="${NSS_SSL_RUN:-$nss_ssl_run}"
324 CLEANUP
="${SCRIPTNAME}"
327 # all.sh should be the first one to try to source the init
328 if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
334 # Since in make at the top level, modutil is the last file
335 # created, we check for modutil to know whether the build
336 # is complete. If a new file is created after that, the
337 # following test for modutil should check for that instead.
339 if [ ! -f ${DIST}/${OBJDIR}/bin
/modutil
-a \
340 ! -f ${DIST}/${OBJDIR}/bin
/modutil.exe
]; then
341 echo "Build Incomplete. Aborting test." >> ${LOGFILE}
342 html_head
"Testing Initialization"
343 Exit
"Checking for build"
347 # Lists of enabled tests and other settings are stored to ${ENV_BACKUP}
348 # file and are are restored after every test cycle.
350 ENV_BACKUP
=${HOSTDIR}/env.sh
351 env_backup
> ${ENV_BACKUP}
353 if [ "${O_CRON}" = "ON" ]; then
354 run_cycles
>> ${LOGFILE}
356 run_cycles |
tee -a ${LOGFILE}
361 .
${QADIR}/common
/cleanup.sh