Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA/testsuite] New testcase for set/unset/show substitute-path
@ 2006-08-08 23:00 Joel Brobecker
  2006-10-04 21:46 ` Joel Brobecker
  2006-10-05 19:49 ` Daniel Jacobowitz
  0 siblings, 2 replies; 6+ messages in thread
From: Joel Brobecker @ 2006-08-08 23:00 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 490 bytes --]

Hello,

Here is a first try at implementing a testcase for the new
substitute-path commands. I'm only testing the manipulation
of the list of substitution rules at this point, because I still
don't see how to implement something that would test the actual
substitution and work in all cases. I figured this is better than
nothing for now.

2006-08-08  Joel Brobecker  <brobecker@adacore.com>

        * gdb.base/subst.exp: New testcase.

Tested on x86-linux. OK to apply?

Thanks,
-- 
Joel

[-- Attachment #2: subst.exp --]
[-- Type: text/plain, Size: 5444 bytes --]

# Copyright 2006 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA

if $tracelevel {
    strace $tracelevel
}

gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir

# Do a bunch of testing of the set/unset/show substitute-path
# commands that do not require the presence of an executable.

gdb_test "set confirm off" \
         "" \
         "deactivate GDB's confirmation interface"

gdb_test "show substitute-path" \
         "List of all source path substitution rules:" \
         "show substitute-path, no rule entered yet"

gdb_test "show substitute-path from" \
         "Source path substitution rule matching `from':" \
         "show substitute-path from, no rule entered yet"

gdb_test "show substitute-path too many" \
         "Too many arguments in command" \
         "show substitute-path, too many arguments"

gdb_test "unset substitute-path from" \
         "No substitution rule defined for `from'" \
         "unset substitute-path from, no rule entered yet"

gdb_test "unset substitute-path" \
         "" \
         "unset substitute-path, no rule entered yet"

gdb_test "unset substitute-path from" \
         "No substitution rule defined for `from'" \
         "unset substitute-path from, no rule entered yet"

gdb_test "unset substitute-path from to" \
         "Incorrect usage, too many arguments in command" \
         "unset substitute-path, too many arguments"

gdb_test "set substitute-path too many arguments" \
         "Incorrect usage, too many arguments in command" \
         "set substitute-path, too many arguments"

gdb_test "set substitute-path missing" \
         "Incorrect usage, too few arguments in command" \
         "set substitute-path, too few arguments"

gdb_test "set substitute-path '' to" \
         "First argument must be at least one character long" \
         "set substitute-path, first argument is empty string"

gdb_test "set substitute-path from to" \
         "" \
         "add from -> to substitution rule"

gdb_test "set substitute-path from1 to1/" \
         "" \
         "add from1 -> to1 substitution rule"

gdb_test "set substitute-path source destination" \
         "" \
         "add source -> destination substitution rule"

gdb_test "set substitute-path depuis/ vers" \
         "" \
         "add depuis -> vers substitution rule"

gdb_test "set substitute-path empty ''" \
         "" \
         "add substitution rule to empty string"

gdb_test "show substitute-path" \
         "List of all source path substitution rules:\r\n +`from' -> `to'.\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'.\r\n\ +`depuis' -> `vers'.\r\n +`empty' -> `'." \
         "show substitute-path after all paths added"

gdb_test "show substitute-path from" \
         "Source path substitution rule matching `from':\r\n +`from' -> `to'." \
         "show substitute-path from, after all paths added"

gdb_test "show substitute-path depuis" \
         "Source path substitution rule matching `depuis':\r\n +`depuis' -> `vers'." \
         "show substitute-path depuis, after all paths added"

gdb_test "show substitute-path garbage" \
         "Source path substitution rule matching `garbage':" \
         "show substitute-path garbage, after all paths added"

gdb_test "unset substitute-path from" \
         "" \
         "unset substitute-path from"

gdb_test "show substitute-path from" \
         "Source path substitution rule matching `from':" \
         ""

gdb_test "show substitute-path" \
         "List of all source path substitution rules:\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'.\r\n\ +`depuis' -> `vers'.\r\n +`empty' -> `'." \
         "show substitute-path after from rule removed"

gdb_test "unset substitute-path from" \
         "No substitution rule defined for `from'" \
         "unset substitute-path from after the rule was removed"

gdb_test "unset substitute-path depuis" \
         "" \
         "unset substitute-path depuis (middle of list)"

gdb_test "show substitute-path" \
         "List of all source path substitution rules:\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'.\r\n\ +`empty' -> `'." \
         "show substitute-path after depuis rule removed"

gdb_test "unset substitute-path empty" \
         "" \
         "unset substitute-path empty (end of list)"

gdb_test "show substitute-path" \
         "List of all source path substitution rules:\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'." \
         "show substitute-path after empty rule removed"

gdb_test "unset substitute-path" \
         "" \
         "remove all remaining substitution rules"

gdb_test "show substitute-path" \
         "List of all source path substitution rules:" \
         "show substitute-path after all remaining rules removed"



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

* Re: [RFA/testsuite] New testcase for set/unset/show substitute-path
  2006-08-08 23:00 [RFA/testsuite] New testcase for set/unset/show substitute-path Joel Brobecker
@ 2006-10-04 21:46 ` Joel Brobecker
  2006-10-05 19:37   ` Mark Kettenis
  2006-10-05 19:49 ` Daniel Jacobowitz
  1 sibling, 1 reply; 6+ messages in thread
From: Joel Brobecker @ 2006-10-04 21:46 UTC (permalink / raw)
  To: gdb-patches

Hello

I never received any feedback for this new testcase.
Would it be OK?

> Here is a first try at implementing a testcase for the new
> substitute-path commands. I'm only testing the manipulation
> of the list of substitution rules at this point, because I still
> don't see how to implement something that would test the actual
> substitution and work in all cases. I figured this is better than
> nothing for now.
> 
> 2006-08-08  Joel Brobecker  <brobecker@adacore.com>
> 
>         * gdb.base/subst.exp: New testcase.
> 
> Tested on x86-linux. OK to apply?
> 
> Thanks,
> -- 
> Joel

> # Copyright 2006 Free Software Foundation, Inc.
> 
> # This program is free software; you can redistribute it and/or modify
> # it under the terms of the GNU General Public License as published by
> # the Free Software Foundation; either version 2 of the License, or
> # (at your option) any later version.
> #
> # This program is distributed in the hope that it will be useful,
> # but WITHOUT ANY WARRANTY; without even the implied warranty of
> # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> # GNU General Public License for more details.
> #
> # You should have received a copy of the GNU General Public License
> # along with this program; if not, write to the Free Software
> # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
> # MA 02110-1301, USA
> 
> if $tracelevel {
>     strace $tracelevel
> }
> 
> gdb_exit
> gdb_start
> gdb_reinitialize_dir $srcdir/$subdir
> 
> # Do a bunch of testing of the set/unset/show substitute-path
> # commands that do not require the presence of an executable.
> 
> gdb_test "set confirm off" \
>          "" \
>          "deactivate GDB's confirmation interface"
> 
> gdb_test "show substitute-path" \
>          "List of all source path substitution rules:" \
>          "show substitute-path, no rule entered yet"
> 
> gdb_test "show substitute-path from" \
>          "Source path substitution rule matching `from':" \
>          "show substitute-path from, no rule entered yet"
> 
> gdb_test "show substitute-path too many" \
>          "Too many arguments in command" \
>          "show substitute-path, too many arguments"
> 
> gdb_test "unset substitute-path from" \
>          "No substitution rule defined for `from'" \
>          "unset substitute-path from, no rule entered yet"
> 
> gdb_test "unset substitute-path" \
>          "" \
>          "unset substitute-path, no rule entered yet"
> 
> gdb_test "unset substitute-path from" \
>          "No substitution rule defined for `from'" \
>          "unset substitute-path from, no rule entered yet"
> 
> gdb_test "unset substitute-path from to" \
>          "Incorrect usage, too many arguments in command" \
>          "unset substitute-path, too many arguments"
> 
> gdb_test "set substitute-path too many arguments" \
>          "Incorrect usage, too many arguments in command" \
>          "set substitute-path, too many arguments"
> 
> gdb_test "set substitute-path missing" \
>          "Incorrect usage, too few arguments in command" \
>          "set substitute-path, too few arguments"
> 
> gdb_test "set substitute-path '' to" \
>          "First argument must be at least one character long" \
>          "set substitute-path, first argument is empty string"
> 
> gdb_test "set substitute-path from to" \
>          "" \
>          "add from -> to substitution rule"
> 
> gdb_test "set substitute-path from1 to1/" \
>          "" \
>          "add from1 -> to1 substitution rule"
> 
> gdb_test "set substitute-path source destination" \
>          "" \
>          "add source -> destination substitution rule"
> 
> gdb_test "set substitute-path depuis/ vers" \
>          "" \
>          "add depuis -> vers substitution rule"
> 
> gdb_test "set substitute-path empty ''" \
>          "" \
>          "add substitution rule to empty string"
> 
> gdb_test "show substitute-path" \
>          "List of all source path substitution rules:\r\n +`from' -> `to'.\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'.\r\n\ +`depuis' -> `vers'.\r\n +`empty' -> `'." \
>          "show substitute-path after all paths added"
> 
> gdb_test "show substitute-path from" \
>          "Source path substitution rule matching `from':\r\n +`from' -> `to'." \
>          "show substitute-path from, after all paths added"
> 
> gdb_test "show substitute-path depuis" \
>          "Source path substitution rule matching `depuis':\r\n +`depuis' -> `vers'." \
>          "show substitute-path depuis, after all paths added"
> 
> gdb_test "show substitute-path garbage" \
>          "Source path substitution rule matching `garbage':" \
>          "show substitute-path garbage, after all paths added"
> 
> gdb_test "unset substitute-path from" \
>          "" \
>          "unset substitute-path from"
> 
> gdb_test "show substitute-path from" \
>          "Source path substitution rule matching `from':" \
>          ""
> 
> gdb_test "show substitute-path" \
>          "List of all source path substitution rules:\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'.\r\n\ +`depuis' -> `vers'.\r\n +`empty' -> `'." \
>          "show substitute-path after from rule removed"
> 
> gdb_test "unset substitute-path from" \
>          "No substitution rule defined for `from'" \
>          "unset substitute-path from after the rule was removed"
> 
> gdb_test "unset substitute-path depuis" \
>          "" \
>          "unset substitute-path depuis (middle of list)"
> 
> gdb_test "show substitute-path" \
>          "List of all source path substitution rules:\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'.\r\n\ +`empty' -> `'." \
>          "show substitute-path after depuis rule removed"
> 
> gdb_test "unset substitute-path empty" \
>          "" \
>          "unset substitute-path empty (end of list)"
> 
> gdb_test "show substitute-path" \
>          "List of all source path substitution rules:\r\n +`from1' -> `to1'.\r\n +`source' -> `destination'." \
>          "show substitute-path after empty rule removed"
> 
> gdb_test "unset substitute-path" \
>          "" \
>          "remove all remaining substitution rules"
> 
> gdb_test "show substitute-path" \
>          "List of all source path substitution rules:" \
>          "show substitute-path after all remaining rules removed"
> 
> 


-- 
Joel


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

* Re: [RFA/testsuite] New testcase for set/unset/show substitute-path
  2006-10-04 21:46 ` Joel Brobecker
@ 2006-10-05 19:37   ` Mark Kettenis
  2006-10-06 18:20     ` Joel Brobecker
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Kettenis @ 2006-10-05 19:37 UTC (permalink / raw)
  To: brobecker; +Cc: gdb-patches

> Date: Wed, 4 Oct 2006 14:46:26 -0700
> From: Joel Brobecker <brobecker@adacore.com>
> 
> Hello
> 
> I never received any feedback for this new testcase.
> Would it be OK?

I can't see anything wrong with it.

Cheers,

Mark


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

* Re: [RFA/testsuite] New testcase for set/unset/show substitute-path
  2006-08-08 23:00 [RFA/testsuite] New testcase for set/unset/show substitute-path Joel Brobecker
  2006-10-04 21:46 ` Joel Brobecker
@ 2006-10-05 19:49 ` Daniel Jacobowitz
  2006-10-06 18:21   ` Joel Brobecker
  1 sibling, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2006-10-05 19:49 UTC (permalink / raw)
  To: gdb-patches

On Tue, Aug 08, 2006 at 04:00:45PM -0700, Joel Brobecker wrote:
> Hello,
> 
> Here is a first try at implementing a testcase for the new
> substitute-path commands. I'm only testing the manipulation
> of the list of substitution rules at this point, because I still
> don't see how to implement something that would test the actual
> substitution and work in all cases. I figured this is better than
> nothing for now.

Mark's already approved this - I definitely agree that some tests are
better than no tests :-)

As for functionality testing, I would recommend doing it like this.
There's already some samples of creating files and directories during
testing (e.g. corefile.exp, commands.exp).  Use that to make two
directories.  Put a source file with different contents in each but the
same basename.  Compile and debug one of them without issuing a "dir"
command, unlike most of the existing tests, and verify that we find the
file we expect.  Then, use "info source" and look for "Compilation
directory"; and that should be all you need to use substitute-path to
point at the other directory, and verify that now list shows the second
file.

Sound reasonable?  No rush - just offering the suggestion.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: [RFA/testsuite] New testcase for set/unset/show substitute-path
  2006-10-05 19:37   ` Mark Kettenis
@ 2006-10-06 18:20     ` Joel Brobecker
  0 siblings, 0 replies; 6+ messages in thread
From: Joel Brobecker @ 2006-10-06 18:20 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

> I can't see anything wrong with it.

Thanks, Mark. Now checked in.

-- 
Joel


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

* Re: [RFA/testsuite] New testcase for set/unset/show substitute-path
  2006-10-05 19:49 ` Daniel Jacobowitz
@ 2006-10-06 18:21   ` Joel Brobecker
  0 siblings, 0 replies; 6+ messages in thread
From: Joel Brobecker @ 2006-10-06 18:21 UTC (permalink / raw)
  To: gdb-patches

> As for functionality testing, I would recommend doing it like this.
> There's already some samples of creating files and directories during
> testing (e.g. corefile.exp, commands.exp).  Use that to make two
> directories.  Put a source file with different contents in each but the
> same basename.  Compile and debug one of them without issuing a "dir"
> command, unlike most of the existing tests, and verify that we find the
> file we expect.  Then, use "info source" and look for "Compilation
> directory"; and that should be all you need to use substitute-path to
> point at the other directory, and verify that now list shows the second
> file.
> 
> Sound reasonable?  No rush - just offering the suggestion.

Excellent. Thanks a lot for the recommendations!

-- 
Joel


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

end of thread, other threads:[~2006-10-06 18:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-08 23:00 [RFA/testsuite] New testcase for set/unset/show substitute-path Joel Brobecker
2006-10-04 21:46 ` Joel Brobecker
2006-10-05 19:37   ` Mark Kettenis
2006-10-06 18:20     ` Joel Brobecker
2006-10-05 19:49 ` Daniel Jacobowitz
2006-10-06 18:21   ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox