source: rtems-testing/rtems-coverage/run_coverage @ 9d00371

4.11
Last change on this file since 9d00371 was 9d00371, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 28, 2009 at 8:47:48 PM

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

  • do_coverage, run_coverage: Do not publish results by default.
  • 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    erc32|leon2|leon3)           ;; # SPARC
82    *)
83      echo "ERROR - does BSP (${bsp}) really exist and support coverage?"
84      exit 1
85  esac
86}
87
88verbose="no"
89
90while getopts v OPT
91do
92
93    case "$OPT" in
94      v) verbose=`toggle ${verbose}` ;;
95      *) fatal;;
96    esac
97done
98
99shiftcount=`expr $OPTIND - 1`
100shift $shiftcount
101
102args=$*
103
104if [ $# -eq 0 ] ; then
105  echo "No actions requested"
106  exit 0
107fi
108
109for cmd in $*
110do
111  case ${cmd} in
112    update)                      ;; # general commands
113    *_Os|*_O2|*_baseline)            # one BSP at specific -Ox level
114      bsp=`echo $cmd | sed -e 's/_.*$//'`
115      validate_bsp ${bsp}
116      ;;
117    *)
118      echo "Unknown command (${cmd})"
119      exit 1
120      ;;
121  esac
122done
123
124START=`date`
125
126cd ${BASEDIR}
127
128RESULTSDIR=${BASEDIR}/covrun-results
129test -d ${RESULTSDIR} || mkdir -p ${RESULTSDIR}
130for cmd in $*
131do
132  case ${cmd} in
133    update)
134      time ${COVBASE}/do_coverage -u -m -B ${bsp}
135      ;;
136    *_O[s2])
137      bsp=`echo $cmd | sed -e 's/_O.$//'`
138      Olevel=`echo $cmd | sed -e 's/.*_O\(.\)$/\1/'`
139      case ${Olevel} in
140        2)    do_one ${bsp} ;;
141        [sS]) do_one ${bsp} -S ;;
142        *)    echo ERROR unknown optimization level ; exit 1 ;;
143      esac
144      ;;
145    *_baseline)
146      bsp=`echo $cmd | sed -e 's/_baseline$//'`
147      do_one ${bsp} -S          # -Os / POSIX enabled  / regression
148      do_one ${bsp}             # -O2 / POSIX enabled  / regression
149      do_one ${bsp} -S -P       # -Os / POSIX disabled / regression
150      do_one ${bsp} -S -D       # -Os / POSIX enabled  / developmental
151      ;;
152    *)
153      echo "Unknown command (${cmd})"
154      exit 1
155      ;;
156  esac
157done
158
159STOP=`date`
160echo "STARTED AT: " ${START}
161echo "STOPPED AT: " ${STOP}
162
163exit 0
Note: See TracBrowser for help on using the repository browser.