From: Lancelot SIX via Gdb-patches <gdb-patches@sourceware.org>
To: Simon Marchi <simon.marchi@polymtl.ca>,
Andrew Burgess <andrew.burgess@embecosm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Improve gdb_tilde_expand logic
Date: Sat, 9 Jan 2021 01:33:00 +0000 [thread overview]
Message-ID: <8fdb8080-ae0b-70ae-20ab-e84329590bea@lancelotsix.com> (raw)
In-Reply-To: <58a88de1-6c5d-98ec-62d2-860f9ad7a8a8@polymtl.ca>
On 08/01/2021 15:59, Simon Marchi wrote:
> On 2021-01-08 4:30 a.m., Andrew Burgess wrote:
>> There's only very limited unit testing within GDB. You should write a
>> test in gdb/testsuite/.... that triggers this behaviour and check the
>> functionality that way.
> It might be difficult to write a .exp test that specifically targets this
> function... I think a selftest for this could be useful (in addition to
> something in a .exp file, if this ends up used for the index-cache
> directory, as discussed).
>
> The selftest could just call gdb_tilde_expand with
> "~/a/non/existent/directory" and make some simple assertions with the
> result. That selftest could probably be written directly in
> gdbsupport/gdb_tilde_expand.cc. That would be the first time a
> selftest is put in a gdbsupport file, but I don't think that will
> cause a problem. That test will be available in both GDB and GDBserver.
>
> You can check the test for gdb_realpath in gdb/utils.c if you want
> an example.
>
> Simon
The option I have in mind is inspired by gdb.gdb/selftest.exp (if I
understand it correctly): once I have a gdb session debugging gdb, I can
have something like:
gdb_test {print gdb_tilde_expand ("~/most/probably/non/existing").c_str ()} \
{= .*"/.*/most/probably/non/existing"}
or something similar. If I go for something like that, can it be added
directly in selftest.expr (under gdb.gdb) or do it require an entire new
testcase (probably in gdb.base)? It might be an overkill approach to
unit-testing, but it should work.
Lancelot.
next prev parent reply other threads:[~2021-01-09 1:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-08 0:13 Lancelot SIX via Gdb-patches
2021-01-08 9:30 ` Andrew Burgess
2021-01-08 15:59 ` Simon Marchi via Gdb-patches
2021-01-09 1:33 ` Lancelot SIX via Gdb-patches [this message]
2021-01-09 2:17 ` Simon Marchi via Gdb-patches
2021-01-09 18:29 ` [PATCH v2] " Lancelot SIX via Gdb-patches
2021-01-10 23:20 ` Sergio Durigan Junior via Gdb-patches
2021-01-11 0:23 ` Lancelot SIX via Gdb-patches
2021-01-11 1:00 ` [PATCH v3] " Lancelot SIX via Gdb-patches
2021-01-11 17:11 ` Simon Marchi via Gdb-patches
2021-01-11 22:40 ` [PATCH v4] " Lancelot SIX via Gdb-patches
2021-01-11 23:36 ` Simon Marchi via Gdb-patches
2021-01-14 23:04 ` Lancelot SIX via Gdb-patches
2021-01-23 17:40 ` Lancelot SIX via Gdb-patches
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=8fdb8080-ae0b-70ae-20ab-e84329590bea@lancelotsix.com \
--to=gdb-patches@sourceware.org \
--cc=andrew.burgess@embecosm.com \
--cc=lsix@lancelotsix.com \
--cc=simon.marchi@polymtl.ca \
/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