public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Lancelot SIX <lsix@lancelotsix.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] gdb/testsuite: avoid creating files in gdb/testsuite directory
Date: Mon, 03 Oct 2022 17:06:36 +0100	[thread overview]
Message-ID: <87bkqshoxf.fsf@redhat.com> (raw)
In-Reply-To: <20221003111213.rzfci537xl3xbfkw@octopus>

Lancelot SIX <lsix@lancelotsix.com> writes:

> Hi Andrew,
>
> On Sun, Oct 02, 2022 at 03:43:56PM +0100, Andrew Burgess via Gdb-patches wrote:
>> I spotted that the test gdb.dwarf2/dw2-using-debug-str.exp was
>> creating an output file (called debug_str_section) in the root
>> build/gdb/testsuite directory instead of using the
>> build/gdb/testsuite/output/gdb.dwarf2/dw2-using-debug-str/ directory.
>> 
>> This is a result of not using standard_output_file in the test
>> script.
>> 
>> With this commit the file is now placed in the expected output
>> directory.  The test still passes for me.
>> ---
>>  gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp b/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp
>> index d27554f2f89..729961c99b5 100644
>> --- a/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp
>> +++ b/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp
>> @@ -105,7 +105,8 @@ gdb_test "p global_var" " = \\{aa = 0, bb = 0, cc = 0\\}"
>>  # cc-with-dwz-m.exp and cc-with-gnu-debuglink.exp.  Handle this by
>>  # skipping the remainder of the test-case.
>>  set debug_str_section "${binfile}-debug-str"
>> -set args "--dump-section .debug_str=debug_str_section $binfile"
>> +set debug_str_file [standard_output_file "debug_str_section"]
>> +set args "--dump-section .debug_str=${debug_str_file} $binfile"
>
> Just above your change, there is the following line:
>
>   set debug_str_section "${binfile}-debug-str"
>
> I believe that the original intent was to use this as output file name,
> but the '$' was use in the set args line.
>
> It looks to me that the change should be:
>
>   -set args "--dump-section .debug_str=debug_str_section $binfile"
>   +set args "--dump-section .debug_str=$debug_str_section $binfile"
>
> If you prefer your change, the `set debug_str_section` line should be
> removed.

Good spot.

Updated patch below.

Thanks,
Andrew

---

commit 8e855f184d30f17a7bd0638f6cb8ee211be789e2
Author: Andrew Burgess <aburgess@redhat.com>
Date:   Sun Oct 2 15:18:15 2022 +0100

    gdb/testsuite: avoid creating files in gdb/testsuite directory
    
    I spotted that the test gdb.dwarf2/dw2-using-debug-str.exp was
    creating an output file called debug_str_section in the root
    build/gdb/testsuite directory instead of using the
    build/gdb/testsuite/output/gdb.dwarf2/dw2-using-debug-str/ directory.
    
    This appears to be caused by a missing '$' character.  We setup a
    variable debug_str_section which contains a path within the output
    directory, but then when we build the objcopy command we use
    'debug_str_section' without a '$' prefix, as a result, we create the
    debug_str_section file.
    
    This commit adds the missing '$', the file is now created in the
    output directory.

diff --git a/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp b/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp
index d27554f2f89..4d1c49044d5 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp
@@ -105,7 +105,7 @@ gdb_test "p global_var" " = \\{aa = 0, bb = 0, cc = 0\\}"
 # cc-with-dwz-m.exp and cc-with-gnu-debuglink.exp.  Handle this by
 # skipping the remainder of the test-case.
 set debug_str_section "${binfile}-debug-str"
-set args "--dump-section .debug_str=debug_str_section $binfile"
+set args "--dump-section .debug_str=${debug_str_section} $binfile"
 set result [remote_exec host "[gdb_find_objcopy] $args"]
 set status [lindex $result 0]
 set output [lindex $result 1]


  reply	other threads:[~2022-10-03 16:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-02 14:43 [PATCH 0/2] Cleanup testsuite temporary files Andrew Burgess
2022-10-02 14:43 ` [PATCH 1/2] gdb/testsuite: avoid creating files in gdb/testsuite directory Andrew Burgess
2022-10-03 11:12   ` Lancelot SIX
2022-10-03 16:06     ` Andrew Burgess [this message]
2022-10-03 18:51       ` Pedro Alves
2022-10-04  8:55         ` Andrew Burgess
2022-10-04  9:08         ` Andrew Burgess
2022-10-04 12:15           ` Pedro Alves
2022-10-02 14:43 ` [PATCH 2/2] gdb/testsuite: avoid temporary file in gdb/testsuite Andrew Burgess
2022-10-04 14:20 ` [PATCHv2 0/2] Cleanup testsuite temporary files Andrew Burgess
2022-10-04 14:20   ` [PATCHv2 1/2] gdb/testsuite: avoid creating files in gdb/testsuite directory Andrew Burgess
2022-10-04 14:20   ` [PATCHv2 2/2] gdb/testsuite: avoid temporary file in gdb/testsuite (unittest.exp) Andrew Burgess
2022-10-14 16:28   ` [PATCHv2 0/2] Cleanup testsuite temporary files Tom Tromey
2022-10-19 11:20     ` Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bkqshoxf.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lsix@lancelotsix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).