Home | History | Annotate | Download | only in boards
      1 # Copyright 2011-2012 Free Software Foundation, Inc.
      2 
      3 # This program is free software; you can redistribute it and/or modify
      4 # it under the terms of the GNU General Public License as published by
      5 # the Free Software Foundation; either version 3 of the License, or
      6 # (at your option) any later version.
      7 #
      8 # This program is distributed in the hope that it will be useful,
      9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     11 # GNU General Public License for more details.
     12 #
     13 # You should have received a copy of the GNU General Public License
     14 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
     15 
     16 # This file is a dejagnu "board file" and is used to run the testsuite
     17 # natively with gdbserver.
     18 #
     19 # To use this file:
     20 # bash$ touch ${my_dejagnu_dir}/my-dejagnu.exp
     21 # bash$ export DEJAGNU=${my_dejagnu_dir}/my-dejagnu.exp
     22 # bash$ mkdir ${my_dejagnu_dir}/boards
     23 # bash$ cp ${src_dir}/gdb/testsuite/boards/native-gdbserver.exp \
     24 #   ${my_dejagnu_dir}/boards
     25 # bash$ cd ${build_dir}/gdb
     26 # bash$ make check RUNTESTFLAGS="--target_board=native-gdbserver"
     27 
     28 load_generic_config "gdbserver"
     29 process_multilib_options ""
     30 
     31 # The default compiler for this target.
     32 set_board_info compiler "[find_gcc]"
     33 
     34 set_board_info cflags "-fno-stack-protector"
     35 set_board_info cxxflags "-fno-stack-protector"
     36 
     37 set remote_directory "/tmp"
     38 set chrome_device_ip __board_hostname__
     39 
     40 # This gdbserver can only run a process once per session.
     41 set_board_info gdb,do_reload_on_run 1
     42 
     43 # There's no support for argument-passing (yet).
     44 set_board_info noargs 1
     45 
     46 # Can't do input (or output) in the current gdbserver.
     47 set_board_info gdb,noinferiorio 1
     48 
     49 # gdbserver does not intercept target file operations and perform them
     50 # on the host.
     51 set_board_info gdb,nofileio 1
     52 
     53 #set_board_info sockethost "localhost:"
     54 set_board_info use_gdb_stub 1
     55 
     56 # We will be using the standard GDB remote protocol.
     57 set_board_info gdb_protocol "remote"
     58 
     59 # Test the copy of gdbserver in the build directory.
     60 # set_board_info gdb_server_prog "../gdbserver/gdbserver"
     61 
     62 # Can't do hardware watchpoints, in general (it depends on gdbserver support for your target arch)
     63 set_board_info gdb,no_hardware_watchpoints 1
     64 
     65 #Can't do record
     66 set_board_info gdb,use_precord 0
     67 set_board_info gdb,can_reverse 0
     68 
     69 
     70 set gdb_test_timeout 100
     71 set_board_info timeout 100
     72 
     73 set_board_info ssh,options "-i __tmp_testing_rsa__ -o ControlMaster=auto -o ControlPath=__tmp_dir__/%r@%h:%p -o StrictHostKeyChecking=no"
     74 
     75 set_board_info gdb_server_prog "__tmp_dir__/boards/gdbserver.sh "
     76 set_board_info sockethost "__board_hostname__:"
     77 set_board_info protocol standard
     78 set_board_info gdb,socketport "1234"
     79 
     80 
     81 proc ${board}_spawn { board cmd } {
     82     global board_info
     83 
     84     set baseboard [lindex [split $board "/"] 0]
     85 
     86     set board_info($baseboard,isremote) 0
     87     set result [remote_spawn $board $cmd]
     88     set board_info($baseboard,isremote) 1
     89 
     90     return $result
     91 }
     92 
     93 proc ${board}_exec { hostname program args } {
     94     global board_info
     95     verbose -log "$hostname $program $args"
     96     set baseboard [lindex [split $hostname "/"] 0]
     97 
     98     set board_info($baseboard,isremote) 0
     99     set result [remote_exec $hostname $program $args]
    100     set board_info($baseboard,isremote) 1
    101 
    102     return $result
    103 }
    104 
    105 proc ${board}_download { board host dest } {
    106     verbose -log "chrome_download $board $host $dest"
    107     global board_info
    108     set ssh_options [board_info $board ssh,options]
    109     
    110     global chrome_device_ip remote_directory remote_file
    111     
    112     verbose -log "scp -q $ssh_options $host root@$chrome_device_ip:$remote_directory/$dest"
    113     set status [catch "exec scp -q $ssh_options $host root@$chrome_device_ip:$remote_directory/$dest" output]
    114 
    115     if { $status == 0 } {
    116         verbose -log "Copied $host to $remote_directory/$dest" 2
    117         return "$remote_directory/$dest"
    118     } else{
    119         verbose -log "Download to $dest failed, $output." 2
    120         return ""
    121     }
    122 }
    123 
    124 proc ${board}_file { dest op args } {
    125     if { $op == "delete" } {
    126 	return 0
    127     }
    128     return [eval [list standard_file $dest $op] $args]
    129 }
    130 
    131 proc skip_shlid_tests {} {
    132   return 1
    133 }
    134