]>
Commit | Line | Data |
---|---|---|
a6b151f1 | 1 | # This testcase is part of GDB, the GNU debugger. |
8acc9f48 | 2 | # Copyright 2007-2013 Free Software Foundation, Inc. |
a6b151f1 DJ |
3 | |
4 | # This program is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
6 | # the Free Software Foundation; either version 3 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | ||
17 | # Test gdbserver monitor commands. | |
18 | ||
19 | load_lib gdbserver-support.exp | |
20 | ||
b0963d73 | 21 | standard_testfile server.c |
a6b151f1 DJ |
22 | |
23 | if { [skip_gdbserver_tests] } { | |
24 | return 0 | |
25 | } | |
26 | ||
b0963d73 | 27 | if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} { |
a6b151f1 DJ |
28 | return -1 |
29 | } | |
30 | ||
a1999d40 PA |
31 | # Make sure we're disconnected, in case we're testing with an |
32 | # extended-remote board, therefore already connected. | |
33 | gdb_test "disconnect" ".*" | |
34 | ||
a6b151f1 DJ |
35 | gdbserver_run "" |
36 | ||
37 | proc test_file_transfer { filename description } { | |
38 | gdb_test "remote put \"$filename\" down-server" \ | |
39 | "Successfully sent .*" "put $description" | |
40 | gdb_test "remote get down-server up-server" \ | |
41 | "Successfully fetched .*" "get $description" | |
42 | ||
43 | if { ![is_remote target] } { | |
44 | # If we can check the target copy of the file, do that too. | |
45 | # This should catch symmetric errors in upload and download. | |
46 | set result [remote_exec host "cmp -s $filename down-server"] | |
47 | if { [lindex $result 0] == 0 } { | |
48 | pass "compare intermediate $description" | |
49 | } else { | |
50 | fail "compare intermediate $description" | |
51 | } | |
52 | } | |
53 | ||
54 | set result [remote_exec host "cmp -s $filename up-server"] | |
55 | if { [lindex $result 0] == 0 } { | |
56 | pass "compare $description" | |
57 | } else { | |
58 | fail "compare $description" | |
59 | } | |
60 | ||
61 | gdb_test "remote delete down-server" \ | |
62 | "Successfully deleted .*" "deleted $description" | |
63 | ||
64 | if { ![is_remote target] } { | |
65 | if { ! [remote_file target exists down-server] } { | |
66 | pass "verified deleted $description" | |
67 | } else { | |
68 | fail "verified deleted $description" | |
69 | } | |
70 | } | |
71 | ||
72 | catch { file delete up-server } | |
73 | } | |
74 | ||
75 | test_file_transfer "$binfile" "binary file" | |
76 | test_file_transfer "$srcdir/$subdir/transfer.txt" "text file" |