source: rtems-testing/rtems-coverage/do_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: 21.4 KB
Line 
1#! /bin/sh
2#
3#  Script to perform a single coverage test run on a single BSP
4#  in a specific configuration.  This script automates all steps
5#  of building RTEMS, running the tests, and generating the reports.
6#
7#  $Id$
8#
9
10vfile=`dirname $0`/VERSIONS-COVERAGE
11if [ ! -r ${vfile} ] ; then
12  echo VERSIONS-COVERAGE file not found
13  exit 1
14fi
15
16source ${vfile}
17
18if [ ! -d ${BASEDIR} ] ; then
19  echo Have you set the BASEDIR in VERSIONS correctly?
20  exit 1
21fi
22
23progname=${0##*/}        # fast basename hack for ksh, bash
24
25USAGE="
26usage: $progname [ -opts ]
27        -v        -- verbose (default=no)
28        -d        -- analyze Core Configuration (default=yes)
29        -D        -- analyze Developmental Configuration (default=yes)
30        -A        -- Execute all steps (default=no)
31        -B BSP    -- Specify BSP to test
32        -P        -- Enable POSIX API (default=yes)
33        -S        -- Optimize for size (default=no)
34        -m        -- Update and build covMerge (default=no)
35        -u        -- Do CVS update on RTEMS (default=no)
36        -c        -- Configure RTEMS (default=no)
37        -b        -- Build RTEMS (default=no)
38        -C        -- get tests from build to test execution point (default=no)
39        -L        -- do not link files to test execution point (default=link)
40        -r        -- run the tests (default=no)
41        -R        -- generate reports (default=no)
42        -f        -- publish the results to ftp site (default=no)
43        -t        -- save the results locally (default=no)
44        -O        -- output directory (default=BSP-CONF-YYYYMMDD-HHMM)
45        -p        -- project name (default empty)
46
47Notes:  + There are currently NO checks at each step to determine if
48          the previous steps were performed!!!
49        + Use of each option toggles the setting.  For example, \"-v -v -A -u\"
50          results in verbose=no and all steps done except CVS update on RTEMS."
51
52#   log an error to stderr
53prerr()
54{
55    echo "$*" >&2
56}
57
58fatal() {
59    prerr "$USAGE"
60    [ "$1" ] && (prerr ; prerr $*);
61    exit 1
62}
63
64check_status()
65{
66  if [ $1 -ne 0 ] ; then
67    shift
68    echo "FAILED: " "$*" >&2
69    exit 1
70  fi
71}
72
73toggle()
74{
75  case $1 in
76    no)  echo "yes" ;;
77    yes) echo "no" ;;
78    *)   fatal "Unknown value to toggle ($1)" ;;
79  esac
80}
81
82# parse arguments for these
83verbose="no"
84do_all="no"
85do_posix="yes"
86do_optimize_size="no"
87do_covoar="no"
88do_rtems_update="no"
89do_rtems_configure="no"
90do_rtems_build="no"
91do_copy_tests="no"
92do_link_tests="yes"
93do_run_tests="no"
94do_reports="no"
95do_publish="no"
96do_save_tarballs="no"
97do_core="yes"
98do_developmental="yes"
99outputDir=""
100BSP="not_set"
101
102while getopts vB:PSmAucbCLrRftO:dD OPT
103do
104    case "$OPT" in
105        A)
106          do_all="yes"
107          do_covoar="yes"
108          do_posix="yes"
109          do_rtems_update="yes"
110          do_rtems_configure="yes"
111          do_rtems_build="yes"
112          do_copy_tests="yes"
113          do_run_tests="yes"
114          do_reports="yes"
115          ;;
116        d) do_core=`toggle ${do_core}` ;;
117        D) do_developmental=`toggle ${do_developmental}` ;;
118        B) BSP="${OPTARG}";;
119        O) outputDir="${OPTARG}";;
120        v) verbose=`toggle ${verbose}` ;;
121        m) do_covoar=`toggle ${do_covoar}` ;;
122        P) do_posix=`toggle ${do_posix}` ;;
123        S) do_optimize_size=`toggle ${do_optimize_size}` ;;
124        u) do_rtems_update=`toggle ${do_rtems_update}` ;;
125        c) do_rtems_configure=`toggle ${do_rtems_configure}` ;;
126        b) do_rtems_build=`toggle ${do_rtems_build}` ;;
127        C) do_copy_tests=`toggle ${do_copy_tests}` ;;
128        L) do_link_tests=`toggle ${do_link_tests}` ;;
129        r) do_run_tests=`toggle ${do_run_tests}` ;;
130        R) do_reports=`toggle ${do_reports}` ;;
131        f) do_publish=`toggle ${do_publish}` ;;
132        t) do_save_tarballs=`toggle ${do_save_tarballs}` ;;
133        *) fatal;;
134    esac
135done
136
137#  If we are to update or configure RTEMS, then we need to clean the
138#  RTEMS build tree up.
139do_clean="no"
140if [ ${do_rtems_update} = "yes" -o \
141     ${do_rtems_configure} = "yes" ] ; then
142  do_clean="yes"
143fi
144
145# allow bsp override
146if [ ${BSP} == "not_set" ] ; then
147  fatal "No BSP selected"
148fi
149
150# you can't publish unless ftp directory is accessible
151if [ ${do_publish} = "yes" ] ; then
152  if [ ! -d ${FTPDIR} ] ; then
153    fatal "Publishing results requested and ${FTPDIR} does not exist"
154  fi
155fi
156
157# For most BSPs, there is a script with the same name as the BSP.
158RUNNER=${BSP}
159
160RTEMSEXT=${DEFAULT_EXEEXT}
161COVEXT=cov
162case ${BSP} in
163  pc386)
164    CPU=i386
165    COVERAGE_FORMAT=QEMU
166    RTEMS_EXTRA_ARGS="USE_COM1_AS_CONSOLE=1"
167    RTEMS_EXTRA_ARGS="${RTEMS_EXTRA_ARGS} BSP_PRESS_KEY_FOR_RESET=0"
168    RTEMSEXT=exe
169    ;;
170  uC5282)
171    CPU=m68k
172    COVERAGE_FORMAT=QEMU
173    RTEMSEXT=exe
174    COVEXT=tra
175    ;;
176  qemuppc)
177    RTEMSEXT=ralf
178    CPU=powerpc
179    COVERAGE_FORMAT=QEMU
180    ;;
181  lm32_evr)
182    CPU=lm32
183    COVERAGE_FORMAT=QEMU
184    RTEMSEXT=exe
185    COVEXT=tra
186    RUNNER=qemu-lm32_evr
187    RTEMS_EXTRA_ARGS="ON_SIMULATOR=1"
188    ;;
189  erc32|leon2|leon3)
190    CPU=sparc
191    COVERAGE_FORMAT=TSIM
192    ;;
193  edb7312|rtl22xx|gumstix|smdk2410)
194    CPU=arm
195    COVERAGE_FORMAT=Skyeye
196    RTEMS_EXTRA_ARGS="ON_SKYEYE=1"
197    ;;
198  *)
199    fatal "Unsupported BSP (${BSP}) for coverage analysis."
200    ;;
201esac
202
203case ${RTEMS_VERSION} in
204  4.5*)  TARGET=${CPU}-rtems ;;
205  4.6*)  TARGET=${CPU}-rtems ;;
206  4.7*)  TARGET=${CPU}-rtems4.7 ;;
207  4.8*)  TARGET=${CPU}-rtems4.8 ;;
208  4.9*)  TARGET=${CPU}-rtems4.9 ;;
209  4.10*) TARGET=${CPU}-rtems4.10 ;;
210  4.11*) TARGET=${CPU}-rtems4.11 ;;
211  *)
212    fatal "Unknown RTEMS Version (${RTEMS_VERSION})" ;;
213esac
214
215##### VERBOSE
216print_verbose()
217{
218  echo "BSP:                  " ${BSP}
219  echo "Target:               " ${TARGET}
220  echo "Compiler version:     " `${TARGET}-gcc --version  | grep gcc`
221  echo "do_optimize_size:     " ${do_optimize_size}
222  echo "Optimization Level:   " ${c_opt}
223  echo "POSIX Enabled:        " ${do_posix}
224  echo "Core Configuration    " ${do_core}
225  echo "Developmental Code:   " ${do_developmental}
226  echo "do_all:               " ${do_all}
227  echo "do_covoar             " ${do_covoar}
228  echo "do_rtems_update:      " ${do_rtems_update}
229  echo "do_rtems_configure:   " ${do_rtems_configure}
230  echo "do_rtems_build:       " ${do_rtems_build}
231  echo "do_copy_tests:        " ${do_copy_tests}
232  echo "do_link_tests:        " ${do_link_tests}
233  echo "do_run_tests:         " ${do_run_tests}
234  echo "do_reports:           " ${do_reports}
235  echo "do_publish:           " ${do_publish}
236  echo "do_save_tarballs:     " ${do_save_tarballs}
237  echo "Clean Before:         " ${do_clean}
238  echo "Executable Extension: " ${RTEMSEXT}
239  echo "Coverage Extension:   " ${COVEXT}
240}
241
242if [ ${do_optimize_size} = yes ] ; then
243 c_opt=-Os
244else
245 c_opt=-O2
246fi
247
248if [ ${do_core} = "no" -a ${do_developmental} = "no" ]; then
249  fatal "No symbol configurations to analyze selected"
250fi
251
252if [ ${verbose} = "yes" ] ; then
253  print_verbose
254fi
255
256# Basic error checking and sanity checking on the directory structure
257# and PATH
258if [ ! -d ${COVBASE} ] ; then
259  echo "The directory you specified for the base of the coverage run is "
260  echo "not present. (${COVBASE})"
261  exit 1
262fi
263
264if [ ! -d ${RTEMSDIR} ] ; then
265  echo "${RTEMSDIR} not found!!!"
266  exit 1
267fi
268
269type ${TARGET}-gcc
270check_status $? "Path appears to be broken"
271
272# Start real action
273NM=${TARGET}-nm
274type ${NM}
275check_status $? "Cannot find ${NM} on PATH"
276
277# Locate the custom file
278custom=${RTEMSDIR}/make/custom/${BSP}.cfg
279if [ ! -r ${custom} ] ; then
280  custom=`ls -1 \
281     ${RTEMSDIR}/c/src/lib/libbsp/${CPU}/*/make/custom/${BSP}.cfg 2>/dev/null`
282  check_status $? "unable to find a custom file"
283  if [ x${custom} = x -o ! -r ${custom} ] ; then
284    echo "Unable to read ${custom}"
285    exit 1
286  fi
287fi
288
289grep "^CFLAGS_OPTIMIZE_V.*=.*-O[s01234]" ${custom} >/dev/null
290if [ $? -ne 0 ] ; then
291  echo "Unable to find CFLAGS_OPTIMIZE_V in ${custom}"
292  exit 1
293fi
294
295EXTENSION=${c_opt}
296if [ ${do_posix} = yes ] ; then
297  EXTENSION=${EXTENSION}P
298else
299  EXTENSION=${EXTENSION}p
300fi
301
302year=`date +%Y`
303day=`date +%Y%m%d`
304hour=`date +%H`
305minute=`date +%M`
306
307echo "Testing ${TARGET}/${BSP} at optimization (${c_opt})"
308
309# print a data element in table
310print_element()
311{
312  echo "  <TD>"${*}"</TD>"
313}
314
315# generate table row of results in html
316generate_html()
317{
318  summary=$1
319  echo "<TR>"
320    print_element ${day}
321    print_element ${hour}:${minute}
322    print_element ${c_opt}
323    print_element ${do_posix}
324    print_element ${analyze_developmental}
325    print_element `grep "Uncovered range" ${summary} | cut -d ':' -f2`
326    print_element `grep "age Not Exec" ${summary} | cut -d ':' -f2`
327    print_element `grep "age Exec" ${summary} | cut -d ':' -f2`
328    print_element `grep "Bytes Not Exec" ${summary} | cut -d ':' -f2`
329    print_element `grep "Bytes Analyzed" ${summary} | cut -d ':' -f2`
330    print_element "<A HREF=\"${results_dir}\">untarred</A> " \
331                  "<A HREF=\"${results_dir}.tar.bz2\">tarball</A> "
332  echo "</TR>"
333}
334
335add_to_summary()
336{
337  unref=${results_dir}/sizes_unreferenced.txt
338  echo
339  unreffed=`cat ${unref} | wc -l`
340  echo "Symbols unreferenced: " ${unreffed}
341  if [ ${unreffed} = 0 ] ; then
342    size_of=0
343  else
344    size_of=`cut -f1 ${unref} | sed -e '2,$s/$/ +/' -e '$,$s/$/ p/' | dc`
345  fi
346  echo "Bytes in unreferenced symbols : " ${size_of}
347}
348
349generate_size_per_file()
350{
351  total=0
352  pfile=X
353  cut -d':' -f1 ${results_dir}/sizes_all.txt | sort  -k3 | while read line
354  do
355    size=`echo $line | cut -d' ' -f1`
356    file=`echo $line | cut -d' ' -f3`
357    #echo $size XXX $file
358    if [ $file != $pfile ] ; then
359      if [ $pfile != X ]; then
360        echo $total $pfile
361        total=0
362      fi
363      pfile=$file
364    fi
365    #echo ADD $file $total $size `expr $total + $size`
366    total=`expr $total + $size`
367  done | sort -n -r
368}
369
370# generate the coverage report set
371generate_reports()
372{
373  if [ $# -ne 3 ] ; then
374    echo Usage: ${0} TARGET BSP COVERAGE_FORMAT
375    exit 1
376  fi
377
378  TARGET=${1}
379  BSP=${2}
380  COVERAGE_FORMAT=${3}
381
382  cd ${BASEDIR}/${BSP}-tests/
383  check_status $? "cd ${BSP}-tests"
384
385  sed -e "s/@FORMAT@/${COVERAGE_FORMAT}/" \
386      -e "s/@TARGET@/${TARGET}/" \
387      -e "s,@EXPLANATIONS@,${COVBASE}/Explanations.txt," \
388      -e "s,@SYMBOLS_FILE@,${BASEDIR}/${BSP}-tests/rtems.syms," \
389      -e "s,@OUTPUT_DIRECTORY@,${results_dir}," \
390      -e "s/@EXECUTABLE_EXTENSION@/exe/" \
391      -e "s/@COVERAGE_EXTENSION@/${RTEMSEXT}.${COVEXT}/" \
392      -e "s/@PROJECT_NAME@/RTEMS ${RTEMS_VERSION}/" \
393      <${COVBASE}/rtems_config.in \
394      >${BASEDIR}/${BSP}-tests/config
395  check_status $? "Unable to generate COVOAR config file"
396
397  rm -rf ${results_dir}
398  mkdir  ${results_dir}
399  covoar -C ${BASEDIR}/${BSP}-tests/config \
400    *.exe
401  check_status $? "covoar failed"
402
403  # This should be made obsolete by sortable tables.
404  #(echo "====== Largest Range Sizes (Size and Count)======" ; \
405  #  grep ^Size uncovered.txt | cut -d':' -f2 | sort -n | uniq -c | \
406  #     tail -15 | sed -e 's/ *\([0-9]*\) *\([0-9]*\)/\2 \1/' | sort -n -r | \
407  #     while read l; do printf "%6d %6d\n" $l; done ; \
408  #  echo "=====================================" ) >>summary.txt
409
410  check_endof >${results_dir}/testsWithNoEndOfTest.txt
411
412  # Generate the configuration settings file
413  (
414    echo "#"
415    echo "#  Settings for this coverage test run"
416    echo "#"
417    echo
418    print_verbose
419  ) >${results_dir}/configuration.txt
420
421  RTEMSLIB=${BASEDIR}/b-${BSP}/${TARGET}/${BSP}/lib/librtemscpu.a
422
423  if [ -r ${RTEMSLIB} ] ; then
424    while read symbol
425    do
426      line=`${TARGET}-nm --format=sysv \
427        ${BASEDIR}/b-${BSP}/${TARGET}/${BSP}/lib/librtemscpu.a | \
428        grep FUNC | sed -e's/|/ | /g' | grep ${symbol}`
429      size=`echo ${line} | cut -d'|' -f5 | tr "[:lower:]" "[:upper:]"`
430      size=`echo 16 i ${size} p | dc`
431      echo "${size}     ${symbol}       unknown"
432    done <${results_dir}/no_range_uncovered.txt | sort -n -r \
433         >${results_dir}/sizes_unreferenced.txt
434  fi
435
436  cat ${results_dir}/sizes_unreferenced.txt ${results_dir}/sizes.txt | \
437    sort -n -r >${results_dir}/sizes_all.txt
438
439  generate_size_per_file >${results_dir}/size_per_file.txt
440
441  generate_html ${results_dir}/summary.txt >${results_dir}/row.html
442  add_to_summary >>${results_dir}/summary.txt
443
444  cat ${results_dir}/summary.txt ${results_dir}/testsWithNoEndOfTest.txt
445
446  mv ${results_dir}/index.html ${results_dir}/index.html.tmp
447  sed -f ${COVBASE}/rtems_items.sed  \
448    <${results_dir}/index.html.tmp \
449    >${results_dir}/index.html
450
451  # Now create the archive of information
452  cp ${COVOARBASE}/covoar.css ${COVOARBASE}/*gif ${COVOARBASE}/table.js ${results_dir}
453  echo "Results saved in ${results_dir}.tar.bz2"
454  tar cjf ${results_dir}.tar.bz2 ${results_dir}
455}
456
457# This grabs the list of methods from a library or object file
458filter_nm()
459{
460  for l in $*
461  do
462    if [ -r ${l} ] ; then
463      test ${verbose} = "yes" && echo Generating symbols from ${l} >&2
464      # echo "========= START $l"
465      ${TARGET}-nm --format=sysv $l | grep "FUNC|" | \
466        cut -d'|' -f1 | sed -e 's/ *$//'
467      # echo "========= END $l"
468
469    # no else
470      # We keep a complete CURRENT list and some are not in old versions
471    fi
472  done
473}
474
475# generate the list of symbols to analyze
476generate_symbols()
477{
478  case ${RTEMS_VERSION} in
479    4.5*|4.6*)
480      cd ${BASEDIR}/b-${BSP}/${TARGET}/c/${BSP}/exec
481      check_status $? "could not cd to object directory"
482      subd=o-optimize/
483      ;;
484    *)
485      cd ${BASEDIR}/b-${BSP}/${TARGET}/c/${BSP}/cpukit
486      check_status $? "could not cd to object directory"
487      subd=
488      ;;
489  esac
490
491  case ${RTEMS_VERSION} in
492    4.5*)
493      filter_nm wrapup/rtems/o-optimize/librtems.a
494      if [ ${do_posix} = "yes" ] ; then
495        filter_nm wrapup/posix/o-optimize/libposix.a
496      fi
497
498      if [ ${analyze_developmental} = "yes" ] ; then
499        filter_nm ../lib/libc/${subd}libcsupport.a
500        filter_nm ../lib/libmisc/wrapup/${subd}libmisc.a
501      fi
502      ;;
503    *) # 4.6 or newer
504      # Base set of libraries to analyse.  Do NOT include libscorecpu.a!!!
505      filter_nm score/${subd}libscore.a
506      filter_nm sapi/${subd}libsapi.a
507      filter_nm rtems/${subd}librtems.a
508
509      # Now add the POSIX API onto that
510      if [ ${do_posix} = "yes" ] ; then
511        filter_nm posix/${subd}libposix.a
512      fi
513
514      # Now add developmental libraries
515      # NOTE: all non-network libraries are listed here.  --joel 5 March 2010
516      if [ ${analyze_developmental} = "yes" ] ; then
517        # filter_nm libfs/${subd}librfs.a
518        # filter_nm libfs/${subd}libdosfs.a
519        filter_nm libfs/${subd}libdevfs.a
520        filter_nm libfs/${subd}libimfs.a
521        filter_nm libcsupport/${subd}libcsupport.a
522        # filter_nm libi2c/${subd}libi2c.a
523        # filter_nm zlib/${subd}libz.a
524        # filter_nm libmd/${subd}libmd.a
525        # filter_nm libmisc/${subd}libshell.a
526        filter_nm libmisc/${subd}libbspcmdline.a
527        filter_nm libmisc/${subd}libcpuuse.a
528        # filter_nm libmisc/${subd}libuuid.a
529        filter_nm libmisc/${subd}libstackchk.a
530        # filter_nm libmisc/${subd}libmw-fb.a
531        # NEVER INCLUDE libdummy.a!!!
532        # filter_nm libmisc/${subd}libdummy.a
533        # filter_nm libmisc/${subd}libfsmount.a
534        filter_nm libmisc/${subd}libstringto.a
535        filter_nm libmisc/${subd}libdevnull.a
536        # filter_nm libmisc/${subd}libcapture.a
537        filter_nm libmisc/${subd}libdumpbuf.a
538        # filter_nm libmisc/${subd}libmonitor.a
539        # filter_nm libmisc/${subd}libserdbg.a
540        # filter_nm libmisc/${subd}libuntar.a
541        # filter_nm libblock/${subd}libblock.a
542      fi
543      ;;
544    esac
545}
546
547# remove symbols we do not want coverage on.
548# NOTE: As of 4 August 2010, we do not have any.
549remove_unwanted_symbols()
550{
551  cat
552#  sed -e '/IMFS_print_node/d' \
553#      -e '/IMFS_dump_directory/d' \
554#      -e '/IMFS_dump/d' \
555#      -e '/IMFS_memfile_maximum_size/d'
556}
557
558# Now we are ready to start doing real work
559start=`date`
560
561# If necessary, clean up the RTEMS build and test run directories
562if [ ${do_clean} = "yes" ] ; then
563  echo "Cleaning before building"
564  rm -rf ${BASEDIR}/b-${BSP}
565  rm -rf ${BASEDIR}/${BSP}-tests
566else
567  echo "Skipping clean before building"
568fi
569
570# If they don't exist, create the RTEMS build and test run directories
571test -d ${BASEDIR}/b-${BSP}     || mkdir ${BASEDIR}/b-${BSP}
572test -d ${BASEDIR}/${BSP}-tests || mkdir ${BASEDIR}/${BSP}-tests
573
574# If requested, update and build the coverage support tools
575if [ ${do_covoar} = "yes" ] ; then
576  echo "Updating and building covoar..."
577
578  cd ${COVBASE}/../covoar
579  check_status $? "cd covoar"
580
581  cvs up -Pd 2>&1 | grep -v ^cvs
582  make clean all
583  check_status $? "build covoar"
584
585  make
586  check_status $? "make covoar"
587else
588  echo "Skipping Updating and building covoar..."
589fi
590
591# If requested, update the RTEMS tree
592if [ ${do_rtems_update} = "yes" ] ; then
593  echo "Updating RTEMS ..."
594  cd ${RTEMSDIR}
595  check_status $? "cd rtems"
596
597  cvs up -Pd 2>&1 | grep -v ^cvs
598  ./bootstrap -c
599  ./bootstrap
600else
601  echo "Skipping Updating RTEMS ..."
602fi
603
604# If requested, configure RTEMS
605if [ ${do_rtems_configure} = "yes" ] ; then
606  # Now let's patch the make/custom file
607  sed -e "s/-O[0123s]/${c_opt}/" <${custom} >${custom}.tmp
608  mv ${custom}.tmp ${custom}
609
610  echo "Configuring RTEMS..."
611  rm -rf ${BASEDIR}/b-${BSP}/
612  mkdir ${BASEDIR}/b-${BSP}/
613  cd ${BASEDIR}/b-${BSP}/
614  check_status $? "cd b-${BSP}"
615
616  ##################
617  ################## WARNING!!!!!!
618  ##################
619  ################## BE CAREFUL ABOUT THIS CONFIGURE COMMAND.  IT IS
620  ################## VERY SPECIFIC TO COVERAGE TESTING
621  ##################
622  if [ ${do_posix} = "yes" ] ; then
623    posix_en=en
624  else
625    posix_en=dis
626  fi
627
628  if [ ${RTEMS_VERSION} = 4.5 ] ; then
629    ${RTEMSDIR}/configure \
630      --target=${TARGET} --enable-rtemsbsp=${BSP} \
631      --enable-maintainer-mode \
632      --disable-itron --${posix_en}able-posix --enable-tests \
633      --disable-networking --disable-ada --disable-cxx \
634      --prefix=${BASEDIR}/coverage/install >c.log 2>&1
635  else
636    ${RTEMSDIR}/configure NDEBUG=1 \
637      RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH=1 \
638      RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE=1 \
639      RTEMS_DO_NOT_UNROLL_THREADQ_ENQUEUE_PRIORITY=1 \
640      ${RTEMS_EXTRA_ARGS} \
641      --target=${TARGET} --enable-rtemsbsp=${BSP} \
642      --enable-maintainer-mode \
643      --disable-itron --${posix_en}able-posix --enable-tests \
644      --disable-networking --disable-ada --disable-cxx \
645      --prefix=${BASEDIR}/coverage/install >c.log 2>&1
646  fi
647  check_status $? "configuring RTEMS for ${BSP}"
648else
649  echo "Skipping Configuring RTEMS ..."
650fi
651
652# If requested, build RTEMS
653if [ ${do_rtems_build} = "yes" ] ; then
654  echo "Building RTEMS..."
655
656  cd ${BASEDIR}/b-${BSP}/
657  check_status $? "cd b-${BSP}"
658
659  case ${RTEMS_VERSION} in
660    4.5*|4.6*)
661      sleep 5  # 4.5 on chroot'ed env needs this for some reason
662      make >b.log 2>&1
663      ;;
664    *)
665      cpus=`/usr/bin/getconf _NPROCESSORS_ONLN`
666      make -j${cpus} >b.log 2>&1
667      ;;
668  esac
669  check_status $? "Building RTEMS for ${BSP}"
670else
671  echo "Skipping Building RTEMS ..."
672fi
673
674# If requested, copy the tests from the build tree to the run tree
675if [ ${do_copy_tests} = "yes" ] ; then
676  echo "Copying tests..."
677
678  # clean destination
679  rm -rf ${BASEDIR}/${BSP}-tests/*
680  check_status $? "clean test directory"
681
682  cd ${BASEDIR}/b-${BSP}/
683  check_status $? "cd b-${BSP}"
684
685  find `pwd` -name "*.ralf" -o -name "*.exe" | while read f
686  do
687    rm -f ../${BSP}-tests/`basename ${f}`
688    if [ ${do_link_tests} = "yes" ] ; then
689      ln -s ${f} ../${BSP}-tests
690    else
691      cp ${f} ../${BSP}-tests
692    fi
693  done
694 
695else
696  echo "Skipping copying tests..."
697fi
698
699# If requested, run the tests with coverage reporting enabled
700if [ ${do_run_tests} = "yes" ] ; then
701  echo "Running tests..."
702  cd ${BASEDIR}/${BSP}-tests/
703  check_status $? "cd ${BSP}-tests"
704
705  time ${RUNNER} -c *.${RTEMSEXT}
706else
707  echo "Skipping Running tests..."
708fi
709
710# If requested, generate the coverage reports
711if [ ${do_reports} = "yes" ] ; then
712  echo "Generating reports..."
713
714  cd ${BASEDIR}/${BSP}-tests/
715  check_status $? "cd ${BSP}-tests"
716
717  to_analyze=""
718  if [ ${do_core} = "yes" ] ; then
719    to_analyze="${to_analyze} no"
720  fi
721  if [ ${do_developmental} = "yes" ]; then
722    to_analyze="${to_analyze} yes"
723  fi
724
725  for analyze_developmental in ${to_analyze}
726  do
727    if [ ${analyze_developmental} = yes ] ; then
728      echo "Processing coverage for developmental configuration ..."
729      EXT=${EXTENSION}D
730    else
731      echo "Processing coverage for core source configuration ..."
732      EXT=${EXTENSION}d
733    fi
734    if [ "X${outputDir}" = "X" ] ; then
735      results_dir=${BSP}${EXT}-${day}-${hour}${minute}
736    else
737      results_dir=${outputDir}
738    fi
739
740    generate_symbols | sort -u | remove_unwanted_symbols \
741      >${BASEDIR}/${BSP}-tests/rtems.syms
742    syms=`cat ${BASEDIR}/${BSP}-tests/rtems.syms | wc -l`
743    if [ ${syms} -eq 0 ] ; then
744      fatal "no symbols found"
745    fi
746
747    generate_reports ${TARGET} ${BSP} ${COVERAGE_FORMAT}
748  done
749else
750  echo "Skipping Generating reports..."
751fi
752
753# If requested, publish the coverage reports
754if [ ${do_publish} = "yes" -o ${do_save_tarballs} = "yes" ] ; then
755  if [ -d ${BASEDIR}/${BSP}-tests ] ; then
756    cd ${BASEDIR}/${BSP}-tests/
757    if [ ${do_publish} = "yes" ] ; then
758      cp ${BSP}${EXTENSION}[dD]-${day}-${hour}${minute}.tar.bz2 ${FTPDIR}
759      check_status $? "cp ${BSP} results to ftp site failed"
760      ${COVBASE}/generate_coverage_html ${FTPDIR}
761    fi
762    if [ ${do_save_tarballs} = "yes" ] ; then
763      if [ ! -d ${TARDIR} ] ; then
764         echo "Creating ${TARDIR}"
765         mkdir -p ${TARDIR}
766         check_status $? "Failed to mkdir ${TARDIR}"
767      fi
768      cp ${BSP}${EXTENSION}[dD]-${day}-${hour}${minute}.tar.bz2 ${TARDIR}
769      check_status $? "cp ${BSP} results to save directory"
770    fi
771  else
772    echo "No results to publish or save"
773  fi
774else
775  echo "Skipping Publishing reports..."
776fi
777stop=`date`
778
779echo "Started: " ${start}
780echo "Stopped: " ${stop}
781
782exit 0
783
Note: See TracBrowser for help on using the repository browser.