diff options
author | bluhm <> | 2019-09-05 00:59:36 +0000 |
---|---|---|
committer | bluhm <> | 2019-09-05 00:59:36 +0000 |
commit | faeb05507ff481a26bd58ec6a000224796fd5405 (patch) | |
tree | e3424b6452a8f571a8bd694238b06ae14f282581 /src | |
parent | ff57b9764545ea9d58b1f7eb642e5974b8728f92 (diff) | |
download | openbsd-faeb05507ff481a26bd58ec6a000224796fd5405.tar.gz openbsd-faeb05507ff481a26bd58ec6a000224796fd5405.tar.bz2 openbsd-faeb05507ff481a26bd58ec6a000224796fd5405.zip |
Feed the bntest output to bc(1). This checks the result of the big
num calculations and avoids lots of ugly output to stdout. Remove
fflush(3) of stderr, it is unbuffered anyway.
with Moritz Buhl
Diffstat (limited to 'src')
-rw-r--r-- | src/regress/lib/libcrypto/bn/general/Makefile | 22 | ||||
-rw-r--r-- | src/regress/lib/libcrypto/bn/general/bntest.c | 7 |
2 files changed, 16 insertions, 13 deletions
diff --git a/src/regress/lib/libcrypto/bn/general/Makefile b/src/regress/lib/libcrypto/bn/general/Makefile index d1a73a3769..ca3dcf9b08 100644 --- a/src/regress/lib/libcrypto/bn/general/Makefile +++ b/src/regress/lib/libcrypto/bn/general/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.5 2019/04/13 22:06:31 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.6 2019/09/05 00:59:36 bluhm Exp $ |
2 | 2 | ||
3 | .include "../../Makefile.inc" | 3 | .include "../../Makefile.inc" |
4 | 4 | ||
@@ -9,14 +9,22 @@ LDADD = ${CRYPTO_INT} | |||
9 | DPADD = ${LIBCRYPTO} | 9 | DPADD = ${LIBCRYPTO} |
10 | WARNINGS = Yes | 10 | WARNINGS = Yes |
11 | CFLAGS += -Werror | 11 | CFLAGS += -Werror |
12 | CLEANFILES = bntest.out bc.out | ||
12 | 13 | ||
13 | .for p in ${PROGS} | 14 | REGRESS_TARGETS += run-bntest |
14 | REGRESS_TARGETS += run-$p | 15 | run-bntest bntest.out: bntest |
16 | @echo '\n======== $@ ========' | ||
17 | ./bntest -out bntest.out | ||
15 | 18 | ||
16 | run-$p: $p | 19 | REGRESS_TARGETS += run-bc |
17 | ./$p | 20 | run-bc: bntest.out |
21 | @echo '\n======== $@ ========' | ||
22 | bc < bntest.out | tee bc.out | grep -v '^0$$' | ||
23 | ! grep -v '^test ' <bc.out | grep -v '^0$$' | ||
18 | 24 | ||
19 | .PHONY: run-$p | 25 | REGRESS_TARGETS += run-bn_to_string |
20 | .endfor | 26 | run-bn_to_string: bn_to_string |
27 | @echo '\n======== $@ ========' | ||
28 | ./bn_to_string | ||
21 | 29 | ||
22 | .include <bsd.regress.mk> | 30 | .include <bsd.regress.mk> |
diff --git a/src/regress/lib/libcrypto/bn/general/bntest.c b/src/regress/lib/libcrypto/bn/general/bntest.c index cff776068b..138b7673e6 100644 --- a/src/regress/lib/libcrypto/bn/general/bntest.c +++ b/src/regress/lib/libcrypto/bn/general/bntest.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bntest.c,v 1.20 2018/07/17 17:06:49 tb Exp $ */ | 1 | /* $OpenBSD: bntest.c,v 1.21 2019/09/05 00:59:36 bluhm Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -2028,7 +2028,6 @@ genprime_cb(int p, int n, BN_GENCB *arg) | |||
2028 | if (p == 3) | 2028 | if (p == 3) |
2029 | c = '\n'; | 2029 | c = '\n'; |
2030 | putc(c, stderr); | 2030 | putc(c, stderr); |
2031 | fflush(stderr); | ||
2032 | return (1); | 2031 | return (1); |
2033 | } | 2032 | } |
2034 | 2033 | ||
@@ -2116,11 +2115,9 @@ test_kron(BIO *bp, BN_CTX *ctx) | |||
2116 | } | 2115 | } |
2117 | 2116 | ||
2118 | putc('.', stderr); | 2117 | putc('.', stderr); |
2119 | fflush(stderr); | ||
2120 | } | 2118 | } |
2121 | 2119 | ||
2122 | putc('\n', stderr); | 2120 | putc('\n', stderr); |
2123 | fflush(stderr); | ||
2124 | rc = 1; | 2121 | rc = 1; |
2125 | err: | 2122 | err: |
2126 | BN_free(a); | 2123 | BN_free(a); |
@@ -2207,11 +2204,9 @@ test_sqrt(BIO *bp, BN_CTX *ctx) | |||
2207 | } | 2204 | } |
2208 | 2205 | ||
2209 | putc('.', stderr); | 2206 | putc('.', stderr); |
2210 | fflush(stderr); | ||
2211 | } | 2207 | } |
2212 | 2208 | ||
2213 | putc('\n', stderr); | 2209 | putc('\n', stderr); |
2214 | fflush(stderr); | ||
2215 | } | 2210 | } |
2216 | rc = 1; | 2211 | rc = 1; |
2217 | err: | 2212 | err: |