summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2000-12-06 09:48:57 +0000
committerBodo Möller <bodo@openssl.org>2000-12-06 09:48:57 +0000
commitf67868ff4cc6e7a5e46dd1a73de60243dabb3e4a (patch)
treebfa1a3304739b1ecdd00470cee5734dd4cdf6e96 /test
parenta6576c56ddb2c09f6d78f6d29917eb1442c2c5f2 (diff)
Workaround for broken (or missing) bc.
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.ssl8
-rwxr-xr-xtest/bctest23
2 files changed, 29 insertions, 2 deletions
diff --git a/test/Makefile.ssl b/test/Makefile.ssl
index 1a4ccb5f8b..867789847c 100644
--- a/test/Makefile.ssl
+++ b/test/Makefile.ssl
@@ -195,8 +195,12 @@ test_bn:
@echo starting big number library test, could take a while...
@./$(BNTEST) >tmp.bntest
@echo quit >>tmp.bntest
- @echo "running bc"
- @bc tmp.bntest 2>&1 | $(PERL) -e 'while (<STDIN>) {if (/^test (.*)/) {print STDERR "\nverify $$1";} elsif (!/^0$$/) {die "\nFailed! bc: $$_";} print STDERR "."; $$i++;} print STDERR "\n$$i tests passed\n"'
+ @if sh ./bctest; then \
+ echo "running bc"; \
+ bc tmp.bntest 2>&1 | $(PERL) -e 'while (<STDIN>) {if (/^test (.*)/) {print STDERR "\nverify $$1";} elsif (!/^0$$/) {die "\nFailed! bc: $$_";} print STDERR "."; $$i++;} print STDERR "\n$$i tests passed\n"'; \
+ else \
+ echo "skipping bc-based verification"; \
+ fi
@echo 'test a^b%c implementations'
./$(EXPTEST)
diff --git a/test/bctest b/test/bctest
new file mode 100755
index 0000000000..2365152439
--- /dev/null
+++ b/test/bctest
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+if [ 0 != "`bc <<\EOF
+obase=16
+ibase=16
+a=AD88C418F31B3FC712D0425001D522B3AE9134FF3A98C13C1FCC1682211195406C1A6C66C6A\
+CEEC1A0EC16950233F77F1C2F2363D56DD71A36C57E0B2511FC4BA8F22D261FE2E9356D99AF57\
+10F3817C0E05BF79C423C3F66FDF321BE8D3F18F625D91B670931C1EF25F28E489BDA1C5422D1\
+C3F6F7A1AD21585746ECC4F10A14A778AF56F08898E965E9909E965E0CB6F85B514150C644759\
+3BE731877B16EA07B552088FF2EA728AC5E0FF3A23EB939304519AB8B60F2C33D6BA0945B66F0\
+4FC3CADF855448B24A9D7640BCF473E
+b=DCE91E7D120B983EA9A104B5A96D634DD644C37657B1C7860B45E6838999B3DCE5A555583C6\
+9209E41F413422954175A06E67FFEF6746DD652F0F48AEFECC3D8CAC13523BDAAD3F5AF4212BD\
+8B3CD64126E1A82E190228020C05B91C8B141F1110086FC2A4C6ED631EBA129D04BB9A19FC53D\
+3ED0E2017D60A68775B75481449
+(a/b)*b + (a%b) - a
+EOF`" ]
+then
+ echo "bc does not work. Consider installing GNU bc." >&2
+ exit 1
+else
+ exit 0
+fi