public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/30250] New: [gdb/testsuite] remotedir review
@ 2023-03-20 12:21 vries at gcc dot gnu.org
  2023-03-20 16:06 ` [Bug testsuite/30250] " cvs-commit at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: vries at gcc dot gnu.org @ 2023-03-20 12:21 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30250

            Bug ID: 30250
           Summary: [gdb/testsuite] remotedir review
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: testsuite
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Board variable remotedir is documented as intended for remote target:
...
name       example             description
remotedir  /tmp/runtest.[pid]  Directory on the remote target in which
                               executables are downloaded and executed
...
I didn't spot anything target-specific though in the implementation, so I
wonder if it can also be used for remote host.

Anyway, first looking at the implementation:
....
    if { [board_info $dest exists remotedir] } {
        set remotedir [board_info $dest remotedir]
        set status [remote_exec $dest mkdir "-p $remotedir"]
        if { [lindex $status 0] != 0 } {
            perror "Couldn't create remote directory $remotedir on $dest"
            return ""
        }
        set destfile $remotedir/$destfile
    }
...
it looks odd to me to hardcode "/" as path separator, but perhaps that's
considered ok because it's not enabled by default.  I see something similar for
nfsdir.

Then, the implementation doesn't look complete.

That is, remote_exec and remote_download both take remotedir into account, but
not remote_upload.

So, say we have remotedir=/tmp, and we have an exec ./a.out on build/host, and 
the exec generates ./bla.txt.

A remote_download of a.out to target gives us /tmp/a.out.

Doing a remote_exec of /tmp/a.out gives us /tmp/bla.txt.

Then doing a remote_upload from host of ./bla.txt doesn't work, we need to use
./tmp/bla.txt.

I don't see any reason why remote_upload cannot do the same as remote_download.

Finally, target_compile uses this style remote_upload for host, so if we want
remote host to work with remotedir, we need to fix this.

I'd start out with a local override of remote_upload, then try to upstream the
change.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug testsuite/30250] [gdb/testsuite] remotedir review
  2023-03-20 12:21 [Bug testsuite/30250] New: [gdb/testsuite] remotedir review vries at gcc dot gnu.org
@ 2023-03-20 16:06 ` cvs-commit at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-20 16:06 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30250

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=80d6c79866f16cb2e184ea4952e2ca7f797dee44

commit 80d6c79866f16cb2e184ea4952e2ca7f797dee44
Author: Tom de Vries <tdevries@suse.de>
Date:   Mon Mar 20 17:06:49 2023 +0100

    [gdb/testsuite] Handle remotedir in remote_upload

    Dejagnu's remotedir implementation has support in remote_exec and
    remote_download, but not remote_upload.

    Consider the following scenario:
    - downloading an executable to target,
    - running it,
    - uploading a file produced by the executable
    while assuming remote target user remote-target with homedir
    /home/remote-target and remotedir set to /home/remote-target/tmp.

    Concretely, it looks like this:
    ...
     # binfile == "$outputs/gdb.abc/a.out"
     set target_binfile [remote_download target $binfile]
     # target_binfile == "/home/remote-target/tmp/a.out"
     remote_exec target $target_binfile
     # Running $target_binfile produced /home/remote-target/tmp/result.txt.
     set result [remote_upload target /home/remote-target/tmp/result.txt \
                     $outputs/gdb.abc/result.txt]
     # result == $outputs/gdb.abc/result.txt.
    ...

    Add a remote_upload implementation that also handles remotedir in
lib/gdb.exp,
    overriding dejagnu's remote_upload, such that we can simplify the
    remote_upload call to:
    ...
     set result [remote_upload target result.txt $outputs/gdb.abc/result.txt]
    ...

    Tested on x86_64-linux.

    PR testsuite/30250
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30250

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-20 16:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-20 12:21 [Bug testsuite/30250] New: [gdb/testsuite] remotedir review vries at gcc dot gnu.org
2023-03-20 16:06 ` [Bug testsuite/30250] " cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).