summaryrefslogtreecommitdiff
path: root/gcc/test_driver
blob: 88108fc426a819b0bdd5d163a74181fe0c49f2b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#! /bin/sh
#
#  Test Driver
#
#  $Id$
#

vfile=`dirname $0`/../VERSIONS
if [ ! -r ${vfile} ] ; then
  echo VERSIONS file not found
  exit 1
fi

source ${vfile}

if [ ! -d ${BASEDIR} ] ; then
  echo Have you set the BASEDIR in VERSIONS correctly?
  exit 1
fi

start=`date`
echo Started at: ${start}

BASEDIR=`pwd`

for d in ${AUTOCONF} ${AUTOMAKE} ${BINUTILSDIR} \
    ${GDBDIR} ${NEWLIBDIR} ${GCCDIR}
do
  if [ ! -d ${d} ] ; then
    echo "Cannot locate ${d} -- aborting"
    exit 1
  fi
done

### TODO: Parse arguments to get these
doCleanInstallPoint="yes"
doUpdateTools=yes
doUpdateRTEMS=yes
doNative=yes

# HELPER - Update RTEMS
update_rtems()
{
  cd ${RTEMSDIR}
  if [ -d CVS ] ; then
    cvs up -Pd 2>&1 | grep -v ^cvs
    ./bootstrap -c
    ./bootstrap
  fi
}

# HELPER - Update GCC
update_gcc()
{
  cd ${GCCDIR}
  if [ -d .svn ] ; then
    ./contrib/gcc_update
  fi
}

# HELPER - Remove all the installed previous builds
clean_up()
{
  rm -rf ${INSTALL}/* &
  rm -rf ${BSP_INSTALL}/* &
  wait
}

install_auto()
{
  for auto in ${AUTOCONF} ${AUTOMAKE}
  do
    cd ${auto}
    make distclean
    ./configure --prefix=${INSTALL}
    make all install
  done
}

# This handles GNU tools from CVS
update_others()
{
  for d in ${BINUTILSDIR} ${GDBDIR} ${NEWLIBDIR}
  do
    
    cd ${d} 
    if [ -d .svn ] ; then
      echo "I do not update SVN for ${d}"
      exit 1
   fi
   if [ -d CVS ] ; then
     cvs up -P 2>&1 | grep -v ^cvs
   fi
  done
}

do_cpus()
{
  start=`date`
  echo Started at: ${start}

  tests=-T

  bsp=

  exitStatus=0
  for cpu in $*
  do
    case $cpu in
      native)  bsp=native       ;;
      arm)     bsp=edb7312      ;;
      avr)     bsp=avrtest      ;;
      bfin)    bsp=eZKit533     ;;
      h8300)   bsp=h8sim        ;;
      i386)    bsp=pc386        ;;
      m32c)    bsp=m32csim      ;;
      m32r)    bsp=m32rsim      ;;
      m68k)    bsp=mcf5206elite ;;
      mips)    bsp=jmr3904      ;;
      powerpc) bsp=psim         ;;
      sh)      bsp=simsh1       ;;
      sparc)   bsp=sis          ;;
      *)
	echo "Unknown CPU ${cpu}"
	exit 1
	;;
    esac

    doOne=${SCRIPTDIR}/gcc/do_one 
    # Everything
    time sh -x ${doOne} -v -d -A ${tests} \
        ${cpu} ${bsp} >$${BASEDIR}/{bsp}.log 2>&1
    # Just C
    #time sh -x ${doOne} -v -b -D -1 -r ${tests} \
    #    ${cpu} ${bsp} >${BASEDIR}/${bsp}.log 2>&1
    # Just C/C++
    #time sh -x ${doOne} -v -1 -r -g ${tests}\
    #     ${cpu} ${bsp} >${BASEDIR}/${bsp}.log 2>&1
    echo $?
  done


  stopped=`date`
  echo Started at: ${start}
  echo Stopped at: ${stopped}
}

if [ ${doCleanInstallPoint} = "yes" ] ; then
  # Clean the install point
  clean_up
fi

# Update gcc and install autotools in parallel
  if [ ${doCleanInstallPoint} = "yes" ] ; then
    install_auto &
  fi
  if [ ${doUpdateTools} = "yes" ] ; then
    update_gcc &
    update_others &
  fi
wait

# Do any remaining prep work in parallel
  if [ ${doUpdateRTEMS} = "yes" ] ; then
    update_rtems &
  fi
wait

# Build the native compiler as a baseline to build the others
  if [ ${doNative} = "yes" ] ; then
    time sh -x ${SCRIPTDIR}/gcc/do_one -n >${BASEDIR}/native.log 2>&1
  fi

# Now cycle over all these CPUs
if [ $? -eq 0 ] ; then
  if [ $# -eq 0 ] ; then
    # Simulators included in gdb
    do_cpus powerpc sh sparc powerpc h8300 mips sh m32c m32r
    # Requires qemu installation
    do_cpus i386 

    # Requires Skyeye install
    do_cpus arm

    # no simulator -- waiting for Skyeye
    do_cpus bfin m68k avr

    # port insufficient to run gcc tests
    do_cpus avr
  else
    for cpu in $*
    do
      do_cpus ${cpu}
    done
  fi
  
fi

stopped=`date`
echo Started at: ${start}
echo Stopped at: ${stopped}