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 $       ASN1TEST :=     asn1test
75 $
76 $       tests_i = 0
77 $ loop_tests:
78 $       tests_e = f$element(tests_i,",",tests)
79 $       tests_i = tests_i + 1
80 $       if tests_e .eqs. "," then goto exit
81 $       write sys$output "---> ''tests_e'"
82 $       gosub 'tests_e'
83 $       goto loop_tests
84 $
85 $ test_evp:
86 $       mcr 'texe_dir''evptest' evptests.txt
87 $       return
88 $ test_des:
89 $       mcr 'texe_dir''destest'
90 $       return
91 $ test_idea:
92 $       mcr 'texe_dir''ideatest'
93 $       return
94 $ test_sha:
95 $       mcr 'texe_dir''shatest'
96 $       mcr 'texe_dir''sha1test'
97 $       return
98 $ test_mdc2:
99 $       mcr 'texe_dir''mdc2test'
100 $       return
101 $ test_md5:
102 $       mcr 'texe_dir''md5test'
103 $       return
104 $ test_md4:
105 $       mcr 'texe_dir''md4test'
106 $       return
107 $ test_hmac:
108 $       mcr 'texe_dir''hmactest'
109 $       return
110 $ test_wp:
111 $       mcr 'texe_dir''wptest'
112 $       return
113 $ test_md2:
114 $       mcr 'texe_dir''md2test'
115 $       return
116 $ test_rmd:
117 $       mcr 'texe_dir''rmdtest'
118 $       return
119 $ test_bf:
120 $       mcr 'texe_dir''bftest'
121 $       return
122 $ test_cast:
123 $       mcr 'texe_dir''casttest'
124 $       return
125 $ test_rc2:
126 $       mcr 'texe_dir''rc2test'
127 $       return
128 $ test_rc4:
129 $       mcr 'texe_dir''rc4test'
130 $       return
131 $ test_rc5:
132 $       mcr 'texe_dir''rc5test'
133 $       return
134 $ test_rand:
135 $       mcr 'texe_dir''randtest'
136 $       return
137 $ test_enc:
138 $       @testenc.com
139 $       return
140 $ test_x509:
141 $       define sys$error nla0:
142 $       write sys$output "test normal x509v1 certificate"
143 $       @tx509.com
144 $       write sys$output "test first x509v3 certificate"
145 $       @tx509.com v3-cert1.pem
146 $       write sys$output "test second x509v3 certificate"
147 $       @tx509.com v3-cert2.pem
148 $       deassign sys$error
149 $       return
150 $ test_rsa:
151 $       define sys$error nla0:
152 $       @trsa.com
153 $       deassign sys$error
154 $       mcr 'texe_dir''rsatest'
155 $       return
156 $ test_crl:
157 $       define sys$error nla0:
158 $       @tcrl.com
159 $       deassign sys$error
160 $       return
161 $ test_sid:
162 $       define sys$error nla0:
163 $       @tsid.com
164 $       deassign sys$error
165 $       return
166 $ test_req:
167 $       define sys$error nla0:
168 $       @treq.com
169 $       @treq.com testreq2.pem
170 $       deassign sys$error
171 $       return
172 $ test_pkcs7:
173 $       define sys$error nla0:
174 $       @tpkcs7.com
175 $       @tpkcs7d.com
176 $       deassign sys$error
177 $       return
178 $ test_bn:
179 $       write sys$output -
180               "starting big number library test, could take a while..."
181 $       set noon
182 $       define sys$error nl:
183 $       define sys$output nl:
184 $       @ bctest.com
185 $       status = $status
186 $       deassign sys$error
187 $       deassign sys$output
188 $       on control_y then goto exit
189 $       on error then goto exit
190 $       if (status)
191 $       then
192 $           create /fdl = sys$input bntest-vms.tmp
193 FILE
194         ORGANIZATION    sequential
195 RECORD
196         FORMAT          stream_lf
197 $           define /user_mode sys$output bntest-vms.tmp
198 $           mcr 'texe_dir''bntest'
199 $           define /user_mode sys$input bntest-vms.tmp
200 $           define /user_mode sys$output bntest-vms.out
201 $           bc
202 $           @ bntest.com bntest-vms.out
203 $           status = $status
204 $           if (status)
205 $           then
206 $               delete bntest-vms.out;*
207 $               delete bntest-vms.tmp;*
208 $           endif
209 $       else
210 $           create /fdl = sys$input bntest-vms.sh
211 FILE
212         ORGANIZATION    sequential
213 RECORD
214         FORMAT          stream_lf
215 $           open /append bntest_file bntest-vms.sh
216 $           type /output = bntest_file sys$input:
217 << __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"'
218 $           define/user sys$output bntest-vms.tmp
219 $           mcr 'texe_dir''bntest'
220 $           copy bntest-vms.tmp bntest_file
221 $           delete bntest-vms.tmp;*
222 $           type /output = bntest_file sys$input:
223 __FOO__
224 $           close bntest_file
225 $           write sys$output "-- copy the [.test]bntest-vms.sh and [.test]bctest files to a Unix system and"
226 $           write sys$output "-- run bntest-vms.sh through sh or bash to verify that the bignum operations"
227 $           write sys$output "-- went well."
228 $           write sys$output ""
229 $       endif
230 $       write sys$output "test a^b%c implementations"
231 $       mcr 'texe_dir''exptest'
232 $       return
233 $ test_ec:
234 $       write sys$output "test elliptic curves"
235 $       mcr 'texe_dir''ectest'
236 $       return
237 $ test_ecdsa:
238 $       write sys$output "test ecdsa"
239 $       mcr 'texe_dir''ecdsatest'
240 $       return
241 $ test_ecdh:
242 $       write sys$output "test ecdh"
243 $       mcr 'texe_dir''ecdhtest'
244 $       return
245 $ test_verify:
246 $       write sys$output "The following command should have some OK's and some failures"
247 $       write sys$output "There are definitly a few expired certificates"
248 $       @tverify.com
249 $       return
250 $ test_dh:
251 $       write sys$output "Generate a set of DH parameters"
252 $       mcr 'texe_dir''dhtest'
253 $       return
254 $ test_dsa:
255 $       write sys$output "Generate a set of DSA parameters"
256 $       mcr 'texe_dir''dsatest'
257 $       return
258 $ test_gen:
259 $       write sys$output "Generate and verify a certificate request"
260 $       @testgen.com
261 $       return
262 $ maybe_test_ss:
263 $       testss_RDT = f$cvtime(f$file_attributes("testss.com","RDT"))
264 $       if f$cvtime(f$file_attributes("keyU.ss","RDT")) .les. testss_RDT then -
265                 goto test_ss
266 $       if f$cvtime(f$file_attributes("certU.ss","RDT")) .les. testss_RDT then -
267                 goto test_ss
268 $       if f$cvtime(f$file_attributes("certCA.ss","RDT")) .les. testss_RDT then -
269                 goto test_ss
270 $       return
271 $ test_ss:
272 $       write sys$output "Generate and certify a test certificate"
273 $       @testss.com
274 $       return
275 $ test_engine: 
276 $       write sys$output "Manipulate the ENGINE structures"
277 $       mcr 'texe_dir''enginetest'
278 $       return
279 $ test_ssl:
280 $       write sys$output "test SSL protocol"
281 $       gosub maybe_test_ss
282 $       @testssl.com keyU.ss certU.ss certCA.ss
283 $       return
284 $ test_ca:
285 $       set noon
286 $       define/user sys$output nla0:
287 $       mcr 'exe_dir'openssl no-rsa
288 $       save_severity=$SEVERITY
289 $       set on
290 $       if save_severity
291 $       then
292 $           write sys$output "skipping CA.com test -- requires RSA"
293 $       else
294 $           write sys$output "Generate and certify a test certificate via the 'ca' program"
295 $           @testca.com
296 $       endif
297 $       return
298 $ test_aes: 
299 $!      write sys$output "test AES"
300 $!      !mcr 'texe_dir''aestest'
301 $       return
302 $ test_tsa:
303 $       set noon
304 $       define/user sys$output nla0:
305 $       mcr 'exe_dir'openssl no-rsa
306 $       save_severity=$SEVERITY
307 $       set on
308 $       if save_severity
309 $       then
310 $           write sys$output "skipping testtsa.com test -- requires RSA"
311 $       else
312 $           @testtsa.com
313 $       endif
314 $       return
315 $ test_ige: 
316 $       write sys$output "Test IGE mode"
317 $       mcr 'texe_dir''igetest'
318 $       return
319 $ test_jpake: 
320 $       write sys$output "Test JPAKE"
321 $       mcr 'texe_dir''jpaketest'
322 $       return
323 $ test_cms:
324 $       write sys$output "CMS consistency test"
325 $       ! The following makes perl include the DCL symbol table in the env.
326 $       define/user perl_env_tables clisym_local,lnm$file_dev,ctrl_env
327 $       perl CMS-TEST.PL
328 $       return
329 $
330 $
331 $ exit:
332 $       mcr 'exe_dir'openssl version -a
333 $       set default '__save_default'
334 $       deassign sslroot
335 $       exit