summaryrefslogtreecommitdiffstats
path: root/c/src/tests/tools/generic/difftest
blob: 11d9ba9e2f1b0a54643a22079cdfe99abbb5dfdd (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!KSHELL -p
#
#  Check test results against official output in the src tree
#
#  $Id$
#

# XXX: do not run size.exe with this; it asks questions we don't answer

# how to do arith in bash
#    i=$((i * 2))
#    b=$((b + 1))

# progname=`basename $0`
progname=${0##*/}        # fast basename hack for ksh, bash

USAGE=\
"usage: $progname [ -opts ] test [ test ... ]
	-v	    -- verbose
        -l logdir   -- specify log directory (default is 'logdir')
"

#   log an error to stderr
prerr()
{
    echo "$*" >&2
}

fatal() {
    [ "$1" ] && prerr $*
    prerr "$USAGE"
    exit 1
}

warn() {
    [ "$1" ] && prerr $*
}

#
# process the options
#
# defaults for getopt vars
#

verbose=""
logdir=log

while getopts v12o:l: OPT
do
    case "$OPT" in
	v)
	    verbose="yes";;
        l)
            logdir="$OPTARG";;
        *)
            fatal;;
    esac
done
shiftcount=`expr $OPTIND - 1`
shift $shiftcount

args=$*

#
# Run the tests
#

cd $RTEMS_HOME/tests/$logdir || fatal "No log directory: $RTEMS_HOME/tests/$logdir"

tests="$args"
if [ ! "$tests" ]
then
     set -- `echo sp?? mp??_?`
     tests="$*"
fi

for t in $tests
do
   logfile=$t

   if [ ! -f $logfile ]
   then
        continue
   fi

   echo $logfile
   echo

   case $t in
       mp*)
           mptest=`echo $t | sed 's/_.//'`
           node=`echo $t | sed 's/...._//'`
           scn_file=$RTEMS_ROOT/c/src/tests/mptests/$mptest/node$node/$mptest.scn;;
       sp*)
           scn_file=$RTEMS_ROOT/c/src/tests/sptests/$t/$t.scn;;
       *)
           fatal "unknown test $t";;
   esac

   sed -e '/^$/d' < $logfile | diff -b $scn_file -
   echo
   echo
done

exit 0

# Local Variables: ***
# mode:ksh ***
# End: ***