security/nss/tests/libpkix/libpkix.sh

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rwxr-xr-x

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 #! /bin/sh
michael@0 2 #
michael@0 3 # This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 # License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 6 #
michael@0 7 # runTests.sh
michael@0 8 #
michael@0 9
michael@0 10 totalErrors=0
michael@0 11 pkixErrors=0
michael@0 12 pkixplErrors=0
michael@0 13 checkMemArg=""
michael@0 14 arenasArg=""
michael@0 15 quietArg=""
michael@0 16 memText=""
michael@0 17
michael@0 18 ############################## libpkix_init ###############################
michael@0 19 # local shell function to initialize this script
michael@0 20 ########################################################################
michael@0 21 libpkix_init()
michael@0 22 {
michael@0 23 SCRIPTNAME="libpkix.sh"
michael@0 24 if [ -z "${CLEANUP}" ] ; then # if nobody else is responsible for
michael@0 25 CLEANUP="${SCRIPTNAME}" # cleaning this script will do it
michael@0 26 fi
michael@0 27
michael@0 28 LIBPKIX_CURDIR=`pwd`
michael@0 29 if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ] ; then
michael@0 30 cd ../common
michael@0 31 . ./init.sh
michael@0 32 fi
michael@0 33 cd ${LIBPKIX_CURDIR}
michael@0 34
michael@0 35 SCRIPTNAME="libpkix.sh"
michael@0 36 }
michael@0 37
michael@0 38 ############################## libpkix_cleanup ############################
michael@0 39 # local shell function to finish this script (no exit since it might be
michael@0 40 # sourced)
michael@0 41 ########################################################################
michael@0 42 libpkix_cleanup()
michael@0 43 {
michael@0 44 html "</TABLE><BR>"
michael@0 45 cd ${QADIR}
michael@0 46 . common/cleanup.sh
michael@0 47 }
michael@0 48
michael@0 49 ############################## libpkix_UT_main ############################
michael@0 50 # local shell function to run libpkix unit tests
michael@0 51 ########################################################################
michael@0 52 ParseArgs ()
michael@0 53 {
michael@0 54 while [ $# -gt 0 ]; do
michael@0 55 if [ $1 == "-checkmem" ]; then
michael@0 56 checkMemArg=$1
michael@0 57 memText=" (Memory Checking Enabled)"
michael@0 58 elif [ $1 == "-quiet" ]; then
michael@0 59 quietArg=$1
michael@0 60 elif [ $1 == "-arenas" ]; then
michael@0 61 arenasArg=$1
michael@0 62 fi
michael@0 63 shift
michael@0 64 done
michael@0 65 }
michael@0 66
michael@0 67 libpkix_UT_main()
michael@0 68 {
michael@0 69
michael@0 70 html_head "LIBPKIX Unit Tests"
michael@0 71
michael@0 72 ParseArgs
michael@0 73
michael@0 74 echo "*******************************************************************************"
michael@0 75 echo "START OF ALL TESTS${memText}"
michael@0 76 echo "*******************************************************************************"
michael@0 77 echo ""
michael@0 78
michael@0 79 echo "RUNNING tests in pkix_pl_test";
michael@0 80 html_msg 0 0 "Running tests in pkix_pl_test:"
michael@0 81 cd pkix_pl_tests;
michael@0 82 runPLTests.sh ${arenasArg} ${checkMemArg} ${quietArg}
michael@0 83 pkixplErrors=$?
michael@0 84 html_msg $? 0 "Results of tests in pkix_pl_test"
michael@0 85
michael@0 86 echo "RUNNING tests in pkix_test";
michael@0 87 html_msg 0 0 "Running tests in pkix_test:"
michael@0 88 cd ../pkix_tests;
michael@0 89 runTests.sh ${arenasArg} ${checkMemArg} ${quietArg}
michael@0 90 pkixErrors=$?
michael@0 91 html_msg $? 0 "Results of tests in pkix_test"
michael@0 92
michael@0 93 echo "RUNNING performance tests in sample_apps";
michael@0 94 html_msg 0 0 "Running performance tests in sample_apps:"
michael@0 95 cd ../sample_apps;
michael@0 96 runPerf.sh ${arenasArg} ${checkMemArg} ${quietArg}
michael@0 97 pkixPerfErrors=$?
michael@0 98 html_msg $? 0 "Results of performance tests in sample_apps"
michael@0 99
michael@0 100 totalErrors=`expr ${pkixErrors} + ${pkixplErrors} + ${pkixPerfErrors}`
michael@0 101
michael@0 102 if [ ${totalErrors} -eq 0 ]; then
michael@0 103 echo ""
michael@0 104 echo "************************************************************"
michael@0 105 echo "END OF ALL TESTS: ALL TESTS COMPLETED SUCCESSFULLY"
michael@0 106 echo "************************************************************"
michael@0 107 html_msg ${totalErrors} 0 "ALL LIBPKIX TESTS COMPLETED SUCCESSFULLY"
michael@0 108
michael@0 109 return 0
michael@0 110 fi
michael@0 111
michael@0 112 if [ ${totalErrors} -eq 1 ]; then
michael@0 113 plural=""
michael@0 114 else
michael@0 115 plural="S"
michael@0 116 fi
michael@0 117
michael@0 118 if [ ${totalErrors} -ne 0 ]; then
michael@0 119 echo ""
michael@0 120 echo "************************************************************"
michael@0 121 echo "END OF ALL TESTS: ${totalErrors} TEST${plural} FAILED"
michael@0 122 echo "************************************************************"
michael@0 123 html_msg 1 0 "${totalErrors} LIBPKIX TEST${plural} FAILED"
michael@0 124 return 1
michael@0 125 fi
michael@0 126 }
michael@0 127
michael@0 128 libpkix_run_tests()
michael@0 129 {
michael@0 130 if [ -n "${BUILD_LIBPKIX_TESTS}" ]; then
michael@0 131 libpkix_UT_main
michael@0 132 fi
michael@0 133 }
michael@0 134
michael@0 135 ################## main #################################################
michael@0 136
michael@0 137 libpkix_init
michael@0 138 libpkix_run_tests
michael@0 139 libpkix_cleanup

mercurial