Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 #!/bin/sh
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 ECHO=/bin/echo
7 MAKE=gmake
9 $ECHO "\n** Running unit tests for MPI library\n"
11 # Build the mpi-test program, which comprises all the unit tests for
12 # the MPI library...
14 $ECHO "Bringing mpi-test up to date ... "
15 if $MAKE mpi-test ; then
16 :
17 else
18 $ECHO " "
19 $ECHO "Make failed to build mpi-test."
20 $ECHO " "
21 exit 1
22 fi
24 if [ ! -x mpi-test ] ; then
25 $ECHO " "
26 $ECHO "Cannot find 'mpi-test' program, testing cannot continue."
27 $ECHO " "
28 exit 1
29 fi
31 # Get the list of available test suites...
32 tests=`./mpi-test list | awk '{print $1}'`
33 errs=0
35 # Run each test suite and check the result code of mpi-test
36 for test in $tests ; do
37 $ECHO "$test ... \c"
38 if ./mpi-test $test ; then
39 $ECHO "passed"
40 else
41 $ECHO "FAILED"
42 errs=1
43 fi
44 done
46 # If any tests failed, we'll stop at this point
47 if [ "$errs" = "0" ] ; then
48 $ECHO "All unit tests passed"
49 else
50 $ECHO "One or more tests failed"
51 exit 1
52 fi
54 # Now try to build the 'pi' program, and see if it can compute the
55 # first thousand digits of pi correctly
56 $ECHO "\n** Running other tests\n"
58 $ECHO "Bringing 'pi' up to date ... "
59 if $MAKE pi ; then
60 :
61 else
62 $ECHO "\nMake failed to build pi.\n"
63 exit 1
64 fi
66 if [ ! -x pi ] ; then
67 $ECHO "\nCannot find 'pi' program; testing cannot continue.\n"
68 exit 1
69 fi
71 ./pi 2000 > /tmp/pi.tmp.$$
72 if cmp tests/pi2k.txt /tmp/pi.tmp.$$ ; then
73 $ECHO "Okay! The pi test passes."
74 else
75 $ECHO "Oops! The pi test failed. :("
76 exit 1
77 fi
79 rm -f /tmp/pi.tmp.$$
81 exit 0
83 # Here there be dragons