source: rtems-testing/gcc/do_one @ 29a9485

4.11
Last change on this file since 29a9485 was 29a9485, checked in by Joel Sherrill <joel.sherrill@…>, on May 21, 2010 at 4:37:15 PM

2010-05-21 Joel Sherrill <joel.sherrill@…>

  • do_one: Turn off -x.
  • Property mode set to 100755
File size: 16.2 KB
Line 
1#! /bin/sh
2#
3# Execution Times (for sparc-rtems${RTEMS_VERSION})
4#
5#   - building native                   - 45m43.697s
6#   - building stage1 (non-multilib)    - 7m26.749s
7#   - building stage1 (multilib)        -
8#   - building Ada stack (non-multilib) - 13m25.945s
9#   - building RTEMS                    - 12m27.799s
10#   - Running ACAT           (sis)      -
11#   - Running GCC Test Suite (sis)      - 60m26.523s
12#
13# Computer Info
14#   Fedora 8 on Intel Core2 Duo T7500  @ 2.20GHz w/ 2GB RAM
15
16vfile=`dirname $0`/../VERSIONS
17if [ ! -r ${vfile} ] ; then
18  echo VERSIONS file not found
19  exit 1
20fi
21
22source ${vfile}
23
24
25######################## Set defaults #############################
26# Remove Build Directories
27do_cleanup=yes
28# Install Binutils (from rpm or source)
29do_binutils=no
30  do_binutils_method=source
31# Install GDB (from rpm or source)
32do_gdb=no
33  do_gdb_method=source
34# Build the native compiler?
35do_native=no
36  do_native_ada=yes
37# Build the base level cross compiler. C++ and multilib are optional.
38do_stage1=no
39  do_cxx=yes
40  do_multilib=yes
41# Build the Ada language cross compiler. Multilib is NOT supported
42do_ada=no
43  do_ada_multilib=yes
44# Build RTEMS for a particular CPU/BSP combination
45do_rtems=no
46# Which test suites do we attempt
47run_gcctests=no
48run_acats=no
49# Do we send email to gcc-testresults with the test results?
50do_mail=yes
51# Are we noisy when running?
52verbose=no
53######################## Parse arguments ###########################
54
55usage()
56{
57cat <<EOF
58do_one [options] CPU BSP
59  -A - binutils, stage 1, C++, C/C++ multilib, Ada, RTEMS
60  -T - run GCC and Ada tests
61  -b - install binutils (from source or copy installed RPM contents)
62  -D - install gdb (from source or copy installed RPM contents)
63  -n - native compiler
64  -1 - stage 1 C/C++ compiler
65  -c -   do not include C++
66  -m -   do not build multilib
67  -a - stage 2 Ada compiler
68  -r - build RTEMS
69  -g - run GCC C/C++ tests
70  -C - run ACATS
71  -d - do not clean up (delete build directories)
72  -v - verbose
73  -M - do NOT email test results to gcc-testresults
74EOF
75}
76
77fatal()
78{
79  usage
80  exit 1
81}
82
83toggle()
84{
85  case $1 in
86    no)  echo "yes" ;;
87    yes) echo "no" ;;
88    *)   fatal "Unknown value to toggle ($1)" ;;
89  esac
90}
91
92while getopts bdDnv1cmargCATM OPT
93do
94    case "$OPT" in
95        A) do_binutils="yes"
96           do_gdb="yes"
97           do_stage1="yes"
98           do_cxx="yes"
99           do_multilib="yes"
100           do_ada="yes"
101           do_rtems="yes"
102           ;;
103        d) do_cleanup=`toggle ${do_cleanup}` ;;
104        D) do_gdb=`toggle ${do_gdb}` ;;
105        T) run_gcctests="yes"
106           run_acats="yes"
107           ;;
108        # unrpm binutils
109        b) do_binutils=`toggle ${do_binutils}` ;;
110        # Build the native
111        n) do_native=`toggle ${do_native}` ;;
112        # Stage 1 arguments
113        1) do_stage1=`toggle ${do_stage1}` ;;
114        c) do_cxx=`toggle ${do_cxx}` ;;
115        m) do_multilib=`toggle ${do_multilib}` ;;
116        # Stage 2 arguments
117        a) do_ada=`toggle ${do_ada}` ;;
118        # Build RTEMS
119        r) do_rtems=`toggle ${do_rtems}` ;;
120        # Testsuites to run
121        g) run_gcctests=`toggle ${run_gcctests}` ;;
122        C) run_acats=`toggle ${run_acats}` ;;
123        v) verbose=`toggle ${verbose}` ;;
124        M) do_mail=`toggle ${do_mail}` ;;
125        *) fatal;;
126    esac
127done
128
129########################### Grab CPU/BSP ###########################
130
131shiftcount=`expr $OPTIND - 1`
132shift $shiftcount
133
134cpu=${1}
135bsp=${2}
136
137case ${cpu} in
138  m32c)
139    do_ada=no
140    do_cxx=no
141    run_acats=no
142    echo M32C does not support C++ or Ada
143    ;;
144  *);;
145esac
146
147if [ ${verbose} = yes ] ; then
148  echo "Target        : " ${cpu}
149  echo "BSP           : " ${bsp}
150  echo "Binutils      : " ${do_binutils}
151  echo "GDB           : " ${do_gdb}
152  echo "Build Native  : " ${do_native}
153  echo "Build Stage 1 : " ${do_stage1}
154  echo "  C++         : " ${do_cxx}
155  echo "  Multilib    : " ${do_multilib}
156  echo "Stage 2       : " ${do_ada}
157  echo "  Ada         : " ${do_ada}
158  echo "  Multilib    : " ${do_ada_multilib}
159  echo "Build RTEMS   : " ${do_rtems}
160  echo "Run GCC Tests : " ${run_gcctests}
161  echo "Run ACATS     : " ${run_acats}
162  echo "Email Tests   : " ${do_mail}
163  echo "Native GCC    : " `type gcc`
164  echo "PATH          : " ${PATH}
165  echo "Clean up      : " ${do_cleanup}
166fi
167
168# Should the user have specified a CPU and/or BSP?
169needBSP=no
170needCPU=no
171
172if [ ${do_binutils} = yes -o ${do_gdb} = yes -o \
173     ${do_stage1} = yes -o ${do_ada} = yes ] ; then
174  needCPU=yes
175fi
176
177if [ ${do_rtems} = yes -o ${run_gcctests} = yes -o ${run_acats} = yes ] ; then
178  needBSP=yes
179  needCPU=yes
180  if [ x${bsp} = x ] ; then
181    echo "BSP NOT SET"
182    fatal
183  fi
184fi
185
186if [ ${needCPU} = yes -a x${cpu} = x ] ; then
187  echo "CPU NOT SET"
188  fatal
189fi
190
191if [ ${needBSP} = yes -a x${bsp} = x ] ; then
192  echo "BSP NOT SET"
193  fatal
194fi
195
196TARGET=${cpu}-rtems${RTEMS_VERSION}
197
198if [ x${bsp} = xqemu ] ; then
199  BSP_BUILT=pc386
200else
201  BSP_BUILT=${bsp}
202fi
203 
204######### Consistency check installation of source
205
206if [ ! -d ${GCCDIR}/newlib ] ; then
207  echo "${GCCDIR}/newlib not present"
208  exit 1
209fi
210
211ADASCRIPTDIR=${SCRIPTDIR}/gcc/testsuite/ada/acats
212for i in Makefile.rtems rtems_acats_reasons rtems_acats_status \
213    rtems_generate_acats_email rtems_init.c run_all_rtems.sh
214do
215  if [ ! -r ${ADASCRIPTDIR}/${i} ] ; then
216    echo "${ADASCRIPTDIR}/gcc/testsuite/ada/acats/${i} not present"
217    echo "RTEMS ACATS support files not present"
218    exit 1
219  fi
220done
221
222if [ ${needCPU} = yes -a ${needBSP} = yes -a \
223     ${run_gcctests} = yes -a ${run_acats} = yes ] ; then
224  DEJADIR=${SCRIPTDIR}/dejagnu/boards
225  if [ ! -d ${DEJADIR} ] ; then
226    echo "Missing DejaGNU configuration directory (${DEJADIR})"
227    exit 1
228  fi
229
230  case ${cpu}-${bsp} in
231    arm-edb7312)          dejacfg=rtems-arm-edb7312 ;;
232    avr-avrtest)          dejacfg=rtems-avr-avrtest ;;
233    bfin-eZKit533)        dejacfg=rtems-bfin-nosim ;;
234    h8300-h8sim)          dejacfg=rtems-h8300-h8sim ;;
235    i386-pc386|i386-qemu) dejacfg=rtems-i386-qemu ;;
236    lm32-lm32_evr)        dejacfg=rtems-lm32-lm32_evr ;;
237    m32c-m32csim)         dejacfg=rtems-m32c-m32csim ;;
238    m32r-m32rsim)         dejacfg=rtems-m32r-m32rsim ;;
239    m68k-uC5282)          dejacfg=rtems-m68k-uC5282 ;;
240    mips-jmr3904)         dejacfg=rtems-mips-jmr3904 ;;
241    powerpc-psim)         dejacfg=rtems-powerpc-psim ;;
242    sh-simsh1)            dejacfg=rtems-sh-simsh1 ;;
243    sparc-sis)            dejacfg=rtems-sparc-sis ;;
244    *)
245      echo "ERROR ${bsp} is not known to DegaGNU"
246      exit 1
247      ;;
248  esac
249
250  if [ ! -r ${DEJADIR}/${dejacfg}.exp ] ; then
251    echo "Missing DejaGNU file for ${cpu}/${bsp}"
252    exit 1
253  fi
254fi
255######### END OF Consistency check installation of source
256
257######### Log Directory
258if [ ! -d ${LOGDIR} ] ; then
259  mkdir ${LOGDIR}
260fi
261#########
262
263######### Install binutils
264j_binutils()
265{
266  test -d ${INSTALL} || mkdir -p ${INSTALL}
267
268  cd ${INSTALL}/..
269 
270  case ${do_binutils_method} in
271    rpm)
272      if [ ! -r /opt/rtems-${RTEMS_VERSION}/bin/${TARGET}-as ] ; then
273         echo "Binutils RPMs not installed"
274         exit 0
275      fi
276
277      echo "Extracting binutils from installed RPMs"
278      DIR=`pwd`
279      mkdir tmp-unrpm
280      cd tmp-unrpm
281      cd /
282      for cpu in $*
283      do
284        pkg=`rpm -qf /opt/rtems-${RTEMS_VERSION}/bin/${TARGET}-as`
285        rpm -ql $pkg | cpio -pvdum ${DIR}/tmp-unrpm
286      done
287      cd ${DIR}/tmp-unrpm/opt/rtems-${RTEMS_VERSION}
288      find . | cpio -pdum ${INSTALL}
289      cd ${DIR}
290      rm -rf tmp-unrpm
291      ;;
292    source)
293      echo "Building Binutils from source"
294      rm -rf b-binutils-${cpu}
295      mkdir b-binutils-${cpu}
296      cd b-binutils-${cpu}
297      (${BINUTILSDIR}/configure --target=${TARGET} --prefix=$INSTALL \
298        --disable-werror && \
299        make ${MAKEJOBS} && make install) >${LOGDIR}/${cpu}-binutils.log 2>&1
300      if [ $? -ne 0 ] ; then
301        echo "Failed to build Binutils from source"
302        exit 1
303      fi
304      echo "Checking Binutils "
305      make check >${LOGDIR}/${cpu}-binutils-check.log 2>&1
306      grep ^FAIL ${LOGDIR}/${cpu}-binutils-check.log
307      cd ..
308      test ${do_cleanup} = "yes" && rm -rf b-binutils-${cpu}
309      ;;
310    *)
311      echo "Where do I get the binutils from?"
312      exit 1
313      ;;
314  esac
315}
316
317if [ ${do_binutils} = yes ] ; then
318  echo "Building binutils..."
319  j_binutils ${cpu}
320fi
321
322######### Install gdb
323j_gdb()
324{
325  test -d ${INSTALL} || mkdir -p ${INSTALL}
326
327  cd ${INSTALL}/..
328
329  case ${cpu} in
330    mips) GDBTARGET=${cpu}tx39-rtems${RTEMS_VERSION} ;;
331    *)    GDBTARGET=${TARGET} ;;
332  esac
333
334  case ${do_gdb_method} in
335    rpm)
336      if [ ! -r /opt/rtems-${RTEMS_VERSION}/bin/${GDBTARGET}-gdb ] ; then
337         echo "Binutils RPMs not installed"
338         exit 0
339      fi
340
341      echo "Extracting gdb from installed RPMs"
342      DIR=`pwd`
343      mkdir tmp-unrpm
344      cd tmp-unrpm
345      cd /
346      for cpu in $*
347      do
348        pkg=`rpm -qf /opt/rtems-${RTEMS_VERSION}/bin/${GDBTARGET}-gdb`
349        rpm -ql $pkg | cpio -pvdum ${DIR}/tmp-unrpm
350      done
351      cd ${DIR}/tmp-unrpm/opt/rtems-${RTEMS_VERSION}
352      find . | cpio -pdum ${INSTALL}
353      cd ${DIR}
354      rm -rf tmp-unrpm
355      ;;
356    source)
357      echo "Building GDB from source"
358      cd ${BASEDIR}
359      rm -rf b-gdb-${cpu}
360      mkdir b-gdb-${cpu}
361      cd b-gdb-${cpu}
362      (${GDBDIR}/configure --target=${GDBTARGET} \
363        --enable-sim --enable-sim-hardware \
364        --disable-werror \
365        --enable-timebase --enable-sim-trace  --prefix=$INSTALL && \
366        make ${MAKEJOBS} && make install) >${LOGDIR}/${cpu}-gdb.log 2>&1
367      if [ $? -ne 0 ] ; then
368        echo "Failed to build gdb from source"
369        exit 1
370      fi
371      cd ..
372      test ${do_cleanup} = "yes" && rm -rf b-gdb-${cpu}
373      ;;
374    *)
375      echo "Where do I get the gdb from?"
376      exit 1
377      ;;
378  esac
379}
380
381if [ ${do_gdb} = yes ] ; then
382  echo "Building gdb..."
383  j_gdb ${cpu}
384fi
385
386######### Build a native compiler
387j_native()
388{
389  test ${do_native_ada} = "yes" && AdaArg=",ada"
390  ${GCCDIR}/configure \
391    ${NATIVE_GCC_EXTRA_ARGS} \
392    --enable-languages=c${AdaArg} --prefix=$INSTALL &&
393  make ${MAKEJOBS} && make install
394}
395
396if [ ${do_native} = "yes" ] ; then
397  echo "Building native compiler..."
398  (cd ${BASEDIR} && \
399   rm -rf b-native && \
400   mkdir  b-native && \
401   cd b-native && \
402   time j_native >${LOGDIR}/native.log 2>&1 && cd .. ) || exit 1
403   test ${do_cleanup} = "yes" && rm -rf b-native
404else
405  echo Skipping native
406fi
407# END of build native compiler
408
409######### Build Cross C/C++ baseline compiler
410j_gcc1()
411{
412
413  if [ X${1} = X ] ; then
414    echo Usage: $0 TARGET_CPU
415    exit 1
416  fi
417
418  if [ ! -d ${INSTALL} ]; then
419    echo ${INSTALL} does not exist
420    exit 1
421  fi
422
423  if [ ${verbose} = yes ] ; then
424    echo "Cross Assembler ==>" `type ${TARGET}-as`
425  fi
426
427  if [ ${do_cxx} = yes ] ; then
428     cxx=",c++"
429  fi
430  if [ ${cpu} = avr ] ; then
431    cxx=""
432  fi
433
434  if [ ${do_multilib} = yes ] ; then
435     multilib="--enable-multilib"
436  else
437     multilib="--disable-multilib"
438  fi
439
440  ${GCCDIR}/configure \
441    ${GCC_EXTRA_ARGS} \
442   --enable-threads=rtems  --with-gnu-as ${multilib} \
443   --enable-newlib-mb --enable-newlib-iconv \
444   --with-gnu-ld --with-newlib  --verbose --with-system-zlib --disable-nls \
445    --enable-version-specific-runtime-libs \
446    --enable-languages=c${cxx} --target=$TARGET --prefix=$INSTALL
447  if [ $? -ne 0 ] ; then
448    echo "Failed to configure GCC C/C++ .. bailing"
449    exit 1
450  fi
451
452  make ${MAKEJOBS}
453  if [ $? -ne 0 ] ; then
454    echo "Failed to build GCC C/C++ .. bailing"
455    exit 1
456  fi
457
458  make install
459  if [ $? -ne 0 ] ; then
460    echo "Failed to install GCC C/C++ .. bailing"
461    exit 1
462  fi
463
464}
465
466if [ ${do_stage1} = "yes" ] ; then
467  echo "Building Stage 1 compiler (C/C++)..."
468  (cd ${BASEDIR} && \
469   rm -rf b-gcc1-${cpu} && \
470   mkdir  b-gcc1-${cpu} && \
471   cd b-gcc1-${cpu} && \
472     time j_gcc1 ${cpu} >${LOGDIR}/${cpu}-stage1.log 2>&1 && cd ..) || exit 1
473else
474  echo Skipping Stage 1 for ${cpu}
475fi
476
477#################### RTEMS
478
479j_rtems()
480{
481  cpuArg=$1
482  bspArg=$2
483  bspdir=b-${cpuArg}-${bspArg}
484
485  cd ${BASEDIR}
486  rm -rf ${bspdir}
487  mkdir  ${bspdir} || exit 1
488  cd ${bspdir}     || exit 1
489
490  ENABLE_BSP="--enable-rtemsbsp=${bspArg}"
491  case $bspArg in
492    multilib)
493      ENABLE_BSP="--enable-multilib"
494      MAKE_ARG="-k"
495      ;;
496      edb7312)    ENABLE_BSP="${ENABLE_BSP} ON_SKYEYE=1" ;;
497      gumstix)    ENABLE_BSP="${ENABLE_BSP} ON_SKYEYE=1" ;;
498    qemu|pc386)
499      ENABLE_BSP="${ENABLE_BSP} USE_COM1_AS_CONSOLE=1"
500      ENABLE_BSP="${ENABLE_BSP} BSP_PRESS_KEY_FOR_RESET=0"
501      ;;
502    *) ;;
503  esac
504  case ${cpu} in
505    m32c) RTEMS_ARGS="--disable-ada --disable-posix --disable-networking" ;;
506    *)    RTEMS_ARGS="--enable-ada --enable-posix --enable-networking" ;;
507  esac
508  ${RTEMSDIR}/configure --target=${TARGET} ${ENABLE_BSP} \
509  ${RTEMS_ARGS} --enable-maintainer-mode --disable-tests \
510  --prefix=${BSP_INSTALL} && make ${MAKEJOBS} ${MAKE_ARG} && make install
511  cd ..
512}
513
514if [ ${do_rtems} = "yes" ] ; then
515  echo "Building RTEMS for ${cpu} ${bsp} ..."
516  time j_rtems ${cpu} multilib >${LOGDIR}/${cpu}-rtems-multilib.log 2>&1 || \
517    exit 1
518  time j_rtems ${cpu} ${bsp} >${LOGDIR}/${cpu}-rtems-${bsp}.log 2>&1 || \
519    exit 1
520  test ${do_cleanup} = "yes" && rm -rf b-${cpu}-${bsp} b-${cpu}-multilib
521else
522  echo Skipping RTEMS for ${cpu}/${bsp}
523fi
524pwd
525
526##### Do the gcc tests
527if [ ${run_gcctests} = "yes" ] ; then
528  echo "Running GCC Tests..."
529  cd ${BASEDIR}/b-gcc1-${cpu} || exit 1
530  time sh -x ${SCRIPTDIR}/gcc/rundeja ${bsp} \
531    >${LOGDIR}/${cpu}-gcctests-${bsp}.log 2>&1
532
533  RDIR=${RESULTSDIR}/${TARGET}-${bsp}/`date +%Y-%m-%d-%H-%M-%S`
534  mkdir -p ${RDIR}
535  cp gcc/testsuite/gcc/gcc.log gcc/testsuite/gcc/gcc.sum ${RDIR}
536  if [ -r gcc/testsuite/g++/g++.log ] ; then
537    cp gcc/testsuite/g++/g++.log gcc/testsuite/g++/g++.sum ${RDIR}
538  fi
539
540  if [ ${do_mail} = "yes" ] ; then
541    echo Sending test results to GCC community..
542    ${GCCDIR}/contrib/test_summary -m gcc-testresults@gcc.gnu.org | sh
543    if [ $? -ne 0 ] ; then
544      echo "Failed to email GCC Test Results to GCC Community .. bailing"
545      exit 1
546    fi
547
548    echo Sending test results to RTEMS community..
549    ${GCCDIR}/contrib/test_summary -o -m rtems-tooltestresults@rtems.org | sh
550    if [ $? -ne 0 ] ; then
551      echo "Failed to email GCC Test Results to RTEMS Community .. bailing"
552      exit 1
553    fi
554  fi
555  cd .. || exit 1
556else
557  echo Skipping GCC DejaGNU tests for ${cpu}/${bsp}
558fi
559test ${do_cleanup} = "yes" && rm -rf b-gcc1-${cpu}
560
561##### Build an Ada compiler now that we have a cross installed
562j_gcc2()
563{
564  if [ X${1} = X ] ; then
565    echo Usage: $0 TARGET_CPU
566    exit 1
567  fi
568  TARGET=${1}-rtems${RTEMS_VERSION}
569
570  if [ ! -d ${INSTALL} ]; then
571    echo ${INSTALL} does not exist
572    exit 1
573  fi
574
575  if [ ${verbose} = yes ] ; then
576    echo "Cross GCC ==>" `type ${TARGET}-gcc`
577  fi
578
579  if [ ${do_ada_multilib} = yes ] ; then
580     ada_multilib="--enable-multilib"
581  else
582     ada_multilib="--disable-multilib"
583  fi
584
585#    CFLAGS_FOR_TARGET=-B${BSP_INSTALL}/${TARGET}/${BSP_BUILT}/lib/
586
587  ${GCCDIR}/configure \
588   ${GCC_EXTRA_ARGS} \
589   --enable-threads=rtems  --with-gnu-as ${ada_multilib} \
590   --enable-newlib-mb --enable-newlib-iconv \
591   --with-gnu-ld --with-newlib  --verbose --with-system-zlib --disable-nls \
592    CFLAGS_FOR_TARGET=-B${BSP_INSTALL}/${TARGET}/${BSP_BUILT}/lib/ \
593    --enable-version-specific-runtime-libs \
594    --enable-languages=c,ada --target=$TARGET --prefix=$INSTALL &&
595  make ${MAKEJOBS} &&
596  make install
597}
598
599if [ ${do_ada} = "yes" ] ; then
600  echo "Building Stage 2 cross Ada compiler for ${1} ..."
601  (cd ${BASEDIR} && \
602   rm -rf b-gcc2-${cpu} && \
603   mkdir  b-gcc2-${cpu} && \
604   cd b-gcc2-${cpu} && \
605   time j_gcc2 ${cpu} >${LOGDIR}/${cpu}-stage2.log 2>&1 && cd ..) || exit 1
606else
607  echo Skipping Stage 2 Ada for ${cpu}
608fi
609
610#### Run the Ada ACATS tests
611if [ ${run_acats} = "yes" -a -d b-gcc2-${cpu} ] ; then
612  echo "Running ACATS..."
613  cd ${GCCDIR}/gcc/testsuite/ada/acats/ || exit 1
614
615  time ${ADASCRIPTDIR}/run_all_rtems.sh ${INSTALL} ${BSP_INSTALL} \
616    ${TARGET} ${bsp} >${LOGDIR}/${cpu}-acats-${bsp}-build.log 2>&1
617  if [ $? -eq 0 ] ; then
618    if [ -r work-${bsp}/acats.log ] ; then
619      cp work-${bsp}/acats.log ${LOGDIR}/${cpu}-acats-${bsp}.log
620    fi
621
622    if [ ${do_mail} = "yes" ] ; then
623      echo Sending ACATS test results to GCC community..
624      ${ADASCRIPTDIR}/rtems_generate_acats_email ${cpu} ${bsp} yes
625    fi
626  fi
627
628  cd ../../../../.. || exit 1
629else
630  echo Skipping ACATS for ${cpu}
631fi
632
633if [ ${do_ada} = "yes" ] ; then
634  test ${do_cleanup} = "yes" && rm -rf b-gcc2-${cpu}
635fi
636exit 0
Note: See TracBrowser for help on using the repository browser.