File: run.sh

package info (click to toggle)
cadical 2.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,216 kB
  • sloc: cpp: 36,901; ansic: 4,521; sh: 1,770; makefile: 91
file content (96 lines) | stat: -rwxr-xr-x 2,033 bytes parent folder | download | duplicates (3)
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
#!/bin/sh

die () {
  cecho "${HIDE}test/trace/run.sh:${NORMAL} ${BAD}error:${NORMAL} $*"
  exit 1
}

msg () {
  cecho "${HIDE}test/trace/run.sh:${NORMAL} $*"
}

for dir in . .. ../..
do
  [ -f $dir/scripts/colors.sh ] || continue
  . $dir/scripts/colors.sh || exit 1
  break
done

#--------------------------------------------------------------------------#

[ -d ../test -a -d ../test/trace ] || \
die "needs to be called from a top-level sub-directory of CaDiCaL"

[ x"$CADICALBUILD" = x ] && CADICALBUILD="../build"

[ -x "$CADICALBUILD/cadical" ] || \
  die "can not find '$CADICALBUILD/cadical' (run 'make' first)"

cecho -n "$HILITE"
cecho "---------------------------------------------------------"
cecho "Regression Testing API traces in '$CADICALBUILD'" 
cecho "---------------------------------------------------------"
cecho -n "$NORMAL"

cd $CADICALBUILD || exit 1
make
res=$?
[ $res = 0 ] || exit $res


#--------------------------------------------------------------------------#

ok=0
failed=0
executed=0

run () {
  msg "running ${HILITE}'$1'${NORMAL}"
  trace=../test/trace/$1.trace
  executed=`expr $executed + 1`
  cecho "$CADICALBUILD/mobical $trace"
  $CADICALBUILD/mobical $trace 2>/dev/null 1>/dev/null
  res=$?
  cecho $res
  if [ $res = 0 ]
  then
    cecho "# ... ${GOOD}ok${NORMAL}"
    ok=`expr $ok + 1`
  else
    cecho "# ... ${BAD}failed${NORMAL}"
    failed=`expr $failed + 1`
  fi
}

#--------------------------------------------------------------------------#

traces="`ls ../test/trace/*.trace|sed -e 's,.*/,,' -e 's,\.trace$,,'`"
numtraces="`echo $traces|wc -w`"
msg "found $numtraces traces"

for trace in $traces ignore
do
  [ $trace = ignore ] && continue
  run $trace
done

#--------------------------------------------------------------------------#

if [ $failed -gt 0 ]
then
  OK=""
  FAILED=$BAD
elif [ $ok -gt 0 ]
then
  OK=$GOOD
  FAILED=""
else
  OK=""
  FAILED=""
fi

msg "executed $executed traces," \
    "${OK}$ok ok${NORMAL}," \
    "${FAILED}$failed failed$NORMAL"

exit $failed