Placeholder for SCO bc bug detection
[openssl.git] / test / bctest
1 #!/bin/sh
2
3 # This script is used by test/Makefile.ssl to check whether a sane 'bc'
4 # is installed.
5 # ('make test_bn' should not try to run 'bc' if it does not exist or if
6 # it is the broken SunOS 5.[78] bc, which fails the following test.)
7 #
8 # If 'bc' works, we also test if it knows the 'print' command.
9 #
10 # In any case, output an appropriate command line for running (or not
11 # running) bc.
12
13 if [ 0 != "`bc <<\EOF
14 obase=16
15 ibase=16
16 a=AD88C418F31B3FC712D0425001D522B3AE9134FF3A98C13C1FCC1682211195406C1A6C66C6A\
17 CEEC1A0EC16950233F77F1C2F2363D56DD71A36C57E0B2511FC4BA8F22D261FE2E9356D99AF57\
18 10F3817C0E05BF79C423C3F66FDF321BE8D3F18F625D91B670931C1EF25F28E489BDA1C5422D1\
19 C3F6F7A1AD21585746ECC4F10A14A778AF56F08898E965E9909E965E0CB6F85B514150C644759\
20 3BE731877B16EA07B552088FF2EA728AC5E0FF3A23EB939304519AB8B60F2C33D6BA0945B66F0\
21 4FC3CADF855448B24A9D7640BCF473E
22 b=DCE91E7D120B983EA9A104B5A96D634DD644C37657B1C7860B45E6838999B3DCE5A555583C6\
23 9209E41F413422954175A06E67FFEF6746DD652F0F48AEFECC3D8CAC13523BDAAD3F5AF4212BD\
24 8B3CD64126E1A82E190228020C05B91C8B141F1110086FC2A4C6ED631EBA129D04BB9A19FC53D\
25 3ED0E2017D60A68775B75481449
26 (a/b)*b + (a%b) - a
27 EOF`" ]
28 then
29   echo "bc does not work.  Consider installing GNU bc." >&2
30   echo "cat >/dev/null"
31   exit 1
32 fi
33
34
35 # insert SCO bc test case here:
36 if [ 0 != "`bc <<\EOF
37 0
38 EOF`" ]
39 then
40   echo "bc does not work.  Consider installing GNU bc." >&2
41   echo "cat >/dev/null"
42   exit 1
43 fi
44
45
46 # bc works, good.
47 # Now check if it knows the 'print' command.
48 if [ "OK" = "`bc 2>/dev/null <<\EOF
49 print \"OK\"
50 EOF`" ]
51 then
52     echo "bc"
53 else
54     echo "sed 's/print.*//' | bc"
55 fi
56
57 exit 0