This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 1/5] gdb/testsuite: Introduce "proc_with_prefix"


On 2016-11-08 19:19, Pedro Alves wrote:
While adding new tests to gdb.base/commands.exp, I noticed that the
file includes a bunch of individual testcases split into their own
procedures, and that none have ever been adjusted to use
with_test_prefix.  Instead, each gdb_test/gdb_test_multiple/etc
invocation takes care of including the procedure name in the test
message, in order to make sure test messages are unique.

Simon convinced me that using the procedure name as prefix is not that
bad of an idea:
  https://sourceware.org/ml/gdb-patches/2016-10/msg00020.html

This commit adds an IMO simpler alternative to
with_test_prefix_procname added by that patch -- a new
"proc_with_prefix" convenience proc that is meant to be used in place
of "proc", and then uses it in commands.exp.  Procedures defined with
this automatically run their bodies under with_test_prefix $proc_name.

Here's a sample of the resulting gdb.sum diff:

 [...]
 -PASS: gdb.base/commands.exp: break factorial #3
-PASS: gdb.base/commands.exp: set value to 5 in test_command_prompt_position
 -PASS: gdb.base/commands.exp: if test in test_command_prompt_position
 -PASS: gdb.base/commands.exp: > OK in test_command_prompt_position
+PASS: gdb.base/commands.exp: test_command_prompt_position: break factorial +PASS: gdb.base/commands.exp: test_command_prompt_position: set value to 5
 +PASS: gdb.base/commands.exp: test_command_prompt_position: if test
 +PASS: gdb.base/commands.exp: test_command_prompt_position: > OK
 [...]

LGTM. I think it's acceptable to use the proc name as a prefix in this case. If you take care of choosing a good proc name, what you would pass manually to with_test_prefix otherwise would be basically the proc name without underscores ("test_command_prompt_position" vs "test command prompt position"). It can save some typing and indentation.

I'll send a patch that makes gdb.mi/user-selected-context-sync.exp use this new feature.

Thanks!

Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]