1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/tests/libpkix/libpkix.sh Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,139 @@ 1.4 +#! /bin/sh 1.5 +# 1.6 +# This Source Code Form is subject to the terms of the Mozilla Public 1.7 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.9 +# 1.10 +# runTests.sh 1.11 +# 1.12 + 1.13 +totalErrors=0 1.14 +pkixErrors=0 1.15 +pkixplErrors=0 1.16 +checkMemArg="" 1.17 +arenasArg="" 1.18 +quietArg="" 1.19 +memText="" 1.20 + 1.21 +############################## libpkix_init ############################### 1.22 +# local shell function to initialize this script 1.23 +######################################################################## 1.24 +libpkix_init() 1.25 +{ 1.26 + SCRIPTNAME="libpkix.sh" 1.27 + if [ -z "${CLEANUP}" ] ; then # if nobody else is responsible for 1.28 + CLEANUP="${SCRIPTNAME}" # cleaning this script will do it 1.29 + fi 1.30 + 1.31 + LIBPKIX_CURDIR=`pwd` 1.32 + if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ] ; then 1.33 + cd ../common 1.34 + . ./init.sh 1.35 + fi 1.36 + cd ${LIBPKIX_CURDIR} 1.37 + 1.38 + SCRIPTNAME="libpkix.sh" 1.39 +} 1.40 + 1.41 +############################## libpkix_cleanup ############################ 1.42 +# local shell function to finish this script (no exit since it might be 1.43 +# sourced) 1.44 +######################################################################## 1.45 +libpkix_cleanup() 1.46 +{ 1.47 + html "</TABLE><BR>" 1.48 + cd ${QADIR} 1.49 + . common/cleanup.sh 1.50 +} 1.51 + 1.52 +############################## libpkix_UT_main ############################ 1.53 +# local shell function to run libpkix unit tests 1.54 +######################################################################## 1.55 +ParseArgs () 1.56 +{ 1.57 + while [ $# -gt 0 ]; do 1.58 + if [ $1 == "-checkmem" ]; then 1.59 + checkMemArg=$1 1.60 + memText=" (Memory Checking Enabled)" 1.61 + elif [ $1 == "-quiet" ]; then 1.62 + quietArg=$1 1.63 + elif [ $1 == "-arenas" ]; then 1.64 + arenasArg=$1 1.65 + fi 1.66 + shift 1.67 + done 1.68 +} 1.69 + 1.70 +libpkix_UT_main() 1.71 +{ 1.72 + 1.73 +html_head "LIBPKIX Unit Tests" 1.74 + 1.75 +ParseArgs 1.76 + 1.77 +echo "*******************************************************************************" 1.78 +echo "START OF ALL TESTS${memText}" 1.79 +echo "*******************************************************************************" 1.80 +echo "" 1.81 + 1.82 +echo "RUNNING tests in pkix_pl_test"; 1.83 +html_msg 0 0 "Running tests in pkix_pl_test:" 1.84 +cd pkix_pl_tests; 1.85 +runPLTests.sh ${arenasArg} ${checkMemArg} ${quietArg} 1.86 +pkixplErrors=$? 1.87 +html_msg $? 0 "Results of tests in pkix_pl_test" 1.88 + 1.89 +echo "RUNNING tests in pkix_test"; 1.90 +html_msg 0 0 "Running tests in pkix_test:" 1.91 +cd ../pkix_tests; 1.92 +runTests.sh ${arenasArg} ${checkMemArg} ${quietArg} 1.93 +pkixErrors=$? 1.94 +html_msg $? 0 "Results of tests in pkix_test" 1.95 + 1.96 +echo "RUNNING performance tests in sample_apps"; 1.97 +html_msg 0 0 "Running performance tests in sample_apps:" 1.98 +cd ../sample_apps; 1.99 +runPerf.sh ${arenasArg} ${checkMemArg} ${quietArg} 1.100 +pkixPerfErrors=$? 1.101 +html_msg $? 0 "Results of performance tests in sample_apps" 1.102 + 1.103 +totalErrors=`expr ${pkixErrors} + ${pkixplErrors} + ${pkixPerfErrors}` 1.104 + 1.105 +if [ ${totalErrors} -eq 0 ]; then 1.106 + echo "" 1.107 + echo "************************************************************" 1.108 + echo "END OF ALL TESTS: ALL TESTS COMPLETED SUCCESSFULLY" 1.109 + echo "************************************************************" 1.110 + html_msg ${totalErrors} 0 "ALL LIBPKIX TESTS COMPLETED SUCCESSFULLY" 1.111 + 1.112 + return 0 1.113 +fi 1.114 + 1.115 +if [ ${totalErrors} -eq 1 ]; then 1.116 + plural="" 1.117 +else 1.118 + plural="S" 1.119 +fi 1.120 + 1.121 +if [ ${totalErrors} -ne 0 ]; then 1.122 + echo "" 1.123 + echo "************************************************************" 1.124 + echo "END OF ALL TESTS: ${totalErrors} TEST${plural} FAILED" 1.125 + echo "************************************************************" 1.126 + html_msg 1 0 "${totalErrors} LIBPKIX TEST${plural} FAILED" 1.127 +return 1 1.128 +fi 1.129 +} 1.130 + 1.131 +libpkix_run_tests() 1.132 +{ 1.133 + if [ -n "${BUILD_LIBPKIX_TESTS}" ]; then 1.134 + libpkix_UT_main 1.135 + fi 1.136 +} 1.137 + 1.138 +################## main ################################################# 1.139 + 1.140 +libpkix_init 1.141 +libpkix_run_tests 1.142 +libpkix_cleanup