source: rtems-testing/rtems-coverage/do_coverage @ f1698c78

4.11
Last change on this file since f1698c78 was f1698c78, checked in by Joel Sherrill <joel.sherrill@…>, on Jan 26, 2011 at 6:26:00 PM

2011-01-26 Joel Sherrill <joel.sherrilL@…>

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