gdb/testsuite: Introduce "proc_with_prefix"
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
[...]
gdb/testsuite/ChangeLog:
2016-11-09 Pedro Alves <palves@redhat.com>
* gdb.base/commands.exp (gdbvar_simple_if_test)
(gdbvar_simple_while_test, gdbvar_complex_if_while_test)
(progvar_simple_if_test, progvar_simple_while_test)
(progvar_complex_if_while_test, if_while_breakpoint_command_test)
(infrun_breakpoint_command_test, breakpoint_command_test)
(user_defined_command_test, watchpoint_command_test)
(test_command_prompt_position, deprecated_command_test)
(bp_deleted_in_command, temporary_breakpoint_commands)
(stray_arg0_test, source_file_with_indented_comment)
(recursive_source_test, if_commands_test)
(error_clears_commands_left, redefine_hook_test)
(redefine_backtrace_test): Use proc_with_prefix.
* lib/gdb.exp (proc_with_prefix): New proc.