brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · d887a61 Raw
86 lines · bash
1#!/bin/bash2## 3## Name:     test.sh4## Purpose:  Run test suites for IMath library.5##6## Copyright (C) 2002-2007 Michael J. Fromberger. All Rights Reserved.7##8 9set -o pipefail10 11if [ ! -f ../imtest ] ; then12  echo "I can't find the imath test driver 'imtest', did you build it?"13  echo "I can't proceed with the unit tests until you do so, sorry."14  exit 215fi16 17echo "-- Running all available unit tests"18if ../imtest *.tc | (grep -v 'OK'||true) ; then19    echo "ALL PASSED"20else21    echo "FAILED"22    exit 123fi24 25echo ""26echo "-- Running test to compute 1024 decimal digits of pi"27if [ ! -f ../pi ] ; then28  echo "I can't find the pi computing program, did you build it?"29  echo "I can't proceed with the pi test until you do so, sorry."30  exit 131fi32 33tempfile="/tmp/pi.1024.$$"34 35../pi 1024 | tr -d '\r\n' > ${tempfile}36if cmp -s ${tempfile} ./pi1024.txt ; then37  echo "  PASSED 1024 digits"38else39  echo "  FAILED"40  echo "Obtained:"41  cat ${tempfile}42  echo "Expected:"43  cat ./pi1024.txt44fi45rm -f ${tempfile}46 47tempfile="/tmp/pi.1698.$$"48 49echo "-- Running test to compute 1698 hexadecimal digits of pi"50 51../pi 1698 16 | tr -d '\r\n' > ${tempfile}52if cmp -s ${tempfile} ./pi1698-16.txt ; then53  echo "  PASSED 1698 digits"54else55  echo "  FAILED"56  echo "Obtained:"57  cat ${tempfile}58  echo "Expected:"59  cat ./pi1698-16.txt60fi61rm -f ${tempfile}62 63tempfile="/tmp/pi.1500.$$"64 65echo "-- Running test to compute 1500 decimal digits of pi"66 67../pi 1500 10 | tr -d '\r\n' > ${tempfile}68if cmp -s ${tempfile} ./pi1500-10.txt ; then69  echo "  PASSED 1500 digits"70else71  echo "  FAILED"72  echo "Obtained:"73  cat ${tempfile}74  echo "Expected:"75  cat ./pi1500-10.txt76fi77rm -f ${tempfile}78 79echo "-- Running regression tests"80 81for bug in bug-swap ; do82    ../${bug}83done84 85exit 086