Implement bc test strategy as submitted by Steven M. Schweda <sms@antinode.info>.
[openssl.git] / test / tests.com
1 $! TESTS.COM  --  Performs the necessary tests
2 $!
3 $! P1   tests to be performed.  Empty means all.
4 $
5 $       __proc = f$element(0,";",f$environment("procedure"))
6 $       __here = f$parse(f$parse("A.;",__proc) - "A.;","[]A.;") - "A.;"
7 $       __save_default = f$environment("default")
8 $       __arch := VAX
9 $       if f$getsyi("cpu") .ge. 128 then -
10            __arch = f$edit( f$getsyi( "ARCH_NAME"), "UPCASE")
11 $       if __arch .eqs. "" then __arch := UNK
12 $       texe_dir := sys$disk:[-.'__arch'.exe.test]
13 $       exe_dir := sys$disk:[-.'__arch'.exe.apps]
14 $
15 $       set default '__here'
16 $
17 $       sslroot = f$parse("sys$disk:[-.apps];",,,,"syntax_only") - "].;"+ ".]"
18 $       define /translation_attributes = concealed sslroot 'sslroot'
19 $       openssl_conf := sslroot:[000000]openssl-vms.cnf
20 $
21 $       on control_y then goto exit
22 $       on error then goto exit
23 $
24 $       if p1 .nes. ""
25 $       then
26 $           tests = p1
27 $       else
28 $! NOTE: This list reflects the list of dependencies following the
29 $! "alltests" target in Makefile.  This should make it easy to see
30 $! if there's a difference that needs to be taken care of.
31 $           tests := -
32         test_des,test_idea,test_sha,test_md4,test_md5,test_hmac,-
33         test_md2,test_mdc2,test_wp,-
34         test_rmd,test_rc2,test_rc4,test_rc5,test_bf,test_cast,test_aes,-
35         test_rand,test_bn,test_ec,test_ecdsa,test_ecdh,-
36         test_enc,test_x509,test_rsa,test_crl,test_sid,-
37         test_gen,test_req,test_pkcs7,test_verify,test_dh,test_dsa,-
38         test_ss,test_ca,test_engine,test_evp,test_ssl,test_tsa,test_ige,-
39         test_jpake,test_cms
40 $       endif
41 $       tests = f$edit(tests,"COLLAPSE")
42 $
43 $       BNTEST :=       bntest
44 $       ECTEST :=       ectest
45 $       ECDSATEST :=    ecdsatest
46 $       ECDHTEST :=     ecdhtest
47 $       EXPTEST :=      exptest
48 $       IDEATEST :=     ideatest
49 $       SHATEST :=      shatest
50 $       SHA1TEST :=     sha1test
51 $       MDC2TEST :=     mdc2test
52 $       RMDTEST :=      rmdtest
53 $       MD2TEST :=      md2test
54 $       MD4TEST :=      md4test
55 $       MD5TEST :=      md5test
56 $       HMACTEST :=     hmactest
57 $       WPTEST :=       wp_test
58 $       RC2TEST :=      rc2test
59 $       RC4TEST :=      rc4test
60 $       RC5TEST :=      rc5test
61 $       BFTEST :=       bftest
62 $       CASTTEST :=     casttest
63 $       DESTEST :=      destest
64 $       RANDTEST :=     randtest
65 $       DHTEST :=       dhtest
66 $       DSATEST :=      dsatest
67 $       METHTEST :=     methtest
68 $       SSLTEST :=      ssltest
69 $       RSATEST :=      rsa_test
70 $       ENGINETEST :=   enginetest
71 $       EVPTEST :=      evp_test
72 $       IGETEST :=      igetest
73 $       JPAKETEST :=    jpaketest
74 $
75 $       tests_i = 0
76 $ loop_tests:
77 $       tests_e = f$element(tests_i,",",tests)
78 $       tests_i = tests_i + 1
79 $       if tests_e .eqs. "," then goto exit
80 $       write sys$output "---> ''tests_e'"
81 $       gosub 'tests_e'
82 $       goto loop_tests
83 $
84 $ test_evp:
85 $       mcr 'texe_dir''evptest' evptests.txt
86 $       return
87 $ test_des:
88 $       mcr 'texe_dir''destest'
89 $       return
90 $ test_idea:
91 $       mcr 'texe_dir''ideatest'
92 $       return
93 $ test_sha:
94 $       mcr 'texe_dir''shatest'
95 $       mcr 'texe_dir''sha1test'
96 $       return
97 $ test_mdc2:
98 $       mcr 'texe_dir''mdc2test'
99 $       return
100 $ test_md5:
101 $       mcr 'texe_dir''md5test'
102 $       return
103 $ test_md4:
104 $       mcr 'texe_dir''md4test'
105 $       return
106 $ test_hmac:
107 $       mcr 'texe_dir''hmactest'
108 $       return
109 $ test_wp:
110 $       mcr 'texe_dir''wptest'
111 $       return
112 $ test_md2:
113 $       mcr 'texe_dir''md2test'
114 $       return
115 $ test_rmd:
116 $       mcr 'texe_dir''rmdtest'
117 $       return
118 $ test_bf:
119 $       mcr 'texe_dir''bftest'
120 $       return
121 $ test_cast:
122 $       mcr 'texe_dir''casttest'
123 $       return
124 $ test_rc2:
125 $       mcr 'texe_dir''rc2test'
126 $       return
127 $ test_rc4:
128 $       mcr 'texe_dir''rc4test'
129 $       return
130 $ test_rc5:
131 $       mcr 'texe_dir''rc5test'
132 $       return
133 $ test_rand:
134 $       mcr 'texe_dir''randtest'
135 $       return
136 $ test_enc:
137 $       @testenc.com
138 $       return
139 $ test_x509:
140 $       define sys$error nla0:
141 $       write sys$output "test normal x509v1 certificate"
142 $       @tx509.com
143 $       write sys$output "test first x509v3 certificate"
144 $       @tx509.com v3-cert1.pem
145 $       write sys$output "test second x509v3 certificate"
146 $       @tx509.com v3-cert2.pem
147 $       deassign sys$error
148 $       return
149 $ test_rsa:
150 $       define sys$error nla0:
151 $       @trsa.com
152 $       deassign sys$error
153 $       mcr 'texe_dir''rsatest'
154 $       return
155 $ test_crl:
156 $       define sys$error nla0:
157 $       @tcrl.com
158 $       deassign sys$error
159 $       return
160 $ test_sid:
161 $       define sys$error nla0:
162 $       @tsid.com
163 $       deassign sys$error
164 $       return
165 $ test_req:
166 $       define sys$error nla0:
167 $       @treq.com
168 $       @treq.com testreq2.pem
169 $       deassign sys$error
170 $       return
171 $ test_pkcs7:
172 $       define sys$error nla0:
173 $       @tpkcs7.com
174 $       @tpkcs7d.com
175 $       deassign sys$error
176 $       return
177 $ test_bn:
178 $       write sys$output -
179               "starting big number library test, could take a while..."
180 $       set noon
181 $       define sys$error nl:
182 $       define sys$output nl:
183 $       @ bctest.com
184 $       status = $status
185 $       deassign sys$error
186 $       deassign sys$output
187 $       on control_y then goto exit
188 $       on error then goto exit
189 $       if (status)
190 $       then
191 $           create /fdl = sys$input bntest-vms.tmp
192 FILE
193         ORGANIZATION    sequential
194 RECORD
195         FORMAT          stream_lf
196 $           define /user_mode sys$output bntest-vms.tmp
197 $           mcr 'texe_dir''bntest'
198 $           define /user_mode sys$input bntest-vms.tmp
199 $           define /user_mode sys$output bntest-vms.out
200 $           bc
201 $           @ bntest.com bntest-vms.out
202 $           status = $status
203 $           if (status)
204 $           then
205 $               delete bntest-vms.out;*
206 $               delete bntest-vms.tmp;*
207 $           endif
208 $       else
209 $           create /fdl = sys$input bntest-vms.sh
210 FILE
211         ORGANIZATION    sequential
212 RECORD
213         FORMAT          stream_lf
214 $           open /append bntest_file bntest-vms.sh
215 $           type /output = bntest_file sys$input:
216 << __FOO__ sh -c "`sh ./bctest`" | perl -e '$i=0; while (<STDIN>) {if (/^test (.*)/) {print STDERR "\nverify $1";} elsif (!/^0$/) {die "\nFailed! bc: $_";} else {print STDERR "."; $i++;}} print STDERR "\n$i tests passed\n"'
217 $           define/user sys$output bntest-vms.tmp
218 $           mcr 'texe_dir''bntest'
219 $           copy bntest-vms.tmp bntest_file
220 $           delete bntest-vms.tmp;*
221 $           type /output = bntest_file sys$input:
222 __FOO__
223 $           close bntest_file
224 $           write sys$output "-- copy the [.test]bntest-vms.sh and [.test]bctest files to a Unix system and"
225 $           write sys$output "-- run bntest-vms.sh through sh or bash to verify that the bignum operations"
226 $           write sys$output "-- went well."
227 $           write sys$output ""
228 $       endif
229 $       write sys$output "test a^b%c implementations"
230 $       mcr 'texe_dir''exptest'
231 $       return
232 $ test_ec:
233 $       write sys$output "test elliptic curves"
234 $       mcr 'texe_dir''ectest'
235 $       return
236 $ test_ecdsa:
237 $       write sys$output "test ecdsa"
238 $       mcr 'texe_dir''ecdsatest'
239 $       return
240 $ test_ecdh:
241 $       write sys$output "test ecdh"
242 $       mcr 'texe_dir''ecdhtest'
243 $       return
244 $ test_verify:
245 $       write sys$output "The following command should have some OK's and some failures"
246 $       write sys$output "There are definitly a few expired certificates"
247 $       @tverify.com
248 $       return
249 $ test_dh:
250 $       write sys$output "Generate a set of DH parameters"
251 $       mcr 'texe_dir''dhtest'
252 $       return
253 $ test_dsa:
254 $       write sys$output "Generate a set of DSA parameters"
255 $       mcr 'texe_dir''dsatest'
256 $       return
257 $ test_gen:
258 $       write sys$output "Generate and verify a certificate request"
259 $       @testgen.com
260 $       return
261 $ maybe_test_ss:
262 $       testss_RDT = f$cvtime(f$file_attributes("testss.com","RDT"))
263 $       if f$cvtime(f$file_attributes("keyU.ss","RDT")) .les. testss_RDT then -
264                 goto test_ss
265 $       if f$cvtime(f$file_attributes("certU.ss","RDT")) .les. testss_RDT then -
266                 goto test_ss
267 $       if f$cvtime(f$file_attributes("certCA.ss","RDT")) .les. testss_RDT then -
268                 goto test_ss
269 $       return
270 $ test_ss:
271 $       write sys$output "Generate and certify a test certificate"
272 $       @testss.com
273 $       return
274 $ test_engine: 
275 $       write sys$output "Manipulate the ENGINE structures"
276 $       mcr 'texe_dir''enginetest'
277 $       return
278 $ test_ssl:
279 $       write sys$output "test SSL protocol"
280 $       gosub maybe_test_ss
281 $       @testssl.com keyU.ss certU.ss certCA.ss
282 $       return
283 $ test_ca:
284 $       set noon
285 $       define/user sys$output nla0:
286 $       mcr 'exe_dir'openssl no-rsa
287 $       save_severity=$SEVERITY
288 $       set on
289 $       if save_severity
290 $       then
291 $           write sys$output "skipping CA.com test -- requires RSA"
292 $       else
293 $           write sys$output "Generate and certify a test certificate via the 'ca' program"
294 $           @testca.com
295 $       endif
296 $       return
297 $ test_aes: 
298 $!      write sys$output "test AES"
299 $!      !mcr 'texe_dir''aestest'
300 $       return
301 $ test_tsa:
302 $       set noon
303 $       define/user sys$output nla0:
304 $       mcr 'exe_dir'openssl no-rsa
305 $       save_severity=$SEVERITY
306 $       set on
307 $       if save_severity
308 $       then
309 $           write sys$output "skipping testtsa.com test -- requires RSA"
310 $       else
311 $           @testtsa.com
312 $       endif
313 $       return
314 $ test_ige: 
315 $       write sys$output "Test IGE mode"
316 $       mcr 'texe_dir''igetest'
317 $       return
318 $ test_jpake: 
319 $       write sys$output "Test JPAKE"
320 $       mcr 'texe_dir''jpaketest'
321 $       return
322 $ test_cms:
323 $       write sys$output "CMS consistency test"
324 $       ! The following makes perl include the DCL symbol table in the env.
325 $       define/user perl_env_tables clisym_local,lnm$file_dev,ctrl_env
326 $       perl CMS-TEST.PL
327 $       return
328 $
329 $
330 $ exit:
331 $       mcr 'exe_dir'openssl version -a
332 $       set default '__save_default'
333 $       deassign sslroot
334 $       exit