source: rtems-testing/gcc/test_driver @ 85c521d

4.11
Last change on this file since 85c521d was 85c521d, checked in by Joel Sherrill <joel.sherrill@…>, on May 2, 2014 at 2:14:18 PM

rtems-testing: Use eval bash instead of full path

  • Property mode set to 100755
File size: 7.5 KB
Line 
1#! /usr/bin/eval bash
2#
3#  Test Driver
4#
5#  test_driver CPUs|all
6#
7
8vfile=`dirname $0`/../VERSIONS
9if [ ! -r ${vfile} ] ; then
10  echo VERSIONS file not found
11  exit 1
12fi
13
14source ${vfile}
15
16if [ ! -d ${BASEDIR} ] ; then
17  echo Have you set the BASEDIR in VERSIONS correctly?
18  exit 1
19fi
20
21BASEDIR=`pwd`
22
23for d in ${AUTOCONF} ${AUTOMAKE} ${BINUTILSDIR} \
24    ${GDBDIR} ${NEWLIBDIR} ${GCCDIR}
25do
26  if [ ! -d ${d} ] ; then
27    echo "Cannot locate ${d} -- aborting"
28    exit 1
29  fi
30done
31
32toggle()
33{
34  case $1 in
35    no)  echo "yes" ;;
36    yes) echo "no" ;;
37    *)   fatal "Unknown value to toggle ($1)" ;;
38  esac
39}
40
41usage()
42{
43cat <<EOF
44test_driver [options] CPU ..  CPU
45  -A - enable clean, native, and update
46  -1 - build basic tools (default=yes)
47  -a - build Ada (default=yes)
48  -G - build GCC Go (default=yes)
49  -J - build GCJ (default=yes)
50  -c - clean install point (also installs auto tools)
51  -m - mail results to lists (default=yes)
52  -n - build native
53  -T - run tests (default=yes)
54  -u - update GNU source if version from CVS/SVN
55  -U - update RTEMS source if version from CVS/SVN (will bootstrap)
56  -v - verbose
57EOF
58}
59
60doCleanInstallPoint="no"
61doUpdateTools="no"
62doUpdateRTEMS="no"
63doNative="no"
64doBasicTools="yes"
65verbose="yes"
66doAda="yes"
67doGccGo="yes"
68doGcj="yes"
69doMail="yes"
70doObjC="yes"
71doFORTRAN="yes"
72doTests="yes"
73justTests="no"
74checkOptionsAndExit="no"
75
76while getopts J1AacmnuCGTUfOv OPT
77do
78  case "$OPT" in
79    A) doCleanInstallPoint=`toggle ${doCleanInstallPoint}`
80       doNative=`toggle ${doNative}`
81       doUpdateTools=`toggle ${doUpdateTools}`
82       doUpdateRTEMS=`toggle ${doUpdateRTEMS}`
83       ;;
84    1) doBasicTools=`toggle ${doBasicTools}` ;;
85    a) doAda=`toggle ${doAda}` ;;
86    C) checkOptionsAndExit=`toggle ${checkOptionsAndExit}` ;;
87    G) doGccGo=`toggle ${doGccGo}` ;;
88    J) doGcj=`toggle ${doGcj}` ;;
89    f) doFORTRAN=`toggle ${doFORTRAN}` ;;
90    O) doObjC=`toggle ${doObjC}` ;;
91    c) doCleanInstallPoint=`toggle ${doCleanInstallPoint}` ;;
92    j) justTests=`toggle ${justTests}` ;;
93    m) doMail=`toggle ${doMail}` ;;
94    n) doNative=`toggle ${doNative}` ;;
95    T) doTests=`toggle ${doTests}` ;;
96    u) doUpdateTools=`toggle ${doUpdateTools}` ;;
97    U) doUpdateRTEMS=`toggle ${doUpdateRTEMS}` ;;
98    v) verbose=`toggle ${verbose}` ;;
99    *) usage; exit 1;
100  esac
101done
102
103shiftcount=`expr $OPTIND - 1`
104shift $shiftcount
105
106args=$*
107
108CPUs=""
109for cpu in ${args}
110do
111  if [ ${cpu} = "native" ] ; then
112    doNative="yes"
113  else
114    CPUs="${CPUs} ${cpu}"
115  fi
116done
117
118CPUS_PART1="avr arm h8300 i386 m32c mips sh sparc64"
119CPUS_PART2="bfin lm32 m32r m68k powerpc sparc"
120ALL_CPUs="${CPUS_PART1} ${CPUS_PART2}"
121
122if  [ "X${CPUs}" = "Xall" -o "X${CPUs}" = "X all" ] ; then
123  CPUs="${ALL_CPUs}"
124elif [ "X${CPUs}" = "X part1" ] ; then
125  CPUs="${CPUS_PART1}"
126elif [ "X${CPUs}" = "X part2" ] ; then
127  CPUs="${CPUS_PART2}"
128elif [ "X${CPUs}" = "X" -a ${doNative} = "no" ] ; then
129  echo "No CPUs specified to test"
130  exit 1
131fi
132
133if [ ${verbose} = "yes" ] ; then
134  echo "Clean Install Point: " ${doCleanInstallPoint}
135  echo "Install Autotools:   " ${doCleanInstallPoint}
136  echo "Install Native:      " ${doNative}
137  echo "Update Tool Source:  " ${doUpdateTools}
138  echo "Update RTEMS:        " ${doUpdateRTEMS}
139  echo "Build Basic Tools:   " ${doBasicTools}
140  echo "Build Ada:           " ${doAda}
141  echo "Build GCC Go:        " ${doGccGo}
142  echo "Build GCJ:           " ${doGcj}
143  echo "Build Objective-C    " ${doObjC}
144  echo "Build FORTRAN        " ${doFORTRAN}
145  echo "Email Results:       " ${doMail}
146  echo "Run Tests:           " ${doTests}
147  echo "CPUs to Build:       " ${CPUs}
148fi
149
150test ${checkOptionsAndExit} = "yes" && exit 0
151
152test ${doMail}  = "no"       && mailArg="-M"
153test ${doTests} = "yes"      && testArg="-T"
154test ${doAda}   = "yes"      && adaArg="-a"
155test ${doGccGo} = "yes"      && gccgoArg="-G"
156test ${doGcj} = "yes"        && gcjArg="-J"
157test ${doObjC} = "yes"       && objcArg="-O"
158test ${doFORTRAN} = "yes"    && fortrancArg="-f"
159test ${doBasicTools} = "yes" && basicArgs="-b -D -1 -r"
160
161echo "Checking for just tests override"
162if [ ${justTests} = "yes" ] ; then
163  adaArg=""
164  gccgoArg=""
165  gcjArg=""
166  objcArg=""
167  fortranArg=""
168  basicArgs=""
169fi
170
171start=`date`
172echo Started at: ${start}
173
174# HELPER - Update RTEMS
175update_rtems()
176{
177  cd ${RTEMSDIR}
178  if [ -d CVS ] ; then
179    cvs up -Pd 2>&1 | grep -v ^cvs
180    ./bootstrap -c
181    ./bootstrap
182  fi
183}
184
185# HELPER - Update GCC
186update_gcc()
187{
188  cd ${GCCDIR}
189  if [ -d .svn ] ; then
190    grep "svn+ssh" .svn/entries >/dev/null
191    if [ $? -eq 0 ] ; then
192      echo "Skipping gcc update -- ssh keyed check out"
193    else
194      echo "Updating gcc -- anonymous check out"
195      ./contrib/gcc_update
196      if [ $? -ne 0 ] ; then
197        echo "Update of GCC Failed."
198        exit 1
199      fi
200   fi
201  fi
202  return 0
203}
204
205# HELPER - Remove all the installed previous builds
206clean_up()
207{
208  rm -rf ${INSTALL}/* ${BSP_INSTALL}/*
209}
210
211install_auto()
212{
213  for auto in ${AUTOCONF} ${AUTOMAKE}
214  do
215    cd ${auto}
216    make distclean
217    ./configure --prefix=${INSTALL}
218    make all install
219  done
220}
221
222install_ppl()
223{
224  if [ x${PPL} != x ] ; then
225    if [ ! -r ${INSTALL}/lib/libppl.a ] ; then
226      echo "*** Building PPL ***"
227      cd ${PPL}
228      make distclean
229      ./configure --enable-watchdog --prefix=${INSTALL}
230      make ${MAKEJOBS} all install
231    fi
232  fi
233}
234
235# This handles GNU tools from CVS
236update_others()
237{
238  for d in ${BINUTILSDIR} ${GDBDIR} ${NEWLIBDIR}
239  do
240   
241    cd ${d}
242    if [ -d .svn ] ; then
243      echo "I do not update SVN for ${d}"
244      exit 1
245   fi
246   if [ -d CVS ] ; then
247     cvs up -P 2>&1 | grep -v ^cvs
248   fi
249  done
250}
251
252build_cpu()
253{
254  bsp=
255
256  exitStatus=0
257  for cpu in $*
258  do
259    case $cpu in
260      arm)     bsp=edb7312      ;;
261      avr)     bsp=avrtest      ;;
262      bfin)    bsp=eZKit533     ;;
263      h8300)   bsp=h8sim        ;;
264      i386)    bsp=pc386        ;;
265      lm32)    bsp=lm32_evr     ;;
266      m32c)    bsp=m32csim      ;;
267      m32r)    bsp=m32rsim      ;;
268      m68k)    bsp=uC5282       ;;
269      mips)    bsp=jmr3904      ;;
270      powerpc) bsp=psim         ;;
271      sh)      bsp=simsh1       ;;
272      sparc)   bsp=sis          ;;
273      sparc64) bsp=niagara      ;;
274      *)
275        echo "Unknown CPU ${cpu}"
276        exit 1
277        ;;
278    esac
279
280    doOne=${SCRIPTDIR}/gcc/do_one
281    echo "Building ${cpu}/${bsp}..."
282    echo "time sh -x ${doOne} -v -d ${basicArgs}  \
283        ${gccgoArg} ${gcjArg} ${adaArg} ${objcArg} ${fortranArg} \
284        ${mailArg} ${testArg} \ ${cpu} ${bsp} >${BASEDIR}/${bsp}.log 2>&1"
285    time sh -x ${doOne} -v -d ${basicArgs}  \
286        ${gccgoArg} ${gcjArg} ${adaArg} ${objcArg} ${fortranArg} \
287        ${mailArg} ${testArg} \ ${cpu} ${bsp} >${BASEDIR}/${bsp}.log 2>&1
288    echo $?
289  done
290
291  stopped=`date`
292  echo Started at: ${start}
293  echo Stopped at: ${stopped}
294}
295
296if [ ${doCleanInstallPoint} = "yes" ] ; then
297  # Clean the install point
298  clean_up
299fi
300
301# Update gcc and install autotools in parallel
302  if [ ! -r ${INSTALL}/bin/autoconf ] ; then
303    install_auto
304  fi
305  if [ ${doUpdateTools} = "yes" ] ; then
306    update_gcc
307    update_others
308  fi
309  if [ ! -r ${INSTALL}/lib/libppl.a ] ; then
310    install_ppl
311  fi
312wait
313
314# Do any remaining prep work in parallel
315  if [ ${doUpdateRTEMS} = "yes" ] ; then
316    update_rtems
317  fi
318wait
319
320do_cpus=yes
321if [ ${doNative} = "yes" ]; then
322  # Build the native compiler as a baseline to build the others
323  time sh -x ${SCRIPTDIR}/gcc/do_one -n >${BASEDIR}/native.log 2>&1
324  if [ $? -ne 0 ] ; then
325    do_cpus=no
326  fi
327fi
328
329# Now cycle over all these CPUs
330if [ ${do_cpus} = yes ] ; then
331  for cpu in ${CPUs}
332  do
333    build_cpu ${cpu}
334  done
335fi
336
337stopped=`date`
338echo Started at: ${start}
339echo Stopped at: ${stopped}
Note: See TracBrowser for help on using the repository browser.