1 # Copyright (C) 1999 Free Software Foundation, Inc.
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 2 of the License, or
6 # (at your option) any later version.
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.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
28 # test only on a remote target board
29 if {! [is_remote target]} {
35 set srcfile ${testfile}.c
36 set binfile ${objdir}/${subdir}/${testfile}
40 set result [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}]
41 if {$result != "" } then {
42 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
47 # Part ONE: Check the down load commands
50 gdb_test "show download-write-size" \
51 "The write size used when downloading a program is 512." \
52 "download limit default"
54 gdb_test "set download-write-size" "Argument required.*"
56 gdb_test "set download-write-size 0" ""
57 gdb_test "show download-write-size" \
58 "The write size used when downloading a program is unlimited." \
59 "set download limit - unlimited"
61 gdb_test "show remote memory-write-packet-size" \
62 "The memory-write-packet-size is 0. Packets are limited to \[0-9\]+ bytes." \
63 "write-packet default"
65 gdb_test "set remote memory-write-packet-size" \
66 "Argument required .integer, `fixed' or `limited'.\." \
67 "set write-packet - NULL"
69 gdb_test "set remote memory-write-packet-size 16" ""
70 gdb_test "show remote memory-write-packet-size" \
71 "The memory-write-packet-size is 16. Packets are limited to 16 bytes." \
72 "set write-packet - small"
74 gdb_test "set remote memory-write-packet-size 1" ""
75 gdb_test "show remote memory-write-packet-size" \
76 "The memory-write-packet-size is 1. Packets are limited to 16 bytes." \
77 "set write-packet - very-small"
80 # Part TWO: Check the download behavour
83 proc gdb_load_timed {executable downloadsize class writesize} {
84 global test gdb_prompt
85 set test "timed download `[file tail $executable]' - $downloadsize, $class, $writesize"
87 if {$writesize != ""} then {
88 gdb_test "set remote memory-write-packet-size $writesize" \
89 "" "$test - set packet size"
92 if {$downloadsize != ""} then {
93 gdb_test "set download-write-size $downloadsize" \
94 "" "$test - set download size"
97 if {$downloadsize != ""} then {
98 send_gdb "set remote memory-write-packet-size $class\n"
100 -re ".*Change the packet size.*$" {
103 -re ".*$gdb_prompt $" {
104 pass "$test - set write size class"
107 fail "$test - set write size class"
112 -re ".*$gdb_prompt $" { }
114 fail "$test - set write size class"
120 set load_begin_time [clock clicks]
121 set result [gdb_load $executable]
122 set load_end_time [clock clicks]
123 if {$result < 0} then { fail "$test - loading executable"; return }
124 verbose "$test - time [expr ($load_end_time - $load_begin_time) / 1000] ms"
130 gdb_load_timed $binfile {} "" {}
132 # Typically about 400 bytes can be downloaded
133 gdb_load_timed $binfile 0 "limit" 399
134 gdb_load_timed $binfile 0 "limit" 401
136 # fall back to the default
137 gdb_load_timed $binfile 0 "limit" 0
139 # Absolute max is 16384
140 gdb_load_timed $binfile 0 "fixed" 0
141 gdb_load_timed $binfile 0 "fixed" 16385