From dd5463333966c46f6a40df2cac53ab21962f303f Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Thu, 28 Nov 2002 18:56:18 +0000 Subject: [PATCH] Have all tests use EXIT() to exit rather than exit(), since the latter doesn't always give the expected result on some platforms. --- crypto/bf/bftest.c | 4 +++- crypto/bn/bntest.c | 12 ++++++------ crypto/bn/exptest.c | 19 +++++++++++-------- crypto/cast/casttest.c | 4 +++- crypto/dh/dhtest.c | 7 +++++-- crypto/dsa/dsatest.c | 7 +++++-- crypto/hmac/hmactest.c | 4 +++- crypto/idea/ideatest.c | 4 +++- crypto/md2/md2test.c | 4 +++- crypto/md4/md4test.c | 4 +++- crypto/md5/md5test.c | 4 +++- crypto/mdc2/mdc2test.c | 4 +++- crypto/rand/randtest.c | 4 +++- crypto/rc2/rc2test.c | 4 +++- crypto/rc4/rc4test.c | 4 +++- crypto/rc5/rc5test.c | 4 +++- crypto/ripemd/rmdtest.c | 4 +++- crypto/sha/sha1test.c | 4 +++- crypto/sha/shatest.c | 4 +++- ssl/ssltest.c | 2 +- test/methtest.c | 4 ++-- 21 files changed, 75 insertions(+), 36 deletions(-) diff --git a/crypto/bf/bftest.c b/crypto/bf/bftest.c index cf67cadefd..212edfaf62 100644 --- a/crypto/bf/bftest.c +++ b/crypto/bf/bftest.c @@ -63,6 +63,8 @@ #include #include +#include "../e_os.h" + #ifdef NO_BF int main(int argc, char *argv[]) { @@ -275,7 +277,7 @@ int main(int argc, char *argv[]) else ret=test(); - exit(ret); + EXIT(ret); return(0); } diff --git a/crypto/bn/bntest.c b/crypto/bn/bntest.c index af0c2629e8..6ae2b4aff0 100644 --- a/crypto/bn/bntest.c +++ b/crypto/bn/bntest.c @@ -139,10 +139,10 @@ int main(int argc, char *argv[]) ctx=BN_CTX_new(); - if (ctx == NULL) exit(1); + if (ctx == NULL) EXIT(1); out=BIO_new(BIO_s_file()); - if (out == NULL) exit(1); + if (out == NULL) EXIT(1); if (outfile == NULL) { BIO_set_fp(out,stdout,BIO_NOCLOSE); @@ -152,7 +152,7 @@ int main(int argc, char *argv[]) if (!BIO_write_filename(out,outfile)) { perror(outfile); - exit(1); + EXIT(1); } } @@ -228,14 +228,14 @@ int main(int argc, char *argv[]) BIO_free(out); /**/ - exit(0); + EXIT(0); err: BIO_puts(out,"1\n"); /* make sure the Perl script fed by bc notices * the failure, see test_bn in test/Makefile.ssl*/ BIO_flush(out); ERR_load_crypto_strings(); ERR_print_errors_fp(stderr); - exit(1); + EXIT(1); return(1); } @@ -746,7 +746,7 @@ int test_mod_mul(BIO *bp, BN_CTX *ctx) while ((l=ERR_get_error())) fprintf(stderr,"ERROR:%s\n", ERR_error_string(l,NULL)); - exit(1); + EXIT(1); } if (bp != NULL) { diff --git a/crypto/bn/exptest.c b/crypto/bn/exptest.c index 3e86f2ea0e..b3b807af38 100644 --- a/crypto/bn/exptest.c +++ b/crypto/bn/exptest.c @@ -59,6 +59,9 @@ #include #include #include + +#include "../e_os.h" + #include #include #include @@ -86,7 +89,7 @@ int main(int argc, char *argv[]) ERR_load_BN_strings(); ctx=BN_CTX_new(); - if (ctx == NULL) exit(1); + if (ctx == NULL) EXIT(1); r_mont=BN_new(); r_recp=BN_new(); r_simple=BN_new(); @@ -99,7 +102,7 @@ int main(int argc, char *argv[]) out=BIO_new(BIO_s_file()); - if (out == NULL) exit(1); + if (out == NULL) EXIT(1); BIO_set_fp(out,stdout,BIO_NOCLOSE); for (i=0; i<200; i++) @@ -124,7 +127,7 @@ int main(int argc, char *argv[]) { printf("BN_mod_exp_mont() problems\n"); ERR_print_errors(out); - exit(1); + EXIT(1); } ret=BN_mod_exp_recp(r_recp,a,b,m,ctx); @@ -132,7 +135,7 @@ int main(int argc, char *argv[]) { printf("BN_mod_exp_recp() problems\n"); ERR_print_errors(out); - exit(1); + EXIT(1); } ret=BN_mod_exp_simple(r_simple,a,b,m,ctx); @@ -140,7 +143,7 @@ int main(int argc, char *argv[]) { printf("BN_mod_exp_simple() problems\n"); ERR_print_errors(out); - exit(1); + EXIT(1); } if (BN_cmp(r_simple, r_mont) == 0 @@ -163,7 +166,7 @@ int main(int argc, char *argv[]) printf("\nrecp ="); BN_print(out,r_recp); printf("\nmont ="); BN_print(out,r_mont); printf("\n"); - exit(1); + EXIT(1); } } BN_free(r_mont); @@ -177,11 +180,11 @@ int main(int argc, char *argv[]) CRYPTO_mem_leaks(out); BIO_free(out); printf(" done\n"); - exit(0); + EXIT(0); err: ERR_load_crypto_strings(); ERR_print_errors(out); - exit(1); + EXIT(1); return(1); } diff --git a/crypto/cast/casttest.c b/crypto/cast/casttest.c index ab2aeac606..0e1034da45 100644 --- a/crypto/cast/casttest.c +++ b/crypto/cast/casttest.c @@ -60,6 +60,8 @@ #include #include +#include "../e_os.h" + #ifdef NO_CAST int main(int argc, char *argv[]) { @@ -224,7 +226,7 @@ int main(int argc, char *argv[]) } #endif - exit(err); + EXIT(err); return(err); } #endif diff --git a/crypto/dh/dhtest.c b/crypto/dh/dhtest.c index a38465da13..c57cac099d 100644 --- a/crypto/dh/dhtest.c +++ b/crypto/dh/dhtest.c @@ -59,6 +59,9 @@ #include #include #include + +#include "../e_os.h" + #ifdef WINDOWS #include "../bio/bss_file.c" #endif @@ -107,7 +110,7 @@ int main(int argc, char *argv[]) RAND_seed(rnd_seed, sizeof rnd_seed); out=BIO_new(BIO_s_file()); - if (out == NULL) exit(1); + if (out == NULL) EXIT(1); BIO_set_fp(out,stdout,BIO_NOCLOSE); a=DH_generate_parameters(64,DH_GENERATOR_5,cb,out); @@ -188,7 +191,7 @@ err: if(b != NULL) DH_free(b); if(a != NULL) DH_free(a); BIO_free(out); - exit(ret); + EXIT(ret); return(ret); } diff --git a/crypto/dsa/dsatest.c b/crypto/dsa/dsatest.c index 309a7cda89..9599cd62ad 100644 --- a/crypto/dsa/dsatest.c +++ b/crypto/dsa/dsatest.c @@ -61,6 +61,9 @@ #include #include #include + +#include "../e_os.h" + #include #include #include @@ -207,7 +210,7 @@ end: BIO_free(bio_err); bio_err = NULL; } - exit(!ret); + EXIT(!ret); return(0); } @@ -226,7 +229,7 @@ static void MS_CALLBACK dsa_cb(int p, int n, void *arg) if (!ok && (p == 0) && (num > 1)) { BIO_printf((BIO *)arg,"error in dsatest\n"); - exit(1); + EXIT(1); } } #endif diff --git a/crypto/hmac/hmactest.c b/crypto/hmac/hmactest.c index 4b56b8ee13..3bc476b9c7 100644 --- a/crypto/hmac/hmactest.c +++ b/crypto/hmac/hmactest.c @@ -60,6 +60,8 @@ #include #include +#include "../e_os.h" + #ifdef NO_HMAC int main(int argc, char *argv[]) { @@ -143,7 +145,7 @@ int main(int argc, char *argv[]) else printf("test %d ok\n",i); } - exit(err); + EXIT(err); return(0); } diff --git a/crypto/idea/ideatest.c b/crypto/idea/ideatest.c index 64b9353e41..01d43adb19 100644 --- a/crypto/idea/ideatest.c +++ b/crypto/idea/ideatest.c @@ -60,6 +60,8 @@ #include #include +#include "../e_os.h" + #ifdef NO_IDEA int main(int argc, char *argv[]) { @@ -167,7 +169,7 @@ int main(int argc, char *argv[]) else printf("ok\n"); - exit(err); + EXIT(err); return(err); } diff --git a/crypto/md2/md2test.c b/crypto/md2/md2test.c index e3f4fb4c34..4d7231753b 100644 --- a/crypto/md2/md2test.c +++ b/crypto/md2/md2test.c @@ -60,6 +60,8 @@ #include #include +#include "../e_os.h" + #ifdef NO_MD2 int main(int argc, char *argv[]) { @@ -119,7 +121,7 @@ int main(int argc, char *argv[]) R++; P++; } - exit(err); + EXIT(err); return(0); } diff --git a/crypto/md4/md4test.c b/crypto/md4/md4test.c index 97e6e21efd..faa9e84a9a 100644 --- a/crypto/md4/md4test.c +++ b/crypto/md4/md4test.c @@ -60,6 +60,8 @@ #include #include +#include "../e_os.h" + #ifdef NO_MD4 int main(int argc, char *argv[]) { @@ -115,7 +117,7 @@ int main(int argc, char *argv[]) R++; P++; } - exit(err); + EXIT(err); return(0); } diff --git a/crypto/md5/md5test.c b/crypto/md5/md5test.c index 6bd8656302..e3258cc0bf 100644 --- a/crypto/md5/md5test.c +++ b/crypto/md5/md5test.c @@ -60,6 +60,8 @@ #include #include +#include "../e_os.h" + #ifdef NO_MD5 int main(int argc, char *argv[]) { @@ -115,7 +117,7 @@ int main(int argc, char *argv[]) R++; P++; } - exit(err); + EXIT(err); return(0); } diff --git a/crypto/mdc2/mdc2test.c b/crypto/mdc2/mdc2test.c index 46c25aeff4..bad02979ee 100644 --- a/crypto/mdc2/mdc2test.c +++ b/crypto/mdc2/mdc2test.c @@ -60,6 +60,8 @@ #include #include +#include "../e_os.h" + #if defined(NO_DES) && !defined(NO_MDC2) #define NO_MDC2 #endif @@ -134,7 +136,7 @@ int main(int argc, char *argv[]) else printf("pad2 - ok\n"); - exit(ret); + EXIT(ret); return(ret); } #endif diff --git a/crypto/rand/randtest.c b/crypto/rand/randtest.c index da96e3f695..abee3f7b2b 100644 --- a/crypto/rand/randtest.c +++ b/crypto/rand/randtest.c @@ -60,6 +60,8 @@ #include #include +#include "../e_os.h" + /* some FIPS 140-1 random number test */ /* some simple tests */ @@ -202,6 +204,6 @@ int main() } printf("test 4 done\n"); err=((err)?1:0); - exit(err); + EXIT(err); return(err); } diff --git a/crypto/rc2/rc2test.c b/crypto/rc2/rc2test.c index 521269ded1..bf8bc5d02f 100644 --- a/crypto/rc2/rc2test.c +++ b/crypto/rc2/rc2test.c @@ -63,6 +63,8 @@ #include #include +#include "../e_os.h" + #ifdef NO_RC2 int main(int argc, char *argv[]) { @@ -203,7 +205,7 @@ int main(int argc, char *argv[]) printf("ok\n"); #endif - exit(err); + EXIT(err); return(err); } diff --git a/crypto/rc4/rc4test.c b/crypto/rc4/rc4test.c index 3914eb6c38..3aa40ed235 100644 --- a/crypto/rc4/rc4test.c +++ b/crypto/rc4/rc4test.c @@ -60,6 +60,8 @@ #include #include +#include "../e_os.h" + #ifdef NO_RC4 int main(int argc, char *argv[]) { @@ -195,7 +197,7 @@ int main(int argc, char *argv[]) } } printf("done\n"); - exit(err); + EXIT(err); return(0); } #endif diff --git a/crypto/rc5/rc5test.c b/crypto/rc5/rc5test.c index 634ceac7c7..84e7c71d21 100644 --- a/crypto/rc5/rc5test.c +++ b/crypto/rc5/rc5test.c @@ -63,6 +63,8 @@ #include #include +#include "../e_os.h" + #ifdef NO_RC5 int main(int argc, char *argv[]) { @@ -318,7 +320,7 @@ int main(int argc, char *argv[]) } if (err == 0) printf("cbc RC5 ok\n"); - exit(err); + EXIT(err); return(err); } diff --git a/crypto/ripemd/rmdtest.c b/crypto/ripemd/rmdtest.c index 5d79c99725..dd3a49d705 100644 --- a/crypto/ripemd/rmdtest.c +++ b/crypto/ripemd/rmdtest.c @@ -60,6 +60,8 @@ #include #include +#include "../e_os.h" + #ifdef NO_RIPEMD int main(int argc, char *argv[]) { @@ -124,7 +126,7 @@ int main(int argc, char *argv[]) R++; P++; } - exit(err); + EXIT(err); return(0); } diff --git a/crypto/sha/sha1test.c b/crypto/sha/sha1test.c index 688d06c637..8c2bd33f56 100644 --- a/crypto/sha/sha1test.c +++ b/crypto/sha/sha1test.c @@ -60,6 +60,8 @@ #include #include +#include "../e_os.h" + #ifdef NO_SHA int main(int argc, char *argv[]) { @@ -152,7 +154,7 @@ int main(int argc, char *argv[]) } else printf("test 3 ok\n"); - exit(err); + EXIT(err); return(0); } diff --git a/crypto/sha/shatest.c b/crypto/sha/shatest.c index a5786bbf76..d9329f0307 100644 --- a/crypto/sha/shatest.c +++ b/crypto/sha/shatest.c @@ -60,6 +60,8 @@ #include #include +#include "../e_os.h" + #ifdef NO_SHA int main(int argc, char *argv[]) { @@ -152,7 +154,7 @@ int main(int argc, char *argv[]) } else printf("test 3 ok\n"); - exit(err); + EXIT(err); return(0); } diff --git a/ssl/ssltest.c b/ssl/ssltest.c index d6704852b4..3de9663e51 100644 --- a/ssl/ssltest.c +++ b/ssl/ssltest.c @@ -366,7 +366,7 @@ bad: "the test anyway (and\n-d to see what happens), " "or add one of -ssl2, -ssl3, -tls1, -reuse\n" "to avoid protocol mismatch.\n"); - exit(1); + EXIT(1); } if (print_time) diff --git a/test/methtest.c b/test/methtest.c index 06ccb3b310..005c2f4822 100644 --- a/test/methtest.c +++ b/test/methtest.c @@ -96,10 +96,10 @@ char *argv[]; METH_init(top); METH_control(tmp1,METH_CONTROL_DUMP,stdout); METH_control(tmp2,METH_CONTROL_DUMP,stdout); - exit(0); + EXIT(0); err: ERR_load_crypto_strings(); ERR_print_errors_fp(stderr); - exit(1); + EXIT(1); return(0); } -- 2.25.1