Bug 469739 - Add support for displaying Vista UAC shield icon; r=joe sr=vladimir
[wine-gecko.git] / security / nss / tests / all.sh
blob288ecb9de3c6e6d78aa76be7139da428b1df5f53
1 #!/bin/bash
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):
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
46 # platforms
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
55 # all other tests
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
59 # - mode
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
80 # format)
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
100 # character)
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)
110 # Testing schema:
111 # ---------------
112 # all.sh ~ (main)
113 # | |
114 # +------------+------------+-----------+ ~ run_cycles
115 # | | | | |
116 # standard pkix upgradedb sharedb ~ run_cycle_*
117 # | |
118 # +------+------+------+-----> ~ run_tests
119 # | | | | |
120 # cert tools fips ssl ... ~ . *.sh
122 # Special strings:
123 # ----------------
124 # FIXME ... known problems, search for this string
125 # NOTE .... unexpected behavior
127 # NOTE:
128 # -----
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 ########################################################################
141 run_tests()
143 for TEST in ${TESTS}
145 echo "${TESTS_SKIP}" | grep "${TEST}" > /dev/null
146 if [ $? -eq 0 ]; then
147 continue
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`"
155 done
158 ########################## run_cycle_standard ##########################
159 # run test suites with defaults settings (no PKIX, no sharedb)
160 ########################################################################
161 run_cycle_standard()
163 TEST_MODE=STANDARD
165 TESTS="${ALL_TESTS}"
166 TESTS_SKIP=
168 run_tests
171 ############################ run_cycle_pkix ############################
172 # run test suites with PKIX enabled
173 ########################################################################
174 run_cycle_pkix()
176 TEST_MODE=PKIX
178 TABLE_ARGS="bgcolor=cyan"
179 html_head "Testing with PKIX"
180 html "</TABLE><BR>"
182 HOSTDIR="${HOSTDIR}/pkix"
183 mkdir -p "${HOSTDIR}"
184 init_directories
186 NSS_ENABLE_PKIX_VERIFY="1"
187 export NSS_ENABLE_PKIX_VERIFY
189 TESTS="${ALL_TESTS}"
190 TESTS_SKIP="cipher dbtests sdr crmf smime merge"
192 echo "${NSS_SSL_TESTS}" | grep "_" > /dev/null
193 RET=$?
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"
197 run_tests
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()
206 TEST_MODE=UPGRADE_DB
208 TABLE_ARGS="bgcolor=pink"
209 html_head "Testing with upgraded library"
210 html "</TABLE><BR>"
212 OLDHOSTDIR="${HOSTDIR}"
213 HOSTDIR="${HOSTDIR}/upgradedb"
214 mkdir -p "${HOSTDIR}"
215 init_directories
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.*"
219 for i in $DIRS
221 cp -r ${OLDHOSTDIR}/${i} ${HOSTDIR} #2> /dev/null
222 done
225 # upgrade certs dbs to shared db
226 TESTS="dbupgrade"
227 TESTS_SKIP=
229 run_tests
231 NSS_DEFAULT_DB_TYPE="sql"
232 export NSS_DEFAULT_DB_TYPE
234 # run the subset of tests with the upgraded database
235 TESTS="${ALL_TESTS}"
236 TESTS_SKIP="cipher libpkix cert dbtests sdr ocsp pkits"
238 echo "${NSS_SSL_TESTS}" | grep "_" > /dev/null
239 RET=$?
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"`
244 run_tests
247 ########################## run_cycle_shared_db #########################
248 # run test suites with certificate databases set to shareable format
249 ########################################################################
250 run_cycle_shared_db()
252 TEST_MODE=SHARED_DB
254 TABLE_ARGS="bgcolor=yellow"
255 html_head "Testing with shared library"
256 html "</TABLE><BR>"
258 HOSTDIR="${HOSTDIR}/sharedb"
259 mkdir -p "${HOSTDIR}"
260 init_directories
262 NSS_DEFAULT_DB_TYPE="sql"
263 export NSS_DEFAULT_DB_TYPE
265 # run the tests for native sharedb support
266 TESTS="${ALL_TESTS}"
267 TESTS_SKIP="cipher libpkix dbupgrade sdr ocsp pkits"
269 echo "${NSS_SSL_TESTS}" | grep "_" > /dev/null
270 RET=$?
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"`
275 run_tests
278 ############################# run_cycles ###############################
279 # run test cycles defined in CYCLES variable
280 ########################################################################
281 run_cycles()
283 for CYCLE in ${CYCLES}
285 case "${CYCLE}" in
286 "standard")
287 run_cycle_standard
289 "pkix")
290 run_cycle_pkix
292 "upgradedb")
293 run_cycle_upgrade_db
295 "sharedb")
296 run_cycle_shared_db
298 esac
299 . ${ENV_BACKUP}
300 done
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//"`
315 ALL_TESTS=${TESTS}
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}"
323 SCRIPTNAME=all.sh
324 CLEANUP="${SCRIPTNAME}"
325 cd `dirname $0`
327 # all.sh should be the first one to try to source the init
328 if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
329 cd common
330 . ./init.sh
333 # NOTE:
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"
346 # NOTE:
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}
355 else
356 run_cycles | tee -a ${LOGFILE}
359 SCRIPTNAME=all.sh
361 . ${QADIR}/common/cleanup.sh