source: rtems-testing/rtems-coverage/run_coverage @ 487bf65

4.11
Last change on this file since 487bf65 was 487bf65, checked in by Joel Sherrill <joel.sherrill@…>, on Mar 13, 2011 at 10:16:37 PM

2011-03-13 Joel Sherrill <joel.sherrilL@…>

  • VERSIONS-COVERAGE, do_coverage, run_coverage: Make improvements so it is easier to run on released RTEMS versions.
  • Property mode set to 100755
File size: 4.1 KB
Line 
1#! /bin/bash
2#
3#  Script to help running coverage profiles
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 [ -opts ] cmd [ more cmds]
25        -t        -- publish the results to ftp site (default=yes)
26        -f        -- save the results locally (default=yes)
27        -v         -- verbose
28
29where cmds are:
30  update          - to update the RTEMS and Test Support source
31  BSP_TESTSET     - to perform TESTSET on BSP
32                    TESTSET may be baseline, O2, or Os
33"
34
35#   log an error to stderr
36prerr()
37{
38    echo "$*" >&2
39}
40
41fatal() {
42    prerr "$USAGE"
43    [ "$1" ] && (prerr ; prerr $*);
44    exit 1
45}
46
47warn() {
48    [ "$1" ] && prerr $*
49}
50
51check_status()
52{
53  if [ $1 -ne 0 ] ; then
54    shift
55    echo "FAILED: " "$*" >&2
56    exit 1
57  fi
58}
59
60toggle()
61{
62  case $1 in
63    no)  echo "yes" ;;
64    yes) echo "no" ;;
65    *)   fatal "Unknown value to toggle ($1)" ;;
66  esac
67}
68
69do_one()
70{
71  bsp=${1}
72  shift
73  echo "time ${COVBASE}/do_coverage -A -v -u -m ${SAVE} ${PUBLISH} ${*} -B ${bsp}"
74  time ${COVBASE}/do_coverage -A -v -u -m ${SAVE} ${PUBLISH} ${*} -B ${bsp}
75  check_status $? "FAILED ${bsp}"
76  rm -rf b-${bsp} ${bsp}-tests
77}
78
79validate_bsp()
80{
81  case ${1} in
82    edb7312|gumstix|smdk2410)    ;; # ARM
83    pc386|qemu)                  ;; # i386
84    lm32_evr)                    ;; # lm32
85    uC5282)                      ;; # m68k/Coldfire
86    qemuppc)                     ;; # PowerPC
87    erc32|leon2|leon3)           ;; # SPARC
88    *)
89      echo "ERROR - does BSP (${bsp}) really exist and support coverage?"
90      exit 1
91  esac
92}
93
94verbose="no"
95do_publish="yes"
96do_save_tarballs="yes"
97
98while getopts ftv OPT
99do
100
101    case "$OPT" in
102      f) do_publish=`toggle ${do_publish}` ;;
103      t) do_save_tarballs=`toggle ${do_save_tarballs}` ;;
104      v) verbose=`toggle ${verbose}` ;;
105      *) fatal;;
106    esac
107done
108
109# Set the publish and save options
110if [ ${do_publish} = "yes" ] ; then
111  PUBLISH="-f"
112fi
113if [ ${do_save_tarballs} = "yes" ] ; then
114  SAVE="-t"
115fi
116
117shiftcount=`expr $OPTIND - 1`
118shift $shiftcount
119
120args=$*
121
122if [ $# -eq 0 ] ; then
123  echo "No actions requested"
124  exit 0
125fi
126
127for cmd in $*
128do
129  case ${cmd} in
130    update) ;;                       # general command
131    *_O[sS2][pP][dD]|*_baseline)            # one BSP at specific -Ox level
132      case ${cmd} in
133        lm32_evr*) bsp=lm32_evr ;;
134        *)         bsp=`echo $cmd | sed -e 's/_.*$//'` ;;
135      esac
136      validate_bsp ${bsp}
137      ;;
138    *)
139      echo "Unknown command (${cmd})"
140      exit 1
141      ;;
142  esac
143done
144
145START=`date`
146
147cd ${BASEDIR}
148
149RESULTSDIR=${BASEDIR}/covrun-results
150test -d ${RESULTSDIR} || mkdir -p ${RESULTSDIR}
151for cmd in $*
152do
153echo $cmd
154  case ${cmd} in
155    update)
156      time ${COVBASE}/do_coverage -u -m -B erc32
157      ;;
158    *_O[sS2][pP][dD])
159      bsp=`echo $cmd | sed -e 's/_O.*$//'`
160      args=`echo $cmd | sed -e 's/^.*_//'`
161      Olevel=`echo $cmd | sed -e 's/.*_O\(.\).*$/\1/'`
162      posix=`echo $cmd | sed -e 's/.*_O.\(.\).*$/\1/'`
163      devel=`echo $cmd | sed -e 's/.*_O..\(.\)$/\1/'`
164
165      echo $bsp $args $Olevel $posix $devel
166      optArg="-S"
167      if [ ${Olevel} = "2" ] ; then
168        optArg=""
169      fi
170      posixArg=""
171      if [ ${posix} = "p" ] ; then
172        posixArg="-P"
173      fi
174      develArg=""
175      if [ ${devel} = "d" ] ; then
176        develArg="-D"
177      fi
178
179      # echo do_one ${bsp} ${optArg} ${posixArg} ${develArg}
180      do_one ${bsp} ${optArg} ${posixArg} ${develArg}
181      ;;
182    *_baseline)
183      bsp=`echo $cmd | sed -e 's/_baseline$//'`
184      # Each run does both developmental and core.  So this is 8 configurations
185      do_one ${bsp} -S          # -Os / POSIX enabled
186      do_one ${bsp} -S -P       # -Os / POSIX disabled
187      do_one ${bsp}             # -O2 / POSIX enabled
188      do_one ${bsp}    -P       # -O2 / POSIX disabled
189      ;;
190    *)
191      echo "Unknown command (${cmd})"
192      exit 1
193      ;;
194  esac
195done
196
197STOP=`date`
198echo "STARTED AT: " ${START}
199echo "STOPPED AT: " ${STOP}
200
201exit 0
Note: See TracBrowser for help on using the repository browser.