aboutsummaryrefslogtreecommitdiffstats
path: root/test/ccured_olden/power/testit
blob: b5132dd792231f1d247ec4d024aa98dacba35a30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh
# test a power binary

if [ "$1" = "" ]; then
  echo "usage: $0 ./power.exe"
  exit
fi

# all of power's output is to stdout
echo "running: $1 >output"
if ! $1 >output; then
  echo "$1 failed directly"
  exit 2
fi

# must strip elapsed time
# must truncate precision to only 5 decimal places, because gcc's optimizer
# (even with -ffloat-store) seems to change the answer under boxing
if ! grep -v "Elapsed time" <output | \
     sed 's/\(\.[0-9]\{5\}\)[0-9]*/\1/g' | diff out.orig - >/dev/null; then
  echo "$1 got the wrong answer"
  exit 4
else
  echo "$1 seems to work"
fi