source: rtems-testing/rtems-coverage/do_coverage @ 5b46ab3

4.11
Last change on this file since 5b46ab3 was 5b46ab3, checked in by Joel Sherrill <joel.sherrill@…>, on Nov 4, 2011 at 7:29:01 PM

2011-11-04 Joel Sherrill <joel.sherrilL@…>

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