public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] [docs] Explain how to use multiple file-name patterns in RUNTESTFLAGS
@ 2017-08-22  5:10 Daniel Santos
  2017-08-22 16:32 ` Martin Sebor
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel Santos @ 2017-08-22  5:10 UTC (permalink / raw)
  To: gcc-patches, Sandra Loosemore, Gerald Pfeifer, Joseph Myers,
	Rainer Orth, Mike Stump

It took me a while to figure out how to do this so I figured that it should be
in the docs.  OK for trunk?

	* doc/install.texi: Add more details on selecting multiple tests.

Thanks,
Daniel

Signed-off-by: Daniel Santos <daniel.santos@pobox.com>
---
 gcc/doc/install.texi | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 7c9e2f25d44..6aefd213901 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -2737,6 +2737,16 @@ the testsuite with filenames matching @samp{9805*}, you would use
 make check-g++ RUNTESTFLAGS="old-deja.exp=9805* @var{other-options}"
 @end smallexample
 
+The file-matching expression following @var{filename}@command{.exp=} is treated
+as a series of whitespace-delimited glob expressions so that multiple patterns
+may be passed, although any whitespace must either be escaped or surrounded by
+tick marks if multiple expressions are desired. For example,
+
+@smallexample
+make check-g++ RUNTESTFLAGS="old-deja.exp=9805*\ virtual2.c @var{other-options}"
+make check-g++ RUNTESTFLAGS="'old-deja.exp=9805* virtual2.c' @var{other-options}"
+@end smallexample
+
 The @file{*.exp} files are located in the testsuite directories of the GCC
 source, the most important ones being @file{compile.exp},
 @file{execute.exp}, @file{dg.exp} and @file{old-deja.exp}.
-- 
2.13.3

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

* Re: [PATCH] [docs] Explain how to use multiple file-name patterns in RUNTESTFLAGS
  2017-08-22  5:10 [PATCH] [docs] Explain how to use multiple file-name patterns in RUNTESTFLAGS Daniel Santos
@ 2017-08-22 16:32 ` Martin Sebor
  2017-08-22 17:32   ` Mike Stump
                     ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Martin Sebor @ 2017-08-22 16:32 UTC (permalink / raw)
  To: Daniel Santos, gcc-patches, Sandra Loosemore, Gerald Pfeifer,
	Joseph Myers, Rainer Orth, Mike Stump

On 08/21/2017 07:41 PM, Daniel Santos wrote:
> It took me a while to figure out how to do this so I figured that it should be
> in the docs.  OK for trunk?
>
> 	* doc/install.texi: Add more details on selecting multiple tests.

Thank you!  It had taken me some time to figure this out.

> +The file-matching expression following @var{filename}@command{.exp=} is treated
> +as a series of whitespace-delimited glob expressions so that multiple patterns
> +may be passed, although any whitespace must either be escaped or surrounded by
> +tick marks if multiple expressions are desired. For example,

Do you mean single quotes?  I would suggest "escaped or quoted."
The whole argument to RUNTESTFLAGS can be quoted in either single
or double quotes and, AFAICT, so can the space-separated test
names within it.

Martin

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

* Re: [PATCH] [docs] Explain how to use multiple file-name patterns in RUNTESTFLAGS
  2017-08-22 16:32 ` Martin Sebor
@ 2017-08-22 17:32   ` Mike Stump
  2017-08-22 17:38   ` Mike Stump
  2017-08-22 17:49   ` Daniel Santos
  2 siblings, 0 replies; 12+ messages in thread
From: Mike Stump @ 2017-08-22 17:32 UTC (permalink / raw)
  To: Martin Sebor
  Cc: Daniel Santos, gcc-patches, Sandra Loosemore, Gerald Pfeifer,
	Joseph Myers, Rainer Orth


> On Aug 22, 2017, at 8:58 AM, Martin Sebor <msebor@gmail.com> wrote:
> 
> On 08/21/2017 07:41 PM, Daniel Santos wrote:
>> It took me a while to figure out how to do this so I figured that it should be
>> in the docs.  OK for trunk?
>> 
>> 	* doc/install.texi: Add more details on selecting multiple tests.
> 
> Thank you!  It had taken me some time to figure this out.
> 
>> +The file-matching expression following @var{filename}@command{.exp=} is treated
>> +as a series of whitespace-delimited glob expressions so that multiple patterns
>> +may be passed, although any whitespace must either be escaped or surrounded by
>> +tick marks if multiple expressions are desired. For example,

> Do you mean single quotes?  I would suggest "escaped or quoted."


Yes, I agree.  Please, no tick, slightly too informal.

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

* Re: [PATCH] [docs] Explain how to use multiple file-name patterns in RUNTESTFLAGS
  2017-08-22 16:32 ` Martin Sebor
  2017-08-22 17:32   ` Mike Stump
@ 2017-08-22 17:38   ` Mike Stump
  2017-08-22 18:18     ` Daniel Santos
  2017-08-22 17:49   ` Daniel Santos
  2 siblings, 1 reply; 12+ messages in thread
From: Mike Stump @ 2017-08-22 17:38 UTC (permalink / raw)
  To: Martin Sebor
  Cc: Daniel Santos, gcc-patches, Sandra Loosemore, Gerald Pfeifer,
	Joseph Myers, Rainer Orth

On Aug 22, 2017, at 8:58 AM, Martin Sebor <msebor@gmail.com> wrote:
> 
> On 08/21/2017 07:41 PM, Daniel Santos wrote:
>> It took me a while to figure out how to do this so I figured that it should be
>> in the docs.  OK for trunk?

Oh, yeah, with the correction mentioned, Ok.

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

* Re: [PATCH] [docs] Explain how to use multiple file-name patterns in RUNTESTFLAGS
  2017-08-22 16:32 ` Martin Sebor
  2017-08-22 17:32   ` Mike Stump
  2017-08-22 17:38   ` Mike Stump
@ 2017-08-22 17:49   ` Daniel Santos
  2017-08-22 18:05     ` Mike Stump
  2 siblings, 1 reply; 12+ messages in thread
From: Daniel Santos @ 2017-08-22 17:49 UTC (permalink / raw)
  To: Martin Sebor, gcc-patches, Sandra Loosemore, Gerald Pfeifer,
	Joseph Myers, Rainer Orth, Mike Stump

On 08/22/2017 10:58 AM, Martin Sebor wrote:
> On 08/21/2017 07:41 PM, Daniel Santos wrote:
>> It took me a while to figure out how to do this so I figured that it
>> should be
>> in the docs.  OK for trunk?
>>
>>     * doc/install.texi: Add more details on selecting multiple tests.
>
> Thank you!  It had taken me some time to figure this out.
>
>> +The file-matching expression following @var{filename}@command{.exp=}
>> is treated
>> +as a series of whitespace-delimited glob expressions so that
>> multiple patterns
>> +may be passed, although any whitespace must either be escaped or
>> surrounded by
>> +tick marks if multiple expressions are desired. For example,
>
> Do you mean single quotes?

Yes.  I guess I've heard the terms "tick marks" and "single quotes" used
before.  Perhaps using 'single quotes' would be a good way to express it
(with the quotes).

>   I would suggest "escaped or quoted."
> The whole argument to RUNTESTFLAGS can be quoted in either single
> or double quotes and, AFAICT, so can the space-separated test
> names within it.

Well, mysteriously, double quotes do not work.  So if I pass
RUNTESTFLAGS='"i386.exp=pr80969-[12]*.c pr80969-4.c"' then the second
pattern isn't used.  I have NO idea what happens to it because it I pass
RUNTESTFLAGS='i386.exp=pr80969-[12]*.c pr80969-4.c' then runtest
properly demands that I tell it what in the hell pr80969-4.c is supposed
to mean.  As an experiment, I created a symlink named \"pr80969-4.c and
using RUNTESTFLAGS='"i386.exp=pr80969-[12]*.c "pr80969-4.c' but it
didn't pick it up.  This is probably JAB (just another bug) in DejaGNU.

Among the variations I've tried are enclosing the expressions in
{braces},  \{escaped braces\} and comma-delimited \{escaped,braces\},
but none of these worked.

Daniel

> Martin
>

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

* Re: [PATCH] [docs] Explain how to use multiple file-name patterns in RUNTESTFLAGS
  2017-08-22 17:49   ` Daniel Santos
@ 2017-08-22 18:05     ` Mike Stump
  2017-08-22 19:38       ` Daniel Santos
                         ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Mike Stump @ 2017-08-22 18:05 UTC (permalink / raw)
  To: Daniel Santos
  Cc: Martin Sebor, gcc-patches, Sandra Loosemore, Gerald Pfeifer,
	Joseph Myers, Rainer Orth

On Aug 22, 2017, at 10:32 AM, Daniel Santos <daniel.santos@pobox.com> wrote:
> 
>>  I would suggest "escaped or quoted."
>> The whole argument to RUNTESTFLAGS can be quoted in either single
>> or double quotes and, AFAICT, so can the space-separated test
>> names within it.
> 
> Well, mysteriously, double quotes do not work.

Did you try the obvious:

"\"pdf pdf\" pdf"

?  I think it should work fine.

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

* [PATCH] [docs] Explain how to use multiple file-name patterns in RUNTESTFLAGS
  2017-08-22 17:38   ` Mike Stump
@ 2017-08-22 18:18     ` Daniel Santos
  2017-08-22 19:03       ` Mike Stump
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel Santos @ 2017-08-22 18:18 UTC (permalink / raw)
  To: gcc-patches, Mike Stump, Martin Sebor
  Cc: Rainer Orth, Sandra Loosemore, Gerald Pfeifer, Joseph Myers

OK, how's this one?

	* doc/install.texi: Modify to add more details on running
	selected tests.

Thanks,
Daniel

Signed-off-by: Daniel Santos <daniel.santos@pobox.com>
---
 gcc/doc/install.texi | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 7c9e2f25d44..da360da1c50 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -2737,6 +2737,16 @@ the testsuite with filenames matching @samp{9805*}, you would use
 make check-g++ RUNTESTFLAGS="old-deja.exp=9805* @var{other-options}"
 @end smallexample
 
+The file-matching expression following @var{filename}@command{.exp=} is treated
+as a series of whitespace-delimited glob expressions so that multiple patterns
+may be passed, although any whitespace must either be escaped or surrounded by
+single quotes if multiple expressions are desired. For example,
+
+@smallexample
+make check-g++ RUNTESTFLAGS="old-deja.exp=9805*\ virtual2.c @var{other-options}"
+make check-g++ RUNTESTFLAGS="'old-deja.exp=9805* virtual2.c' @var{other-options}"
+@end smallexample
+
 The @file{*.exp} files are located in the testsuite directories of the GCC
 source, the most important ones being @file{compile.exp},
 @file{execute.exp}, @file{dg.exp} and @file{old-deja.exp}.
-- 
2.13.3

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

* Re: [PATCH] [docs] Explain how to use multiple file-name patterns in RUNTESTFLAGS
  2017-08-22 18:18     ` Daniel Santos
@ 2017-08-22 19:03       ` Mike Stump
  0 siblings, 0 replies; 12+ messages in thread
From: Mike Stump @ 2017-08-22 19:03 UTC (permalink / raw)
  To: Daniel Santos
  Cc: gcc-patches, Martin Sebor, Rainer Orth, Sandra Loosemore,
	Gerald Pfeifer, Joseph Myers

On Aug 22, 2017, at 10:44 AM, Daniel Santos <daniel.santos@pobox.com> wrote:
> 
> OK, how's this one?

Ok.

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

* Re: [PATCH] [docs] Explain how to use multiple file-name patterns in RUNTESTFLAGS
  2017-08-22 18:05     ` Mike Stump
@ 2017-08-22 19:38       ` Daniel Santos
  2017-08-22 19:42       ` Daniel Santos
  2017-08-22 20:01       ` Daniel Santos
  2 siblings, 0 replies; 12+ messages in thread
From: Daniel Santos @ 2017-08-22 19:38 UTC (permalink / raw)
  To: Mike Stump
  Cc: Martin Sebor, gcc-patches, Sandra Loosemore, Gerald Pfeifer,
	Joseph Myers, Rainer Orth

On 08/22/2017 12:32 PM, Mike Stump wrote:
> On Aug 22, 2017, at 10:32 AM, Daniel Santos <daniel.santos@pobox.com> wrote:
>>>  I would suggest "escaped or quoted."
>>> The whole argument to RUNTESTFLAGS can be quoted in either single
>>> or double quotes and, AFAICT, so can the space-separated test
>>> names within it.
>> Well, mysteriously, double quotes do not work.
> Did you try the obvious:
>
> "\"pdf pdf\" pdf"
>
> ?  I think it should work fine.

Yes.  As I explained in the rest of my email I tried a great many
variations.  I can debug runtest some more and try to better understand
how this is getting parsed.

Daniel

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

* Re: [PATCH] [docs] Explain how to use multiple file-name patterns in RUNTESTFLAGS
  2017-08-22 18:05     ` Mike Stump
  2017-08-22 19:38       ` Daniel Santos
@ 2017-08-22 19:42       ` Daniel Santos
  2017-08-22 20:01       ` Daniel Santos
  2 siblings, 0 replies; 12+ messages in thread
From: Daniel Santos @ 2017-08-22 19:42 UTC (permalink / raw)
  To: Mike Stump
  Cc: Martin Sebor, gcc-patches, Sandra Loosemore, Gerald Pfeifer,
	Joseph Myers, Rainer Orth

On 08/22/2017 12:32 PM, Mike Stump wrote:
> On Aug 22, 2017, at 10:32 AM, Daniel Santos <daniel.santos@pobox.com> wrote:
>>>  I would suggest "escaped or quoted."
>>> The whole argument to RUNTESTFLAGS can be quoted in either single
>>> or double quotes and, AFAICT, so can the space-separated test
>>> names within it.
>> Well, mysteriously, double quotes do not work.
> Did you try the obvious:
>
> "\"pdf pdf\" pdf"
>
> ?  I think it should work fine.

I have found one additional working mechanism:

RUNTESTFLAGS='i386.exp=\"pr80969-[12]*.c pr80969-4.c\"'

But using double quotes for both does NOT work:

RUNTESTFLAGS="i386.exp=\"pr80969-[12]*.c pr80969-4.c\""

So the three working options appears to be:
1. Escaping whitespace
2. Using double quotes for the whole value and single quotes for the
file.exp=patterns expression
3. Using single quotes for the whole value and double quotes for the
file.exp=patterns expression

Daniel

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

* Re: [PATCH] [docs] Explain how to use multiple file-name patterns in RUNTESTFLAGS
  2017-08-22 18:05     ` Mike Stump
  2017-08-22 19:38       ` Daniel Santos
  2017-08-22 19:42       ` Daniel Santos
@ 2017-08-22 20:01       ` Daniel Santos
  2017-08-22 21:21         ` Mike Stump
  2 siblings, 1 reply; 12+ messages in thread
From: Daniel Santos @ 2017-08-22 20:01 UTC (permalink / raw)
  To: Mike Stump
  Cc: Martin Sebor, gcc-patches, Sandra Loosemore, Gerald Pfeifer,
	Joseph Myers, Rainer Orth

OK, the problem is at line 4014 of gcc/Makefile.in:

          $(MAKE) TESTSUITEDIR="$(TESTSUITEDIR)"
RUNTESTFLAGS="$(RUNTESTFLAGS)" \
            check-parallel-$* \
 
Even worse, one can inject arbitrary shell commands here, not that I can
think of a scenario where it would be an actual security problem:

RUNTESTFLAGS="i386.exp=a b\"; beep\"" check-c

I presume that the solution would be to re-escape the contents of
RUNTESTFLAGS.

Daniel

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

* Re: [PATCH] [docs] Explain how to use multiple file-name patterns in RUNTESTFLAGS
  2017-08-22 20:01       ` Daniel Santos
@ 2017-08-22 21:21         ` Mike Stump
  0 siblings, 0 replies; 12+ messages in thread
From: Mike Stump @ 2017-08-22 21:21 UTC (permalink / raw)
  To: Daniel Santos
  Cc: Martin Sebor, gcc-patches, Sandra Loosemore, Gerald Pfeifer,
	Joseph Myers, Rainer Orth

On Aug 22, 2017, at 11:53 AM, Daniel Santos <daniel.santos@pobox.com> wrote:
> 
> OK, the problem is at line 4014 of gcc/Makefile.in:
> 
>          $(MAKE) TESTSUITEDIR="$(TESTSUITEDIR)"
> RUNTESTFLAGS="$(RUNTESTFLAGS)" \
>            check-parallel-$* \

So, this is typical of sh scripting.  Most kids don't quote and know how to quote in other than trivial cases.  It is one of the reasons why scripting is both better and worse.  sh from day 1 should have had a quote function that would quote the operand, it doesn't.  If it did, we'd put $(quote ...) in there instead of "..." and it would just work.

> I presume that the solution would be to re-escape the contents of
> RUNTESTFLAGS.

Yes.  The annoyance factor is so high, that no one ever does.  Feel free rot ignore the problem.

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

end of thread, other threads:[~2017-08-22 19:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-22  5:10 [PATCH] [docs] Explain how to use multiple file-name patterns in RUNTESTFLAGS Daniel Santos
2017-08-22 16:32 ` Martin Sebor
2017-08-22 17:32   ` Mike Stump
2017-08-22 17:38   ` Mike Stump
2017-08-22 18:18     ` Daniel Santos
2017-08-22 19:03       ` Mike Stump
2017-08-22 17:49   ` Daniel Santos
2017-08-22 18:05     ` Mike Stump
2017-08-22 19:38       ` Daniel Santos
2017-08-22 19:42       ` Daniel Santos
2017-08-22 20:01       ` Daniel Santos
2017-08-22 21:21         ` Mike Stump

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).