OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.mi/] [mi-file-transfer.exp] - Blame information for rev 840

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
# This testcase is part of GDB, the GNU debugger.
2
# Copyright 2007, 2008 Free Software Foundation, Inc.
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 .
16
 
17
# Test gdbserver monitor commands.
18
 
19
load_lib gdbserver-support.exp
20
load_lib mi-support.exp
21
set MIFLAGS "-i=mi"
22
 
23
if { [skip_gdbserver_tests] } {
24
    return 0
25
}
26
 
27
set testfile "basics"
28
set srcfile ${testfile}.c
29
set binfile ${objdir}/${subdir}/${testfile}
30
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
31
    untested mi-file-transfer.exp
32
    return -1
33
}
34
 
35
gdb_exit
36
if [mi_gdb_start] {
37
    continue
38
}
39
mi_delete_breakpoints
40
mi_gdb_reinitialize_dir $srcdir/$subdir
41
mi_gdb_file_cmd ${binfile}
42
 
43
proc mi_gdbserver_run { } {
44
    mi_gdb_test "kill" ".*" ""
45
 
46
    set res [gdbserver_spawn ""]
47
    set protocol [lindex $res 0]
48
    set gdbport [lindex $res 1]
49
 
50
    if { [mi_gdb_target_cmd $protocol $gdbport] != 0 } {
51
        return -1
52
    }
53
 
54
    return 0
55
}
56
 
57
proc test_file_transfer { filename description } {
58
    mi_gdb_test "-target-file-put \"$filename\" \"down-server\"" \
59
        "\\^done" "put $description"
60
    mi_gdb_test "-target-file-get \"down-server\" \"up-server\"" \
61
        "\\^done" "get $description"
62
 
63
    if { ![is_remote target] } {
64
        # If we can check the target copy of the file, do that too.
65
        # This should catch symmetric errors in upload and download.
66
        set result [remote_exec host "cmp -s $filename down-server"]
67
        if { [lindex $result 0] == 0 } {
68
            pass "compare intermediate $description"
69
        } else {
70
            fail "compare intermediate $description"
71
        }
72
    }
73
 
74
    set result [remote_exec host "cmp -s $filename up-server"]
75
    if { [lindex $result 0] == 0 } {
76
        pass "compare $description"
77
    } else {
78
        fail "compare $description"
79
    }
80
 
81
    mi_gdb_test "-target-file-delete \"down-server\"" \
82
        "\\^done" "deleted $description"
83
 
84
    if { ![is_remote target] } {
85
        if { ! [remote_file target exists down-server] } {
86
            pass "verified deleted $description"
87
        } else {
88
            fail "verified deleted $description"
89
        }
90
    }
91
 
92
    catch { file delete up-server }
93
}
94
 
95
mi_gdbserver_run
96
 
97
test_file_transfer "$binfile" "binary file"
98
 
99
mi_gdb_exit

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.