source: rtems-testing/rtems-coverage/do_coverage @ 331f963

4.11
Last change on this file since 331f963 was 331f963, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 2, 2011 at 8:34:57 PM

2011-09-02 Joel Sherrill <joel.sherrilL@…>

  • do_coverage: Account for two column symbol file.
  • 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="yes"
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    cut -d' ' -f1 ${results_dir}/no_range_uncovered.txt | 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 | 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/ *$//' -e "s,$, ${l},"
467
468      # echo "========= END $l"
469
470    # no else
471      # We keep a complete CURRENT list and some are not in old versions
472    fi
473  done
474}
475
476# generate the list of symbols to analyze
477generate_symbols()
478{
479  case ${RTEMS_VERSION} in
480    4.5*|4.6*)
481      cd ${BASEDIR}/b-${BSP}/${TARGET}/c/${BSP}/exec
482      check_status $? "could not cd to object directory"
483      subd=o-optimize/
484      ;;
485    *)
486      cd ${BASEDIR}/b-${BSP}/${TARGET}/c/${BSP}/cpukit
487      check_status $? "could not cd to object directory"
488      subd=
489      ;;
490  esac
491
492  case ${RTEMS_VERSION} in
493    4.5*)
494      filter_nm wrapup/rtems/o-optimize/librtems.a
495      if [ ${do_posix} = "yes" ] ; then
496        filter_nm wrapup/posix/o-optimize/libposix.a
497      fi
498
499      if [ ${analyze_developmental} = "yes" ] ; then
500        filter_nm ../lib/libc/${subd}libcsupport.a
501        filter_nm ../lib/libmisc/wrapup/${subd}libmisc.a
502      fi
503      ;;
504    *) # 4.6 or newer
505      # Base set of libraries to analyse.  Do NOT include libscorecpu.a!!!
506      filter_nm score/${subd}libscore.a
507      filter_nm sapi/${subd}libsapi.a
508      filter_nm rtems/${subd}librtems.a
509
510      # Now add the POSIX API onto that
511      if [ ${do_posix} = "yes" ] ; then
512        filter_nm posix/${subd}libposix.a
513      fi
514
515      # Now add developmental libraries
516      # NOTE: all non-network libraries are listed here.  --joel 5 March 2010
517      if [ ${analyze_developmental} = "yes" ] ; then
518        filter_nm libfs/${subd}librfs.a
519        filter_nm libfs/${subd}libdosfs.a
520        filter_nm libfs/${subd}libdevfs.a
521        filter_nm libfs/${subd}libimfs.a
522        filter_nm libcsupport/${subd}libcsupport.a
523        # filter_nm libi2c/${subd}libi2c.a
524        # filter_nm zlib/${subd}libz.a
525        # filter_nm libmd/${subd}libmd.a
526        # filter_nm libmisc/${subd}libshell.a
527        filter_nm libmisc/${subd}libbspcmdline.a
528        filter_nm libmisc/${subd}libcpuuse.a
529        # filter_nm libmisc/${subd}libuuid.a
530        filter_nm libmisc/${subd}libstackchk.a
531        # filter_nm libmisc/${subd}libmw-fb.a
532        # NEVER INCLUDE libdummy.a!!!
533        # filter_nm libmisc/${subd}libdummy.a
534        filter_nm libmisc/${subd}libfsmount.a
535        filter_nm libmisc/${subd}libstringto.a
536        filter_nm libmisc/${subd}libdevnull.a
537        # filter_nm libmisc/${subd}libcapture.a
538        filter_nm libmisc/${subd}libdumpbuf.a
539        # filter_nm libmisc/${subd}libmonitor.a
540        # filter_nm libmisc/${subd}libserdbg.a
541        # filter_nm libmisc/${subd}libuntar.a
542        filter_nm libblock/${subd}libblock.a
543      fi
544      ;;
545    esac
546}
547
548# remove symbols we do not want coverage on.
549# NOTE: As of 4 August 2010, we do not have any.
550remove_unwanted_symbols()
551{
552  cat
553#  sed -e '/IMFS_print_node/d' \
554#      -e '/IMFS_dump_directory/d' \
555#      -e '/IMFS_dump/d' \
556#      -e '/IMFS_memfile_maximum_size/d'
557}
558
559# Now we are ready to start doing real work
560start=`date`
561
562# If necessary, clean up the RTEMS build and test run directories
563if [ ${do_clean} = "yes" ] ; then
564  echo "Cleaning before building"
565  rm -rf ${BASEDIR}/b-${BSP}
566  rm -rf ${BASEDIR}/${BSP}-tests
567else
568  echo "Skipping clean before building"
569fi
570
571# If they don't exist, create the RTEMS build and test run directories
572test -d ${BASEDIR}/b-${BSP}     || mkdir ${BASEDIR}/b-${BSP}
573test -d ${BASEDIR}/${BSP}-tests || mkdir ${BASEDIR}/${BSP}-tests
574
575# If requested, update and build the coverage support tools
576if [ ${do_covoar} = "yes" ] ; then
577  echo "Updating and building covoar..."
578
579  cd ${COVBASE}/../covoar
580  check_status $? "cd covoar"
581
582  cvs up -Pd 2>&1 | grep -v ^cvs
583  make clean all
584  check_status $? "build covoar"
585
586  make
587  check_status $? "make covoar"
588else
589  echo "Skipping Updating and building covoar..."
590fi
591
592# If requested, update the RTEMS tree
593if [ ${do_rtems_update} = "yes" ] ; then
594  echo "Updating RTEMS ..."
595  cd ${RTEMSDIR}
596  check_status $? "cd rtems"
597
598  cvs up -Pd 2>&1 | grep -v ^cvs
599  ./bootstrap -c
600  ./bootstrap
601else
602  echo "Skipping Updating RTEMS ..."
603fi
604
605# If requested, configure RTEMS
606if [ ${do_rtems_configure} = "yes" ] ; then
607  # Now let's patch the make/custom file
608  sed -e "s/-O[0123s]/${c_opt}/" <${custom} >${custom}.tmp
609  mv ${custom}.tmp ${custom}
610
611  echo "Configuring RTEMS..."
612  rm -rf ${BASEDIR}/b-${BSP}/
613  mkdir ${BASEDIR}/b-${BSP}/
614  cd ${BASEDIR}/b-${BSP}/
615  check_status $? "cd b-${BSP}"
616
617  ##################
618  ################## WARNING!!!!!!
619  ##################
620  ################## BE CAREFUL ABOUT THIS CONFIGURE COMMAND.  IT IS
621  ################## VERY SPECIFIC TO COVERAGE TESTING
622  ##################
623  if [ ${do_posix} = "yes" ] ; then
624    posix_en=en
625  else
626    posix_en=dis
627  fi
628
629  if [ ${RTEMS_VERSION} = 4.5 ] ; then
630    ${RTEMSDIR}/configure \
631      --target=${TARGET} --enable-rtemsbsp=${BSP} \
632      --enable-maintainer-mode \
633      --disable-itron --${posix_en}able-posix --enable-tests \
634      --disable-networking --disable-ada --disable-cxx \
635      --prefix=${BASEDIR}/coverage/install >c.log 2>&1
636  else
637    ${RTEMSDIR}/configure NDEBUG=1 \
638      RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH=1 \
639      RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE=1 \
640      RTEMS_DO_NOT_UNROLL_THREADQ_ENQUEUE_PRIORITY=1 \
641      ${RTEMS_EXTRA_ARGS} \
642      --target=${TARGET} --enable-rtemsbsp=${BSP} \
643      --enable-maintainer-mode \
644      --disable-itron --${posix_en}able-posix --enable-tests \
645      --disable-networking --disable-ada --disable-cxx \
646      --prefix=${BASEDIR}/coverage/install >c.log 2>&1
647  fi
648  check_status $? "configuring RTEMS for ${BSP}"
649else
650  echo "Skipping Configuring RTEMS ..."
651fi
652
653# If requested, build RTEMS
654if [ ${do_rtems_build} = "yes" ] ; then
655  echo "Building RTEMS..."
656
657  cd ${BASEDIR}/b-${BSP}/
658  check_status $? "cd b-${BSP}"
659
660  case ${RTEMS_VERSION} in
661    4.5*|4.6*)
662      sleep 5  # 4.5 on chroot'ed env needs this for some reason
663      make >b.log 2>&1
664      ;;
665    *)
666      cpus=`/usr/bin/getconf _NPROCESSORS_ONLN`
667      make -j${cpus} >b.log 2>&1
668      ;;
669  esac
670  check_status $? "Building RTEMS for ${BSP}"
671else
672  echo "Skipping Building RTEMS ..."
673fi
674
675# If requested, copy the tests from the build tree to the run tree
676if [ ${do_copy_tests} = "yes" ] ; then
677  echo "Copying tests..."
678
679  # clean destination
680  rm -rf ${BASEDIR}/${BSP}-tests/*
681  check_status $? "clean test directory"
682
683  cd ${BASEDIR}/b-${BSP}/
684  check_status $? "cd b-${BSP}"
685
686  find `pwd` -name "*.ralf" -o -name "*.exe" | while read f
687  do
688    rm -f ../${BSP}-tests/`basename ${f}`
689    if [ ${do_link_tests} = "yes" ] ; then
690      ln -s ${f} ../${BSP}-tests
691    else
692      cp ${f} ../${BSP}-tests
693    fi
694  done
695 
696else
697  echo "Skipping copying tests..."
698fi
699
700# If requested, run the tests with coverage reporting enabled
701if [ ${do_run_tests} = "yes" ] ; then
702  echo "Running tests..."
703  cd ${BASEDIR}/${BSP}-tests/
704  check_status $? "cd ${BSP}-tests"
705
706  time ${RUNNER} -c *.${RTEMSEXT}
707else
708  echo "Skipping Running tests..."
709fi
710
711# If requested, generate the coverage reports
712if [ ${do_reports} = "yes" ] ; then
713  echo "Generating reports..."
714
715  cd ${BASEDIR}/${BSP}-tests/
716  check_status $? "cd ${BSP}-tests"
717
718  to_analyze=""
719  if [ ${do_core} = "yes" ] ; then
720    to_analyze="${to_analyze} no"
721  fi
722  if [ ${do_developmental} = "yes" ]; then
723    to_analyze="${to_analyze} yes"
724  fi
725
726  for analyze_developmental in ${to_analyze}
727  do
728    if [ ${analyze_developmental} = yes ] ; then
729      echo "Processing coverage for developmental configuration ..."
730      EXT=${EXTENSION}D
731    else
732      echo "Processing coverage for core source configuration ..."
733      EXT=${EXTENSION}d
734    fi
735    if [ "X${outputDir}" = "X" ] ; then
736      results_dir=${BSP}${EXT}-${day}-${hour}${minute}
737    else
738      results_dir=${outputDir}
739    fi
740
741    generate_symbols | sort -u | remove_unwanted_symbols \
742      >${BASEDIR}/${BSP}-tests/rtems.syms
743    syms=`cat ${BASEDIR}/${BSP}-tests/rtems.syms | wc -l`
744    if [ ${syms} -eq 0 ] ; then
745      fatal "no symbols found"
746    fi
747
748    generate_reports ${TARGET} ${BSP} ${COVERAGE_FORMAT}
749  done
750else
751  echo "Skipping Generating reports..."
752fi
753
754# If requested, publish the coverage reports
755if [ ${do_publish} = "yes" -o ${do_save_tarballs} = "yes" ] ; then
756  if [ -d ${BASEDIR}/${BSP}-tests ] ; then
757    cd ${BASEDIR}/${BSP}-tests/
758    if [ ${do_publish} = "yes" ] ; then
759      cp ${BSP}${EXTENSION}[dD]-${day}-${hour}${minute}.tar.bz2 ${FTPDIR}
760      check_status $? "cp ${BSP} results to ftp site failed"
761      ${COVBASE}/generate_coverage_html ${FTPDIR}
762    fi
763    if [ ${do_save_tarballs} = "yes" ] ; then
764      if [ ! -d ${TARDIR} ] ; then
765         echo "Creating ${TARDIR}"
766         mkdir -p ${TARDIR}
767         check_status $? "Failed to mkdir ${TARDIR}"
768      fi
769      cp ${BSP}${EXTENSION}[dD]-${day}-${hour}${minute}.tar.bz2 ${TARDIR}
770      check_status $? "cp ${BSP} results to save directory"
771    fi
772  else
773    echo "No results to publish or save"
774  fi
775else
776  echo "Skipping Publishing reports..."
777fi
778stop=`date`
779
780echo "Started: " ${start}
781echo "Stopped: " ${stop}
782
783exit 0
784
Note: See TracBrowser for help on using the repository browser.