1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/freebl/mpi/all-tests Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,83 @@ 1.4 +#!/bin/sh 1.5 +# This Source Code Form is subject to the terms of the Mozilla Public 1.6 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.8 + 1.9 +ECHO=/bin/echo 1.10 +MAKE=gmake 1.11 + 1.12 +$ECHO "\n** Running unit tests for MPI library\n" 1.13 + 1.14 +# Build the mpi-test program, which comprises all the unit tests for 1.15 +# the MPI library... 1.16 + 1.17 +$ECHO "Bringing mpi-test up to date ... " 1.18 +if $MAKE mpi-test ; then 1.19 + : 1.20 +else 1.21 + $ECHO " " 1.22 + $ECHO "Make failed to build mpi-test." 1.23 + $ECHO " " 1.24 + exit 1 1.25 +fi 1.26 + 1.27 +if [ ! -x mpi-test ] ; then 1.28 + $ECHO " " 1.29 + $ECHO "Cannot find 'mpi-test' program, testing cannot continue." 1.30 + $ECHO " " 1.31 + exit 1 1.32 +fi 1.33 + 1.34 +# Get the list of available test suites... 1.35 +tests=`./mpi-test list | awk '{print $1}'` 1.36 +errs=0 1.37 + 1.38 +# Run each test suite and check the result code of mpi-test 1.39 +for test in $tests ; do 1.40 + $ECHO "$test ... \c" 1.41 + if ./mpi-test $test ; then 1.42 + $ECHO "passed" 1.43 + else 1.44 + $ECHO "FAILED" 1.45 + errs=1 1.46 + fi 1.47 +done 1.48 + 1.49 +# If any tests failed, we'll stop at this point 1.50 +if [ "$errs" = "0" ] ; then 1.51 + $ECHO "All unit tests passed" 1.52 +else 1.53 + $ECHO "One or more tests failed" 1.54 + exit 1 1.55 +fi 1.56 + 1.57 +# Now try to build the 'pi' program, and see if it can compute the 1.58 +# first thousand digits of pi correctly 1.59 +$ECHO "\n** Running other tests\n" 1.60 + 1.61 +$ECHO "Bringing 'pi' up to date ... " 1.62 +if $MAKE pi ; then 1.63 + : 1.64 +else 1.65 + $ECHO "\nMake failed to build pi.\n" 1.66 + exit 1 1.67 +fi 1.68 + 1.69 +if [ ! -x pi ] ; then 1.70 + $ECHO "\nCannot find 'pi' program; testing cannot continue.\n" 1.71 + exit 1 1.72 +fi 1.73 + 1.74 +./pi 2000 > /tmp/pi.tmp.$$ 1.75 +if cmp tests/pi2k.txt /tmp/pi.tmp.$$ ; then 1.76 + $ECHO "Okay! The pi test passes." 1.77 +else 1.78 + $ECHO "Oops! The pi test failed. :(" 1.79 + exit 1 1.80 +fi 1.81 + 1.82 +rm -f /tmp/pi.tmp.$$ 1.83 + 1.84 +exit 0 1.85 + 1.86 +# Here there be dragons