aboutsummaryrefslogtreecommitdiffstats
path: root/test/regression/Runtest
blob: 7cc6330b77b52e48acd4b3a6b6531b08929b4cda (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh

# The name of the test
name="$1"
shift

# The temp file for output
out="test$$.log"
rm -f $out
trap "rm -f $out" 0 INT QUIT

# The architecture and the model
arch=`sed -n -e 's/^ARCH=//p' ../../Makefile.config`
model=`sed -n -e 's/^MODEL=//p' ../../Makefile.config`

# Its bit size
case "$arch,$model" in
  ia32,64) bits=64;;
        *) bits=32;;
esac

# The reference output
if test -f "Results/$name-$arch-$model"; then
  ref="Results/$name-$arch-$model"
elif test -f "Results/$name-$arch"; then
  ref="Results/$name-$arch"
elif test -f "Results/$name-$bits"; then
  ref="Results/$name-$bits"
elif test -f "Results/$name"; then
  ref="Results/$name"
else
  ref=""
fi

# Administer the test
if $* > $out
then
  if test -n "$ref"; then
    if cmp -s "$out" "$ref"; then
      echo "$name: passed"
      exit 0
    else
      echo "$name: WRONG OUTPUT (diff follows)"
      diff -u "$ref" "$out"
      exit 2
    fi
  else
    echo "$name: passed"
    exit 0
  fi
else
  echo "$name: EXECUTION FAILED (status $?)"
  exit 2
fi