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