~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/security/nss/lib/freebl/mpi/all-tests

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
## The contents of this file are subject to the Mozilla Public
 
3
## License Version 1.1 (the "License"); you may not use this file
 
4
## except in compliance with the License. You may obtain a copy of
 
5
## the License at http://www.mozilla.org/MPL/
 
6
##
 
7
## Software distributed under the License is distributed on an "AS
 
8
## IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 
9
## implied. See the License for the specific language governing
 
10
## rights and limitations under the License.
 
11
##
 
12
## The Original Code is the MPI Arbitrary Precision Integer Arithmetic
 
13
## library.
 
14
##
 
15
## The Initial Developer of the Original Code is 
 
16
## Michael J. Fromberger <sting@linguist.dartmouth.edu>
 
17
##
 
18
## Portions created by Michael J. Fromberger are 
 
19
## Copyright (C) 1997, 1998, 1999, 2000 Michael J. Fromberger. 
 
20
## All Rights Reserved.
 
21
##
 
22
## Contributor(s):
 
23
##
 
24
## Alternatively, the contents of this file may be used under the
 
25
## terms of the GNU General Public License Version 2 or later (the
 
26
## "GPL"), in which case the provisions of the GPL are applicable
 
27
## instead of those above.  If you wish to allow use of your
 
28
## version of this file only under the terms of the GPL and not to
 
29
## allow others to use your version of this file under the MPL,
 
30
## indicate your decision by deleting the provisions above and
 
31
## replace them with the notice and other provisions required by
 
32
## the GPL.  If you do not delete the provisions above, a recipient
 
33
## may use your version of this file under either the MPL or the GPL.
 
34
 
 
35
ECHO=/bin/echo
 
36
MAKE=gmake
 
37
 
 
38
$ECHO "\n** Running unit tests for MPI library\n"
 
39
 
 
40
# Build the mpi-test program, which comprises all the unit tests for
 
41
# the MPI library...
 
42
 
 
43
$ECHO "Bringing mpi-test up to date ... "
 
44
if $MAKE mpi-test ; then
 
45
  :
 
46
else
 
47
  $ECHO " "
 
48
  $ECHO "Make failed to build mpi-test."
 
49
  $ECHO " "
 
50
  exit 1
 
51
fi
 
52
 
 
53
if [ ! -x mpi-test ] ; then
 
54
  $ECHO " "
 
55
  $ECHO "Cannot find 'mpi-test' program, testing cannot continue."
 
56
  $ECHO " "
 
57
  exit 1
 
58
fi
 
59
 
 
60
# Get the list of available test suites...
 
61
tests=`mpi-test list | awk '{print $1}'`
 
62
errs=0
 
63
 
 
64
# Run each test suite and check the result code of mpi-test
 
65
for test in $tests ; do
 
66
  $ECHO "$test ... \c"
 
67
  if mpi-test $test ; then
 
68
    $ECHO "passed"
 
69
  else
 
70
    $ECHO "FAILED"
 
71
    errs=1
 
72
  fi
 
73
done
 
74
 
 
75
# If any tests failed, we'll stop at this point
 
76
if [ "$errs" = "0" ] ; then
 
77
  $ECHO "All unit tests passed"
 
78
else
 
79
  $ECHO "One or more tests failed"
 
80
  exit 1
 
81
fi
 
82
 
 
83
# Now try to build the 'pi' program, and see if it can compute the
 
84
# first thousand digits of pi correctly
 
85
$ECHO "\n** Running other tests\n"
 
86
 
 
87
$ECHO "Bringing 'pi' up to date ... "
 
88
if $MAKE pi ; then
 
89
    :
 
90
else
 
91
    $ECHO "\nMake failed to build pi.\n"
 
92
    exit 1
 
93
fi
 
94
 
 
95
if [ ! -x pi ] ; then
 
96
    $ECHO "\nCannot find 'pi' program; testing cannot continue.\n"
 
97
    exit 1
 
98
fi
 
99
 
 
100
./pi 2000 > /tmp/pi.tmp.$$
 
101
if cmp tests/pi2k.txt /tmp/pi.tmp.$$ ; then
 
102
    $ECHO "Okay!  The pi test passes."
 
103
else
 
104
    $ECHO "Oops!  The pi test failed. :("
 
105
    exit 1
 
106
fi
 
107
 
 
108
rm -f /tmp/pi.tmp.$$
 
109
 
 
110
exit 0
 
111
 
 
112
# Here there be dragons