source: rtems-testing/rtems-coverage/run_coverage @ dc795fa

4.11
Last change on this file since dc795fa was dc795fa, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 29, 2009 at 7:05:48 PM

2009-09-29 Joel Sherrill <joel.sherrill@…>

  • ObjdumpProcessor?.cc, do_coverage, run_coverage: Add initial powerpc/qemuppc support.
  • Property mode set to 100755
File size: 3.0 KB
Line 
1#! /bin/bash
2#
3#  Script to help running coverage from cron
4#
5#  $Id$
6#
7
8vfile=`dirname $0`/VERSIONS-COVERAGE
9if [ ! -r ${vfile} ] ; then
10  echo VERSIONS-COVERAGE file not found
11  exit 1
12fi
13
14source ${vfile}
15
16if [ ! -d ${BASEDIR} ] ; then
17  echo Have you set the BASEDIR in VERSIONS correctly?
18  exit 1
19fi
20
21progname=${0##*/}        # fast basename hack for ksh, bash
22
23USAGE=\
24"usage: $progname [ -v ] cmd [ more cmds]
25        -v         -- verbose
26
27where cmds are:
28  update          - to update the RTEMS and Test Support source
29  BSP_TESTSET     - to perform TESTSET on BSP
30                    TESTSET may be baseline, O2, or Os
31"
32
33#   log an error to stderr
34prerr()
35{
36    echo "$*" >&2
37}
38
39fatal() {
40    prerr "$USAGE"
41    [ "$1" ] && (prerr ; prerr $*);
42    exit 1
43}
44
45warn() {
46    [ "$1" ] && prerr $*
47}
48
49check_status()
50{
51  if [ $1 -ne 0 ] ; then
52    shift
53    echo "FAILED: " "$*" >&2
54    exit 1
55  fi
56}
57
58toggle()
59{
60  case $1 in
61    no)  echo "yes" ;;
62    yes) echo "no" ;;
63    *)   fatal "Unknown value to toggle ($1)" ;;
64  esac
65}
66
67do_one()
68{
69  bsp=${1}
70  shift
71  time ${COVBASE}/do_coverage -A -u -m -f ${*} -B ${bsp}
72  rm -rf b-* *-tests
73}
74
75validate_bsp()
76{
77  case ${1} in
78    edb7312|gumstix|smdk2410)    ;; # ARM
79    pc386|qemu)                  ;; # i386
80    uC5282)                      ;; # m68k/Coldfire
81    qemuppc)                     ;; # PowerPC
82    erc32|leon2|leon3)           ;; # SPARC
83    *)
84      echo "ERROR - does BSP (${bsp}) really exist and support coverage?"
85      exit 1
86  esac
87}
88
89verbose="no"
90
91while getopts v OPT
92do
93
94    case "$OPT" in
95      v) verbose=`toggle ${verbose}` ;;
96      *) fatal;;
97    esac
98done
99
100shiftcount=`expr $OPTIND - 1`
101shift $shiftcount
102
103args=$*
104
105if [ $# -eq 0 ] ; then
106  echo "No actions requested"
107  exit 0
108fi
109
110for cmd in $*
111do
112  case ${cmd} in
113    update)                      ;; # general commands
114    *_Os|*_O2|*_baseline)            # one BSP at specific -Ox level
115      bsp=`echo $cmd | sed -e 's/_.*$//'`
116      validate_bsp ${bsp}
117      ;;
118    *)
119      echo "Unknown command (${cmd})"
120      exit 1
121      ;;
122  esac
123done
124
125START=`date`
126
127cd ${BASEDIR}
128
129RESULTSDIR=${BASEDIR}/covrun-results
130test -d ${RESULTSDIR} || mkdir -p ${RESULTSDIR}
131for cmd in $*
132do
133  case ${cmd} in
134    update)
135      time ${COVBASE}/do_coverage -u -m -B ${bsp}
136      ;;
137    *_O[s2])
138      bsp=`echo $cmd | sed -e 's/_O.$//'`
139      Olevel=`echo $cmd | sed -e 's/.*_O\(.\)$/\1/'`
140      case ${Olevel} in
141        2)    do_one ${bsp} ;;
142        [sS]) do_one ${bsp} -S ;;
143        *)    echo ERROR unknown optimization level ; exit 1 ;;
144      esac
145      ;;
146    *_baseline)
147      bsp=`echo $cmd | sed -e 's/_baseline$//'`
148      do_one ${bsp} -S          # -Os / POSIX enabled  / regression
149      do_one ${bsp}             # -O2 / POSIX enabled  / regression
150      do_one ${bsp} -S -P       # -Os / POSIX disabled / regression
151      do_one ${bsp} -S -D       # -Os / POSIX enabled  / developmental
152      ;;
153    *)
154      echo "Unknown command (${cmd})"
155      exit 1
156      ;;
157  esac
158done
159
160STOP=`date`
161echo "STARTED AT: " ${START}
162echo "STOPPED AT: " ${STOP}
163
164exit 0
Note: See TracBrowser for help on using the repository browser.