michael@0: #! /bin/sh michael@0: # michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: # michael@0: # runTests.sh michael@0: # michael@0: michael@0: totalErrors=0 michael@0: pkixErrors=0 michael@0: pkixplErrors=0 michael@0: checkMemArg="" michael@0: arenasArg="" michael@0: quietArg="" michael@0: memText="" michael@0: michael@0: ############################## libpkix_init ############################### michael@0: # local shell function to initialize this script michael@0: ######################################################################## michael@0: libpkix_init() michael@0: { michael@0: SCRIPTNAME="libpkix.sh" michael@0: if [ -z "${CLEANUP}" ] ; then # if nobody else is responsible for michael@0: CLEANUP="${SCRIPTNAME}" # cleaning this script will do it michael@0: fi michael@0: michael@0: LIBPKIX_CURDIR=`pwd` michael@0: if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ] ; then michael@0: cd ../common michael@0: . ./init.sh michael@0: fi michael@0: cd ${LIBPKIX_CURDIR} michael@0: michael@0: SCRIPTNAME="libpkix.sh" michael@0: } michael@0: michael@0: ############################## libpkix_cleanup ############################ michael@0: # local shell function to finish this script (no exit since it might be michael@0: # sourced) michael@0: ######################################################################## michael@0: libpkix_cleanup() michael@0: { michael@0: html "
" michael@0: cd ${QADIR} michael@0: . common/cleanup.sh michael@0: } michael@0: michael@0: ############################## libpkix_UT_main ############################ michael@0: # local shell function to run libpkix unit tests michael@0: ######################################################################## michael@0: ParseArgs () michael@0: { michael@0: while [ $# -gt 0 ]; do michael@0: if [ $1 == "-checkmem" ]; then michael@0: checkMemArg=$1 michael@0: memText=" (Memory Checking Enabled)" michael@0: elif [ $1 == "-quiet" ]; then michael@0: quietArg=$1 michael@0: elif [ $1 == "-arenas" ]; then michael@0: arenasArg=$1 michael@0: fi michael@0: shift michael@0: done michael@0: } michael@0: michael@0: libpkix_UT_main() michael@0: { michael@0: michael@0: html_head "LIBPKIX Unit Tests" michael@0: michael@0: ParseArgs michael@0: michael@0: echo "*******************************************************************************" michael@0: echo "START OF ALL TESTS${memText}" michael@0: echo "*******************************************************************************" michael@0: echo "" michael@0: michael@0: echo "RUNNING tests in pkix_pl_test"; michael@0: html_msg 0 0 "Running tests in pkix_pl_test:" michael@0: cd pkix_pl_tests; michael@0: runPLTests.sh ${arenasArg} ${checkMemArg} ${quietArg} michael@0: pkixplErrors=$? michael@0: html_msg $? 0 "Results of tests in pkix_pl_test" michael@0: michael@0: echo "RUNNING tests in pkix_test"; michael@0: html_msg 0 0 "Running tests in pkix_test:" michael@0: cd ../pkix_tests; michael@0: runTests.sh ${arenasArg} ${checkMemArg} ${quietArg} michael@0: pkixErrors=$? michael@0: html_msg $? 0 "Results of tests in pkix_test" michael@0: michael@0: echo "RUNNING performance tests in sample_apps"; michael@0: html_msg 0 0 "Running performance tests in sample_apps:" michael@0: cd ../sample_apps; michael@0: runPerf.sh ${arenasArg} ${checkMemArg} ${quietArg} michael@0: pkixPerfErrors=$? michael@0: html_msg $? 0 "Results of performance tests in sample_apps" michael@0: michael@0: totalErrors=`expr ${pkixErrors} + ${pkixplErrors} + ${pkixPerfErrors}` michael@0: michael@0: if [ ${totalErrors} -eq 0 ]; then michael@0: echo "" michael@0: echo "************************************************************" michael@0: echo "END OF ALL TESTS: ALL TESTS COMPLETED SUCCESSFULLY" michael@0: echo "************************************************************" michael@0: html_msg ${totalErrors} 0 "ALL LIBPKIX TESTS COMPLETED SUCCESSFULLY" michael@0: michael@0: return 0 michael@0: fi michael@0: michael@0: if [ ${totalErrors} -eq 1 ]; then michael@0: plural="" michael@0: else michael@0: plural="S" michael@0: fi michael@0: michael@0: if [ ${totalErrors} -ne 0 ]; then michael@0: echo "" michael@0: echo "************************************************************" michael@0: echo "END OF ALL TESTS: ${totalErrors} TEST${plural} FAILED" michael@0: echo "************************************************************" michael@0: html_msg 1 0 "${totalErrors} LIBPKIX TEST${plural} FAILED" michael@0: return 1 michael@0: fi michael@0: } michael@0: michael@0: libpkix_run_tests() michael@0: { michael@0: if [ -n "${BUILD_LIBPKIX_TESTS}" ]; then michael@0: libpkix_UT_main michael@0: fi michael@0: } michael@0: michael@0: ################## main ################################################# michael@0: michael@0: libpkix_init michael@0: libpkix_run_tests michael@0: libpkix_cleanup