| 1 | 548 | jeremybenn | #!/bin/bash
 | 
      
         | 2 |  |  |  
 | 
      
         | 3 |  |  | # Copyright (C) 2010 Embecosm Limited
 | 
      
         | 4 |  |  |  
 | 
      
         | 5 |  |  | # Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
 | 
      
         | 6 |  |  |  
 | 
      
         | 7 |  |  | # This file is a script to run each group of GNU tests manually
 | 
      
         | 8 |  |  |  
 | 
      
         | 9 |  |  | # This program is free software; you can redistribute it and/or modify it
 | 
      
         | 10 |  |  | # under the terms of the GNU General Public License as published by the Free
 | 
      
         | 11 |  |  | # Software Foundation; either version 3 of the License, or (at your option)
 | 
      
         | 12 |  |  | # any later version.
 | 
      
         | 13 |  |  |  
 | 
      
         | 14 |  |  | # This program is distributed in the hope that it will be useful, but WITHOUT
 | 
      
         | 15 |  |  | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 | 
      
         | 16 |  |  | # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 | 
      
         | 17 |  |  | # more details.
 | 
      
         | 18 |  |  |  
 | 
      
         | 19 |  |  | # You should have received a copy of the GNU General Public License along
 | 
      
         | 20 |  |  | # with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
      
         | 21 |  |  |  
 | 
      
         | 22 |  |  | # ------------------------------------------------------------------------------
 | 
      
         | 23 |  |  |  
 | 
      
         | 24 |  |  | # For each block of tests we run the tests on a target machine. There are no
 | 
      
         | 25 |  |  | # arguments. The IP address of the target machines are found in the file
 | 
      
         | 26 |  |  | # `dirname ${DEJAGNU}`/ip-avail.txt
 | 
      
         | 27 |  |  |  
 | 
      
         | 28 |  |  |  
 | 
      
         | 29 |  |  | # Set global variables
 | 
      
         | 30 |  |  | function set_globals {
 | 
      
         | 31 |  |  |     root_dir=`dirname ${DEJAGNU}`
 | 
      
         | 32 |  |  |     ip_file=${root_dir}/ip-avail.txt
 | 
      
         | 33 |  |  |     boards_dir=${root_dir}/boards
 | 
      
         | 34 |  |  |     board_file=${boards_dir}/or32-linux-sim.exp
 | 
      
         | 35 |  |  |     tmp_count=/tmp/rat-sema-$$
 | 
      
         | 36 |  |  |     lockfile=/tmp/rat-lockfile-$$
 | 
      
         | 37 |  |  |     ip_count=`wc -l ${ip_file} | cut -d " " -f 1`
 | 
      
         | 38 |  |  |  }
 | 
      
         | 39 |  |  |  
 | 
      
         | 40 |  |  |  
 | 
      
         | 41 |  |  | # Set the count file
 | 
      
         | 42 |  |  |  
 | 
      
         | 43 |  |  | # @param[in] $1  The count to set.
 | 
      
         | 44 |  |  | function set_count {
 | 
      
         | 45 |  |  |  
 | 
      
         | 46 |  |  |     # Lock all the file manipulation.
 | 
      
         | 47 |  |  |     (
 | 
      
         | 48 |  |  |         flock -e 201
 | 
      
         | 49 |  |  |         echo $1 > ${tmp_count}
 | 
      
         | 50 |  |  |     ) 201> ${lockfile}
 | 
      
         | 51 |  |  | }
 | 
      
         | 52 |  |  |  
 | 
      
         | 53 |  |  |  
 | 
      
         | 54 |  |  | # Get the count file
 | 
      
         | 55 |  |  |  
 | 
      
         | 56 |  |  | # @return  The current count
 | 
      
         | 57 |  |  | function get_count {
 | 
      
         | 58 |  |  |  
 | 
      
         | 59 |  |  |     # Lock all the file manipulation.
 | 
      
         | 60 |  |  |     (
 | 
      
         | 61 |  |  |         cat ${tmp_count}
 | 
      
         | 62 |  |  |     ) 201> ${lockfile}
 | 
      
         | 63 |  |  | }
 | 
      
         | 64 |  |  |  
 | 
      
         | 65 |  |  |  
 | 
      
         | 66 |  |  | # Decrement the count file if it is not already zero
 | 
      
         | 67 |  |  |  
 | 
      
         | 68 |  |  | # @return 0 if we suceed in decrementing, 1 otherwise
 | 
      
         | 69 |  |  | function dec_count {
 | 
      
         | 70 |  |  |  
 | 
      
         | 71 |  |  |     # Lock all the file manipulation. Result will be result of function
 | 
      
         | 72 |  |  |     (
 | 
      
         | 73 |  |  |         flock -e 201
 | 
      
         | 74 |  |  |         val=`cat ${tmp_count}`
 | 
      
         | 75 |  |  |  
 | 
      
         | 76 |  |  |         if [ ${val} -gt 0 ]
 | 
      
         | 77 |  |  |         then
 | 
      
         | 78 |  |  |             (( val-- ))
 | 
      
         | 79 |  |  |             echo ${val} > ${tmp_count}
 | 
      
         | 80 |  |  |             return  0
 | 
      
         | 81 |  |  |         else
 | 
      
         | 82 |  |  |             return  1
 | 
      
         | 83 |  |  |         fi
 | 
      
         | 84 |  |  |     ) 201> ${lockfile}
 | 
      
         | 85 |  |  | }
 | 
      
         | 86 |  |  |  
 | 
      
         | 87 |  |  |  
 | 
      
         | 88 |  |  | # Increment the count file
 | 
      
         | 89 |  |  |  
 | 
      
         | 90 |  |  | # @return 0 if we do decrement, 1 if we don't
 | 
      
         | 91 |  |  | function inc_count {
 | 
      
         | 92 |  |  |  
 | 
      
         | 93 |  |  |     # Lock all the file manipulation.
 | 
      
         | 94 |  |  |     (
 | 
      
         | 95 |  |  |         flock -e 201
 | 
      
         | 96 |  |  |         val=`cat ${tmp_count}`
 | 
      
         | 97 |  |  |         (( val++ ))
 | 
      
         | 98 |  |  |         echo ${val} > ${tmp_count}
 | 
      
         | 99 |  |  |     ) 201> ${lockfile}
 | 
      
         | 100 |  |  | }
 | 
      
         | 101 |  |  |  
 | 
      
         | 102 |  |  |  
 | 
      
         | 103 |  |  | # See if telnet or ftp is working
 | 
      
         | 104 |  |  |  
 | 
      
         | 105 |  |  | # We call the program with a sequence
 | 
      
         | 106 |  |  |  
 | 
      
         | 107 |  |  | # command (telnet or ftp)
 | 
      
         | 108 |  |  | # wait for prompt ("telnet> "or "ftp> ")
 | 
      
         | 109 |  |  | # send open <ip address>
 | 
      
         | 110 |  |  | # wait for prompt ("login: " or "Name (<ip address>:<user>): ")
 | 
      
         | 111 |  |  | # send root
 | 
      
         | 112 |  |  | # wait for prompt ("# " or "ftp> ")
 | 
      
         | 113 |  |  | # send exit
 | 
      
         | 114 |  |  | # wait for closing message ("Connection closed by foreign host." or
 | 
      
         | 115 |  |  | #                           "221 Operation successful")
 | 
      
         | 116 |  |  |  
 | 
      
         | 117 |  |  | # @param[in] $1  The command to use (ftp or telnet)
 | 
      
         | 118 |  |  | # @param[in] $2  The IP address
 | 
      
         | 119 |  |  | # @param[in] $3  The connection prompt (regular expression)
 | 
      
         | 120 |  |  | # @param[in] $4  The operational prompt (regular expression)
 | 
      
         | 121 |  |  | # @param[in] $5  The closing message (regular expression)
 | 
      
         | 122 |  |  |  
 | 
      
         | 123 |  |  | # @return  0 on success, non-zero otherwise.
 | 
      
         | 124 |  |  | function check_remote_command {
 | 
      
         | 125 |  |  |  
 | 
      
         | 126 |  |  |     command=$1
 | 
      
         | 127 |  |  |     ip=$2
 | 
      
         | 128 |  |  |     conn_prompt=$3
 | 
      
         | 129 |  |  |     op_prompt=$4
 | 
      
         | 130 |  |  |     close_mess=$5
 | 
      
         | 131 |  |  |  
 | 
      
         | 132 |  |  |     expect -f - <<EOF > /dev/null 2>&1
 | 
      
         | 133 |  |  |     spawn "${command}"
 | 
      
         | 134 |  |  |  
 | 
      
         | 135 | 553 | jeremybenn |     set timeout 30
 | 
      
         | 136 | 548 | jeremybenn |     expect {
 | 
      
         | 137 |  |  |         "${command}> " {}
 | 
      
         | 138 |  |  |         timeout    {exit 1}
 | 
      
         | 139 |  |  |     }
 | 
      
         | 140 |  |  |  
 | 
      
         | 141 |  |  |     send "open ${ip}\n"
 | 
      
         | 142 |  |  |  
 | 
      
         | 143 |  |  |     expect {
 | 
      
         | 144 |  |  |         -re "${conn_prompt}" {}
 | 
      
         | 145 |  |  |         timeout   {exit 2}
 | 
      
         | 146 |  |  |     }
 | 
      
         | 147 |  |  |  
 | 
      
         | 148 |  |  |     send "root\n"
 | 
      
         | 149 |  |  |  
 | 
      
         | 150 |  |  |     expect {
 | 
      
         | 151 |  |  |         -re "${op_prompt}" {}
 | 
      
         | 152 |  |  |         timeout   {exit 3}
 | 
      
         | 153 |  |  |     }
 | 
      
         | 154 |  |  |  
 | 
      
         | 155 |  |  |     send "exit\n"
 | 
      
         | 156 |  |  |  
 | 
      
         | 157 |  |  |     expect {
 | 
      
         | 158 |  |  |         -re "${close_mess}" {exit 0}
 | 
      
         | 159 |  |  |         timeout {exit 4}
 | 
      
         | 160 |  |  |     }
 | 
      
         | 161 |  |  | EOF
 | 
      
         | 162 |  |  |  
 | 
      
         | 163 |  |  |     return $?
 | 
      
         | 164 |  |  | }
 | 
      
         | 165 |  |  |  
 | 
      
         | 166 |  |  |  
 | 
      
         | 167 |  |  | # See if telnet is working.
 | 
      
         | 168 |  |  |  
 | 
      
         | 169 |  |  | # We call check_remote_command with appropriate arguments
 | 
      
         | 170 |  |  |  
 | 
      
         | 171 |  |  | # @param[in] $1  The IP address
 | 
      
         | 172 |  |  |  
 | 
      
         | 173 |  |  | # @return  0 on success, non-zero otherwise.
 | 
      
         | 174 |  |  | function check_telnet {
 | 
      
         | 175 |  |  |     check_remote_command telnet $1 "^.* login: " "^.*# " \
 | 
      
         | 176 |  |  |         "Connection closed by foreign host."
 | 
      
         | 177 |  |  |  
 | 
      
         | 178 |  |  |     return $?
 | 
      
         | 179 |  |  | }
 | 
      
         | 180 |  |  |  
 | 
      
         | 181 |  |  |  
 | 
      
         | 182 |  |  | # See if FTP is working.
 | 
      
         | 183 |  |  |  
 | 
      
         | 184 |  |  | # We call check_remote_command with appropriate arguments
 | 
      
         | 185 |  |  |  
 | 
      
         | 186 |  |  | # @param[in] $1  The IP address
 | 
      
         | 187 |  |  |  
 | 
      
         | 188 |  |  | # @return  0 on success, non-zero otherwise.
 | 
      
         | 189 |  |  |  
 | 
      
         | 190 |  |  | function check_ftp {
 | 
      
         | 191 |  |  |     check_remote_command ftp $1 "Name \\\($1:.*\\\): " "ftp> " \
 | 
      
         | 192 |  |  |         "221 Operation successful"
 | 
      
         | 193 |  |  |  
 | 
      
         | 194 |  |  |     return $?
 | 
      
         | 195 |  |  | }
 | 
      
         | 196 |  |  |  
 | 
      
         | 197 |  |  |  
 | 
      
         | 198 |  |  | # See if telnet and FTP are working.
 | 
      
         | 199 |  |  |  
 | 
      
         | 200 |  |  | # We combine calls to check_telnet and check_ftp. Note that we do check both,
 | 
      
         | 201 |  |  | # even though we really only need to check one for failure. However in the
 | 
      
         | 202 |  |  | # future the additional information may be useful.
 | 
      
         | 203 |  |  |  
 | 
      
         | 204 |  |  | # @param[in] $1  The IP address
 | 
      
         | 205 |  |  |  
 | 
      
         | 206 |  |  | # @return  0 on success, non-zero (10 x telnet failure + ftp failure)
 | 
      
         | 207 |  |  | #          otherwise.
 | 
      
         | 208 |  |  | function check_telnet_ftp {
 | 
      
         | 209 |  |  |     check_telnet $1
 | 
      
         | 210 |  |  |     res_telnet=$?
 | 
      
         | 211 |  |  |     check_ftp $1
 | 
      
         | 212 |  |  |     res_ftp=$?
 | 
      
         | 213 |  |  |  
 | 
      
         | 214 |  |  |     return $(( $res_telnet * 10 + $res_ftp ))
 | 
      
         | 215 |  |  | }
 | 
      
         | 216 |  |  |  
 | 
      
         | 217 |  |  |  
 | 
      
         | 218 |  |  | # Run one block of tests. The arguments in order are:
 | 
      
         | 219 |  |  |  
 | 
      
         | 220 |  |  | # @param[in] $1  the test directory
 | 
      
         | 221 |  |  | # @param[in] $2  the source directory
 | 
      
         | 222 |  |  | # @param[in] $3  the name of the tool
 | 
      
         | 223 |  |  | # @param[in] $4  the base name of the test file & test file name.
 | 
      
         | 224 |  |  | # @param[in] $5  an index (increments on each retry)
 | 
      
         | 225 |  |  |  
 | 
      
         | 226 |  |  | # @return  0 if the IP address is still alive at the end of the test, 1 if it
 | 
      
         | 227 |  |  | #          is not.
 | 
      
         | 228 |  |  | function run_test_block {
 | 
      
         | 229 |  |  |     test_dir=$1
 | 
      
         | 230 |  |  |     src_dir=$2
 | 
      
         | 231 |  |  |     tool=$3
 | 
      
         | 232 |  |  |     test_base=`echo $4 | sed -e 's/#.*$//'`
 | 
      
         | 233 |  |  |     test_file=`echo $4 | sed -e 's/^.*#//' -e 's/%/ /g'`
 | 
      
         | 234 |  |  |     index=$5
 | 
      
         | 235 |  |  |  
 | 
      
         | 236 |  |  |     echo "test_dir=${test_dir}"
 | 
      
         | 237 |  |  |     echo "src_dir=${src_dir}"
 | 
      
         | 238 |  |  |     echo "tool=${tool}"
 | 
      
         | 239 |  |  |     echo "test_base=${test_base}"
 | 
      
         | 240 |  |  |     echo "test_file=${test_file}"
 | 
      
         | 241 |  |  |  
 | 
      
         | 242 |  |  |     log_file="${test_base}.log"
 | 
      
         | 243 |  |  |     sum_file="${test_base}.sum"
 | 
      
         | 244 |  |  |     res_dir="${tool}/${test_base}"
 | 
      
         | 245 |  |  |  
 | 
      
         | 246 |  |  |     # Run the tests, with the result in a directory of its own.
 | 
      
         | 247 |  |  |     echo "Running ${test_file}"
 | 
      
         | 248 |  |  |     mkdir -p ${test_dir}
 | 
      
         | 249 |  |  |     cd ${test_dir}
 | 
      
         | 250 |  |  |     mkdir -p ${res_dir}
 | 
      
         | 251 |  |  |  
 | 
      
         | 252 | 550 | jeremybenn |     runtest --target=or32-linux          \
 | 
      
         | 253 | 548 | jeremybenn |             --srcdir=${src_dir}          \
 | 
      
         | 254 |  |  |             --tool=${tool}               \
 | 
      
         | 255 |  |  |             --outdir=${res_dir}          \
 | 
      
         | 256 |  |  |             --objdir=${test_dir}/${tool} \
 | 
      
         | 257 |  |  |             "${test_file}"
 | 
      
         | 258 |  |  |  
 | 
      
         | 259 |  |  |     # Use sed to get rid of irritating ctrl-M characters and move the files to
 | 
      
         | 260 |  |  |     # the main results directory.
 | 
      
         | 261 |  |  |     sed -e 's/\r//g' < ${res_dir}/${tool}.log > ${tool}/${log_file}
 | 
      
         | 262 |  |  |     sed -e 's/\r//g' < ${res_dir}/${tool}.sum > ${tool}/${sum_file}
 | 
      
         | 263 |  |  |     rm -rf ${res_dir}
 | 
      
         | 264 |  |  |  
 | 
      
         | 265 |  |  |     # If the telnet or FTP to the IP address is dead, we assume the test
 | 
      
         | 266 |  |  |     # failed, the target machine having died (at last partially), so we return
 | 
      
         | 267 | 553 | jeremybenn |     # failure having blown away that IP address.
 | 
      
         | 268 |  |  |  
 | 
      
         | 269 |  |  |     # We also need to fail if we see any TCL or expect error messages (with
 | 
      
         | 270 |  |  |     # the string "ERROR: ". These are indicative of transient failures.
 | 
      
         | 271 | 548 | jeremybenn |     ip=`sed < ${tool}/${log_file} -n -e 's/OR32 target hostname is //p'`
 | 
      
         | 272 |  |  |     if check_telnet_ftp ${ip}
 | 
      
         | 273 |  |  |     then
 | 
      
         | 274 | 553 | jeremybenn |         if grep "ERROR: " ${tool}/${log_file} > /dev/null 2>&1
 | 
      
         | 275 |  |  |         then
 | 
      
         | 276 |  |  |             echo "Running ${test_file} on ${ip} hit TCL/expect failure"
 | 
      
         | 277 |  |  |             mv ${tool}/${log_file} ${tool}/${log_file}-failed-$$-${index}
 | 
      
         | 278 |  |  |             mv ${tool}/${sum_file} ${tool}/${sum_file}-failed-$$-${index}
 | 
      
         | 279 |  |  |             res=1
 | 
      
         | 280 |  |  |         else
 | 
      
         | 281 |  |  |             echo "Running ${test_file} on ${ip} completed successfully"
 | 
      
         | 282 |  |  |             res=0
 | 
      
         | 283 |  |  |         fi
 | 
      
         | 284 | 548 | jeremybenn |     else
 | 
      
         | 285 | 553 | jeremybenn |         echo "Running ${test_file} on ${ip} died with code $?"
 | 
      
         | 286 | 548 | jeremybenn |         mv ${tool}/${log_file} ${tool}/${log_file}-failed-$$-${index}
 | 
      
         | 287 |  |  |         mv ${tool}/${sum_file} ${tool}/${sum_file}-failed-$$-${index}
 | 
      
         | 288 |  |  |         ${root_dir}/get-ip.sh --delete ${ip}
 | 
      
         | 289 |  |  |         res=1
 | 
      
         | 290 |  |  |     fi
 | 
      
         | 291 |  |  |  
 | 
      
         | 292 |  |  |     cd - > /dev/null 2>&1
 | 
      
         | 293 |  |  |     return  ${res}
 | 
      
         | 294 |  |  |  
 | 
      
         | 295 |  |  | }
 | 
      
         | 296 |  |  |  
 | 
      
         | 297 |  |  |  
 | 
      
         | 298 |  |  | # Create a site.exp file in the test directory. This is automatically done
 | 
      
         | 299 |  |  | # with automake, but we must do it by hand. The arguments are:
 | 
      
         | 300 |  |  | #  the test directory
 | 
      
         | 301 |  |  | function create_local_config {
 | 
      
         | 302 |  |  |     test_dir=$1
 | 
      
         | 303 |  |  |     shift
 | 
      
         | 304 |  |  |     cf=${test_dir}/site.exp
 | 
      
         | 305 |  |  |  
 | 
      
         | 306 |  |  |     # This omits setting TEST_GCC_EXEC_PREFIX (to "/opt/or32-new/lib/gcc/")
 | 
      
         | 307 |  |  |     # and LDFLAGS (appends "
 | 
      
         | 308 |  |  |     # -L/home/jeremy/svntrunk/GNU/or32/bd-linux/gcc/../ld"). These values are
 | 
      
         | 309 |  |  |     # only set for gcc/g++ in the original automake anyway.
 | 
      
         | 310 |  |  |     echo "set rootme \"${test_dir}/..\""              >  ${cf}
 | 
      
         | 311 |  |  |     echo "set host_triplet i686-pc-linux-gnu"         >> ${cf}
 | 
      
         | 312 |  |  |     echo "set build_triplet i686-pc-linux-gnu"        >> ${cf}
 | 
      
         | 313 |  |  |     echo "set target_triplet or32-unknown-linux-gnu"  >> ${cf}
 | 
      
         | 314 |  |  |     echo "set target_alias or32-linux"                >> ${cf}
 | 
      
         | 315 |  |  |     echo "set libiconv \"\""                          >> ${cf}
 | 
      
         | 316 |  |  |     echo "set CFLAGS \"\""                            >> ${cf}
 | 
      
         | 317 |  |  |     echo "set CXXFLAGS \"\""                          >> ${cf}
 | 
      
         | 318 |  |  |     echo "set HOSTCC \"gcc\""                         >> ${cf}
 | 
      
         | 319 |  |  |     echo "set HOSTCFLAGS \"-g -O2\""                  >> ${cf}
 | 
      
         | 320 |  |  |     echo "set TESTING_IN_BUILD_TREE 1"                >> ${cf}
 | 
      
         | 321 |  |  |     echo "set HAVE_LIBSTDCXX_V3 1"                    >> ${cf}
 | 
      
         | 322 |  |  |     echo "set ENABLE_PLUGIN 1"                        >> ${cf}
 | 
      
         | 323 |  |  |     echo "set PLUGINCC \"gcc\""                       >> ${cf}
 | 
      
         | 324 |  |  |     echo "set PLUGINCFLAGS \"-g \""                   >> ${cf}
 | 
      
         | 325 |  |  |     echo "set GMPINC \"\""                            >> ${cf}
 | 
      
         | 326 |  |  |     echo "append LDFLAGS \" -L${test_dir}/../../ld\"" >> ${cf}
 | 
      
         | 327 |  |  |     echo "set tmpdir \"${test_dir}\""                 >> ${cf}
 | 
      
         | 328 |  |  | }
 | 
      
         | 329 |  |  |  
 | 
      
         | 330 |  |  |  
 | 
      
         | 331 |  |  | # Run all the tests for a tool. The arguments in order are:
 | 
      
         | 332 |  |  | #  the test directory
 | 
      
         | 333 |  |  | #  the source directory
 | 
      
         | 334 |  |  | #  the name of the tool
 | 
      
         | 335 |  |  | #  All the test base names
 | 
      
         | 336 |  |  | function run_tool_tests {
 | 
      
         | 337 |  |  |     test_dir=$1
 | 
      
         | 338 |  |  |     shift
 | 
      
         | 339 |  |  |     src_dir=$1
 | 
      
         | 340 |  |  |     shift
 | 
      
         | 341 |  |  |     tool=$1
 | 
      
         | 342 |  |  |     shift
 | 
      
         | 343 |  |  |  
 | 
      
         | 344 | 553 | jeremybenn |     # If we have no IP addresses, give up here.
 | 
      
         | 345 |  |  |     if ${root_dir}/get-ip.sh > /dev/null 2>&1
 | 
      
         | 346 |  |  |     then
 | 
      
         | 347 |  |  |         true
 | 
      
         | 348 |  |  |     else
 | 
      
         | 349 |  |  |         echo "No IP addresses - exiting"
 | 
      
         | 350 |  |  |         exit 1
 | 
      
         | 351 |  |  |     fi
 | 
      
         | 352 |  |  |  
 | 
      
         | 353 | 548 | jeremybenn |     # Create the local config file for DejaGnu
 | 
      
         | 354 |  |  |     create_local_config ${test_dir}
 | 
      
         | 355 |  |  |  
 | 
      
         | 356 |  |  |     for t in $*
 | 
      
         | 357 |  |  |     do
 | 
      
         | 358 |  |  |         # Wait until an IP address is free
 | 
      
         | 359 |  |  |         until dec_count
 | 
      
         | 360 |  |  |         do
 | 
      
         | 361 |  |  |             sleep 1
 | 
      
         | 362 |  |  |         done
 | 
      
         | 363 |  |  |  
 | 
      
         | 364 |  |  |         # Run the test in the background
 | 
      
         | 365 |  |  |         (
 | 
      
         | 366 |  |  |             index=1
 | 
      
         | 367 | 553 | jeremybenn |  
 | 
      
         | 368 | 548 | jeremybenn |             until run_test_block ${test_dir} ${src_dir} ${tool} ${t} ${index}
 | 
      
         | 369 |  |  |             do
 | 
      
         | 370 | 553 | jeremybenn |                 # Give up if there are no more IP addresses.
 | 
      
         | 371 |  |  |                 if ${root_dir}/get-ip.sh > /dev/null 2>&1
 | 
      
         | 372 |  |  |                 then
 | 
      
         | 373 |  |  |                     continue
 | 
      
         | 374 |  |  |                 else
 | 
      
         | 375 |  |  |                     break
 | 
      
         | 376 |  |  |                 fi
 | 
      
         | 377 | 548 | jeremybenn |                 index=$(( ${index} + 1 ))
 | 
      
         | 378 |  |  |             done
 | 
      
         | 379 |  |  |  
 | 
      
         | 380 |  |  |             inc_count
 | 
      
         | 381 |  |  |         ) &
 | 
      
         | 382 | 553 | jeremybenn |  
 | 
      
         | 383 |  |  |         # If we have exhausted all the IP addresses, give up here.
 | 
      
         | 384 |  |  |         if ${root_dir}/get-ip.sh > /dev/null 2>&1
 | 
      
         | 385 |  |  |         then
 | 
      
         | 386 |  |  |             true
 | 
      
         | 387 |  |  |         else
 | 
      
         | 388 |  |  |             echo "Out of IP addresses - exiting"
 | 
      
         | 389 |  |  |             exit 1
 | 
      
         | 390 |  |  |         fi
 | 
      
         | 391 | 548 | jeremybenn |     done
 | 
      
         | 392 |  |  | }
 | 
      
         | 393 |  |  |  
 | 
      
         | 394 |  |  |  
 | 
      
         | 395 |  |  | # Initalize all the global variables.
 | 
      
         | 396 |  |  | set_globals $*
 | 
      
         | 397 |  |  | set_count ${ip_count}
 | 
      
         | 398 |  |  |  
 | 
      
         | 399 |  |  | # Where to find gcc/g++ tests
 | 
      
         | 400 |  |  | gcc_test_dir=${root_dir}/bd-linux/gcc/testsuite
 | 
      
         | 401 |  |  | gcc_src_dir=${root_dir}/unisrc/gcc/testsuite
 | 
      
         | 402 |  |  |  
 | 
      
         | 403 |  |  | # The list of GCC tests to run.  These are the tests actually used in make
 | 
      
         | 404 |  |  | # check-gcc. The test is a test base name followed by the .exp file name. Most
 | 
      
         | 405 |  |  | # of them are target specific and do nothing.
 | 
      
         | 406 |  |  | td=${gcc_src_dir}/gcc.c-torture
 | 
      
         | 407 |  |  | exec1_list=`cd ${td}; echo execute/200[0-1]*`
 | 
      
         | 408 |  |  | exec2_list=`cd ${td}; echo execute/200[2-3]* execute/20[1-9]*`
 | 
      
         | 409 |  |  | exec3_list=`cd ${td}; echo execute/200[4-9]*`
 | 
      
         | 410 |  |  | exec4_list=`cd ${td}; echo execute/[013-89][0-4]*`
 | 
      
         | 411 |  |  | exec5_list=`cd ${td}; echo execute/[013-89][5-9]*`
 | 
      
         | 412 |  |  | exec6_list=`cd ${td}; echo execute/[abc-lABC-L]*`
 | 
      
         | 413 |  |  | exec7_list=`cd ${td}; echo execute/p[^r]* execute/pr[0-3]*`
 | 
      
         | 414 |  |  | exec8_list=`cd ${td}; echo execute/pr[^0-3]* execute/[mnMNq-zQ-Z]*`
 | 
      
         | 415 |  |  |  
 | 
      
         | 416 |  |  | exec1_list=`echo ${exec1_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 417 |  |  | exec2_list=`echo ${exec2_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 418 |  |  | exec3_list=`echo ${exec3_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 419 |  |  | exec4_list=`echo ${exec4_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 420 |  |  | exec5_list=`echo ${exec5_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 421 |  |  | exec6_list=`echo ${exec6_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 422 |  |  | exec7_list=`echo ${exec7_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 423 |  |  | exec8_list=`echo ${exec8_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 424 |  |  |  
 | 
      
         | 425 |  |  | gcc_test_list="aapcs#aapcs.exp \
 | 
      
         | 426 |  |  |                abi-avx#abi-avx.exp \
 | 
      
         | 427 |  |  |                abi-x86_64#abi-x86_64.exp \
 | 
      
         | 428 |  |  |                acker1#acker1.exp \
 | 
      
         | 429 |  |  |                alpha#alpha.exp \
 | 
      
         | 430 |  |  |                arm#arm.exp \
 | 
      
         | 431 |  |  |                arm-isr#arm-isr.exp \
 | 
      
         | 432 |  |  |                autopar#autopar.exp \
 | 
      
         | 433 |  |  |                avr#avr.exp \
 | 
      
         | 434 |  |  |                avr-torture#avr-torture.exp \
 | 
      
         | 435 |  |  |                bfin#bfin.exp \
 | 
      
         | 436 |  |  |                bprob#bprob.exp \
 | 
      
         | 437 |  |  |                builtins#builtins.exp \
 | 
      
         | 438 |  |  |                callabi#callabi.exp \
 | 
      
         | 439 |  |  |                charset#charset.exp \
 | 
      
         | 440 |  |  |                compat#compat.exp \
 | 
      
         | 441 |  |  |                compile#compile.exp \
 | 
      
         | 442 |  |  |                cpp#cpp.exp \
 | 
      
         | 443 |  |  |                cris#cris.exp \
 | 
      
         | 444 |  |  |                cris-torture#cris-torture.exp \
 | 
      
         | 445 |  |  |                debug#debug.exp \
 | 
      
         | 446 |  |  |                dectest#dectest.exp \
 | 
      
         | 447 |  |  |                dfp#dfp.exp \
 | 
      
         | 448 |  |  |                dg#dg.exp \
 | 
      
         | 449 |  |  |                dg-torture#dg-torture.exp \
 | 
      
         | 450 |  |  |                dhry#dhry.exp \
 | 
      
         | 451 |  |  |                dwarf2#dwarf2.exp \
 | 
      
         | 452 |  |  |                ea#ea.exp \
 | 
      
         | 453 |  |  |                execute-1#execute.exp=${exec1_list} \
 | 
      
         | 454 |  |  |                execute-2#execute.exp=${exec2_list} \
 | 
      
         | 455 |  |  |                execute-3#execute.exp=${exec3_list} \
 | 
      
         | 456 |  |  |                execute-4#execute.exp=${exec4_list} \
 | 
      
         | 457 |  |  |                execute-5#execute.exp=${exec5_list} \
 | 
      
         | 458 |  |  |                execute-6#execute.exp=${exec6_list} \
 | 
      
         | 459 |  |  |                execute-7#execute.exp=${exec7_list} \
 | 
      
         | 460 |  |  |                execute-8#execute.exp=${exec8_list} \
 | 
      
         | 461 |  |  |                fixed-point#fixed-point.exp \
 | 
      
         | 462 |  |  |                format#format.exp \
 | 
      
         | 463 |  |  |                frv#frv.exp \
 | 
      
         | 464 |  |  |                gcov#gcov.exp \
 | 
      
         | 465 |  |  |                gomp#gomp.exp \
 | 
      
         | 466 |  |  |                graphite#graphite.exp \
 | 
      
         | 467 |  |  |                guality#guality.exp \
 | 
      
         | 468 |  |  |                help#help.exp \
 | 
      
         | 469 |  |  |                i386-costmodel-vect#i386-costmodel-vect.exp \
 | 
      
         | 470 |  |  |                i386#i386.exp \
 | 
      
         | 471 |  |  |                i386-prefetch#i386-prefetch.exp \
 | 
      
         | 472 |  |  |                ia64#ia64.exp \
 | 
      
         | 473 |  |  |                ieee#ieee.exp \
 | 
      
         | 474 |  |  |                ipa#ipa.exp \
 | 
      
         | 475 |  |  |                linkage#linkage.exp \
 | 
      
         | 476 |  |  |                lto#lto.exp \
 | 
      
         | 477 |  |  |                m68k#m68k.exp \
 | 
      
         | 478 |  |  |                math-torture#math-torture.exp \
 | 
      
         | 479 |  |  |                matrix1#matrix1.exp \
 | 
      
         | 480 |  |  |                matrix#matrix.exp \
 | 
      
         | 481 |  |  |                mg-2#mg-2.exp \
 | 
      
         | 482 |  |  |                mg#mg.exp \
 | 
      
         | 483 |  |  |                mips16-inter#mips16-inter.exp \
 | 
      
         | 484 |  |  |                mips-abi#mips-abi.exp \
 | 
      
         | 485 |  |  |                mips#mips.exp \
 | 
      
         | 486 |  |  |                mips-nonpic#mips-nonpic.exp \
 | 
      
         | 487 |  |  |                neon#neon.exp \
 | 
      
         | 488 |  |  |                noncompile#noncompile.exp \
 | 
      
         | 489 |  |  |                options#options.exp \
 | 
      
         | 490 |  |  |                pch#pch.exp \
 | 
      
         | 491 |  |  |                plugin#plugin.exp \
 | 
      
         | 492 |  |  |                powerpc#powerpc.exp \
 | 
      
         | 493 |  |  |                ppc-costmodel-vect#ppc-costmodel-vect.exp \
 | 
      
         | 494 |  |  |                rx#rx.exp \
 | 
      
         | 495 |  |  |                s390#s390.exp \
 | 
      
         | 496 |  |  |                sh#sh.exp \
 | 
      
         | 497 |  |  |                sieve#sieve.exp \
 | 
      
         | 498 |  |  |                sort2#sort2.exp \
 | 
      
         | 499 |  |  |                sparc#sparc.exp \
 | 
      
         | 500 |  |  |                special#special.exp \
 | 
      
         | 501 |  |  |                spu-costmodel-vect#spu-costmodel-vect.exp \
 | 
      
         | 502 |  |  |                spu#spu.exp \
 | 
      
         | 503 |  |  |                stackalign#stackalign.exp \
 | 
      
         | 504 |  |  |                struct-layout-1#struct-layout-1.exp \
 | 
      
         | 505 |  |  |                struct-reorg#struct-reorg.exp \
 | 
      
         | 506 |  |  |                test-framework#test-framework.exp \
 | 
      
         | 507 |  |  |                tls#tls.exp \
 | 
      
         | 508 |  |  |                trad#trad.exp \
 | 
      
         | 509 |  |  |                tree-prof#tree-prof.exp \
 | 
      
         | 510 |  |  |                tree-ssa#tree-ssa.exp \
 | 
      
         | 511 |  |  |                unsorted#unsorted.exp \
 | 
      
         | 512 |  |  |                vect#vect.exp \
 | 
      
         | 513 |  |  |                vmx#vmx.exp \
 | 
      
         | 514 |  |  |                vxworks#vxworks.exp \
 | 
      
         | 515 |  |  |                weak#weak.exp \
 | 
      
         | 516 |  |  |                x86_64-costmodel-vect#x86_64-costmodel-vect.exp \
 | 
      
         | 517 |  |  |                xstormy16#xstormy16.exp"
 | 
      
         | 518 |  |  |  
 | 
      
         | 519 |  |  | # The list of G++ tests to run. These are the tests actually used in make
 | 
      
         | 520 |  |  | # check-gcc. The test is a test base name followed by the .exp file name.
 | 
      
         | 521 |  |  | gpp_test_list="bprob#bprob.exp \
 | 
      
         | 522 |  |  |                charset#charset.exp \
 | 
      
         | 523 |  |  |                compat#compat.exp \
 | 
      
         | 524 |  |  |                debug#debug.exp \
 | 
      
         | 525 |  |  |                dfp#dfp.exp \
 | 
      
         | 526 |  |  |                dg#dg.exp \
 | 
      
         | 527 |  |  |                dg-torture#dg-torture.exp \
 | 
      
         | 528 |  |  |                dwarf2#dwarf2.exp \
 | 
      
         | 529 |  |  |                ecos#ecos.exp \
 | 
      
         | 530 |  |  |                gcov#gcov.exp \
 | 
      
         | 531 |  |  |                gomp#gomp.exp \
 | 
      
         | 532 |  |  |                graphite#graphite.exp \
 | 
      
         | 533 |  |  |                lto#lto.exp \
 | 
      
         | 534 |  |  |                old-deja#old-deja.exp \
 | 
      
         | 535 |  |  |                pch#pch.exp \
 | 
      
         | 536 |  |  |                plugin#plugin.exp \
 | 
      
         | 537 |  |  |                stackalign#stackalign.exp \
 | 
      
         | 538 |  |  |                struct-layout-1#struct-layout-1.exp \
 | 
      
         | 539 |  |  |                tls#tls.exp \
 | 
      
         | 540 |  |  |                tree-prof#tree-prof.exp \
 | 
      
         | 541 |  |  |                unix#unix.exp"
 | 
      
         | 542 |  |  |  
 | 
      
         | 543 |  |  | # Where to find libstdc++-v3 tests
 | 
      
         | 544 |  |  | lib_test_dir=${root_dir}/bd-linux/or32-linux/libstdc++-v3/testsuite
 | 
      
         | 545 |  |  | lib_src_dir=${root_dir}/unisrc/libstdc++-v3/testsuite
 | 
      
         | 546 |  |  |  
 | 
      
         | 547 |  |  | # The list of libstdc++-v3 tests to run. These are the tests actually used in
 | 
      
         | 548 |  |  | # make check-libstdc++-v3. The test is a test base name followed by the .exp
 | 
      
         | 549 |  |  | # file name.
 | 
      
         | 550 |  |  | conf1_list=`cd ${lib_src_dir}; echo [ab]* de* p*/*`
 | 
      
         | 551 |  |  | conf2_list=`cd ${lib_src_dir}; echo e*/[a-m]*`
 | 
      
         | 552 |  |  | conf3_list=`cd ${lib_src_dir}; echo e*/n*`
 | 
      
         | 553 |  |  | conf4_list=`cd ${lib_src_dir}; echo e*/pb*`
 | 
      
         | 554 |  |  | conf5_list=`cd ${lib_src_dir}; echo e*/po* e*/pr*`
 | 
      
         | 555 |  |  | conf6_list=`cd ${lib_src_dir}; echo e*/[^a-p]*`
 | 
      
         | 556 |  |  | conf7_list=`cd ${lib_src_dir}; echo [013-9]*/* 20_*/*`
 | 
      
         | 557 |  |  | conf8_list=`cd ${lib_src_dir}; echo 21_*/*`
 | 
      
         | 558 |  |  | conf9_list=`cd ${lib_src_dir}; echo 22_*/*`
 | 
      
         | 559 |  |  | conf10_list=`cd ${lib_src_dir}; echo 23_*/[a-m]*`
 | 
      
         | 560 |  |  | conf11_list=`cd ${lib_src_dir}; echo 23_*/[^a-m]*`
 | 
      
         | 561 |  |  | conf12_list=`cd ${lib_src_dir}; echo 24_*/* 25_*/*`
 | 
      
         | 562 |  |  | conf13_list=`cd ${lib_src_dir}; echo 26_*/*`
 | 
      
         | 563 |  |  | conf14_list=`cd ${lib_src_dir}; echo 27_*/basic_f*`
 | 
      
         | 564 |  |  | conf15_list=`cd ${lib_src_dir}; echo 27_*/basic_s*`
 | 
      
         | 565 |  |  | conf16_list=`cd ${lib_src_dir}; echo 27_*/basic_i*`
 | 
      
         | 566 |  |  | conf17_list=`cd ${lib_src_dir}; echo 27_*/basic_of*`
 | 
      
         | 567 |  |  | conf18_list=`cd ${lib_src_dir}; echo 27_*/basic_os*`
 | 
      
         | 568 |  |  | conf19_list=`cd ${lib_src_dir}; echo 27_*/[^b]* 2[8-9]_*/*`
 | 
      
         | 569 |  |  | conf20_list=`cd ${lib_src_dir}; echo t*/[0-5]*`
 | 
      
         | 570 |  |  | conf21_list=`cd ${lib_src_dir}; echo t*/[^0-5]*`
 | 
      
         | 571 |  |  |  
 | 
      
         | 572 |  |  | conf1_list=`echo ${conf1_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 573 |  |  | conf2_list=`echo ${conf2_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 574 |  |  | conf3_list=`echo ${conf3_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 575 |  |  | conf4_list=`echo ${conf4_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 576 |  |  | conf5_list=`echo ${conf5_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 577 |  |  | conf6_list=`echo ${conf6_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 578 |  |  | conf7_list=`echo ${conf7_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 579 |  |  | conf8_list=`echo ${conf8_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 580 |  |  | conf9_list=`echo ${conf9_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 581 |  |  | conf10_list=`echo ${conf10_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 582 |  |  | conf11_list=`echo ${conf11_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 583 |  |  | conf12_list=`echo ${conf12_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 584 |  |  | conf13_list=`echo ${conf13_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 585 |  |  | conf14_list=`echo ${conf14_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 586 |  |  | conf15_list=`echo ${conf15_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 587 |  |  | conf16_list=`echo ${conf16_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 588 |  |  | conf17_list=`echo ${conf17_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 589 |  |  | conf18_list=`echo ${conf18_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 590 |  |  | conf19_list=`echo ${conf19_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 591 |  |  | conf20_list=`echo ${conf20_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 592 |  |  | conf21_list=`echo ${conf21_list} | sed -e 's/ /* /g' -e 's/$/*/' -e 's/ /%/g'`
 | 
      
         | 593 |  |  |  
 | 
      
         | 594 |  |  | lib_test_list="abi#abi.exp \
 | 
      
         | 595 |  |  |                conformance-1#conformance.exp=${conf1_list} \
 | 
      
         | 596 |  |  |                conformance-2#conformance.exp=${conf2_list} \
 | 
      
         | 597 |  |  |                conformance-3#conformance.exp=${conf3_list} \
 | 
      
         | 598 |  |  |                conformance-4#conformance.exp=${conf4_list} \
 | 
      
         | 599 |  |  |                conformance-5#conformance.exp=${conf5_list} \
 | 
      
         | 600 |  |  |                conformance-6#conformance.exp=${conf6_list} \
 | 
      
         | 601 |  |  |                conformance-7#conformance.exp=${conf7_list} \
 | 
      
         | 602 |  |  |                conformance-8#conformance.exp=${conf8_list} \
 | 
      
         | 603 |  |  |                conformance-9#conformance.exp=${conf9_list} \
 | 
      
         | 604 |  |  |                conformance-10#conformance.exp=${conf10_list} \
 | 
      
         | 605 |  |  |                conformance-11#conformance.exp=${conf11_list} \
 | 
      
         | 606 |  |  |                conformance-12#conformance.exp=${conf12_list} \
 | 
      
         | 607 |  |  |                conformance-13#conformance.exp=${conf13_list} \
 | 
      
         | 608 |  |  |                conformance-14#conformance.exp=${conf14_list} \
 | 
      
         | 609 |  |  |                conformance-15#conformance.exp=${conf15_list} \
 | 
      
         | 610 |  |  |                conformance-16#conformance.exp=${conf16_list} \
 | 
      
         | 611 |  |  |                conformance-17#conformance.exp=${conf17_list} \
 | 
      
         | 612 |  |  |                conformance-18#conformance.exp=${conf18_list} \
 | 
      
         | 613 |  |  |                conformance-19#conformance.exp=${conf19_list} \
 | 
      
         | 614 |  |  |                conformance-20#conformance.exp=${conf20_list} \
 | 
      
         | 615 |  |  |                conformance-21#conformance.exp=${conf21_list}"
 | 
      
         | 616 |  |  |  
 | 
      
         | 617 | 553 | jeremybenn |  
 | 
      
         | 618 | 548 | jeremybenn | run_tool_tests ${gcc_test_dir} ${gcc_src_dir} "gcc" ${gcc_test_list}
 | 
      
         | 619 |  |  | run_tool_tests ${gcc_test_dir} ${gcc_src_dir} "g++" ${gpp_test_list}
 | 
      
         | 620 |  |  | run_tool_tests ${lib_test_dir} ${lib_src_dir} "libstdc++" ${lib_test_list}
 | 
      
         | 621 |  |  |  
 | 
      
         | 622 |  |  | # Wait for all the tests to finish
 | 
      
         | 623 |  |  | while [ `get_count` != "${ip_count}" ]
 | 
      
         | 624 |  |  | do
 | 
      
         | 625 |  |  |     sleep 1
 | 
      
         | 626 |  |  | done
 |