[2/2] gdb: testsuite: specify two args for "set args" command in a2-run.exp

Message ID 1637236761-7973-3-git-send-email-yangtiezhu@loongson.cn
State New
Headers show
Series
  • Do some changes in gdb/testsuite/gdb.base/a2-run.exp
Related show

Commit Message

Tiezhu Yang Nov. 18, 2021, 11:59 a.m.
In order to improve test coverage, add a testcase to specify two args
for "set args" command in a2-run.exp.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>

---
 gdb/testsuite/gdb.base/a2-run.exp | 5 +++++
 1 file changed, 5 insertions(+)

-- 
2.1.0

Comments

Tom Tromey Nov. 18, 2021, 3:28 p.m. | #1
>>>>> ">" == Tiezhu Yang <yangtiezhu@loongson.cn> writes:


>> In order to improve test coverage, add a testcase to specify two args

>> for "set args" command in a2-run.exp.


When you say to improve coverage -- did you do before/after coverage
runs and see some improvement?  If so, could you say where?

I tend to suspect there are other spots testing 'set args'.

thanks,
Tom
Tiezhu Yang Nov. 19, 2021, 1:17 a.m. | #2
On 11/18/2021 11:28 PM, Tom Tromey wrote:
>>>>>> ">" == Tiezhu Yang <yangtiezhu@loongson.cn> writes:

>>> In order to improve test coverage, add a testcase to specify two args

>>> for "set args" command in a2-run.exp.

> When you say to improve coverage -- did you do before/after coverage

> runs and see some improvement?  If so, could you say where?

>

> I tend to suspect there are other spots testing 'set args'.

>

> thanks,

> Tom


Hi Tom,
Thank you very much for your reply.
It was intended to test the following case in gdb/testsuite/gdb.base/run.c:
if (argc != 2) {
printf ("usage: factorial <number>\n");
return 1;
}
Additionally, I do not find a test case with two args for "set args"command,
maybe am I missing something?
$ grep -r "set args"gdb/testsuite/gdb.base
gdb/testsuite/gdb.base/gdb_history:set args
gdb/testsuite/gdb.base/setshow.exp: gdb_test_no_output "set args ~"
gdb/testsuite/gdb.base/setshow.exp: #test set args
gdb/testsuite/gdb.base/setshow.exp: gdb_test_no_output "set args foo bar 
blup baz bubble""set args"
gdb/testsuite/gdb.base/jit-elf-so.exp: # Poke desired values directly 
into inferior instead of using "set args"
gdb/testsuite/gdb.base/jit-elf-so.exp: # because "set args"does not work 
under gdbserver.
gdb/testsuite/gdb.base/sigbpt.exp: set args [concat $args "*[at_segv]"]
gdb/testsuite/gdb.base/inferior-args.exp: } elseif { $method == "set 
args"} {
gdb/testsuite/gdb.base/inferior-args.exp: # Using "set args"does not 
make sense with a stub.
gdb/testsuite/gdb.base/inferior-args.exp: gdb_test_no_output "set args 
$inferior_args"
gdb/testsuite/gdb.base/inferior-args.exp:foreach_with_prefix method { 
"start""starti""run""set args"} {
gdb/testsuite/gdb.base/jit-elf.exp: # Poke desired values directly into 
inferior instead of using "set args"
gdb/testsuite/gdb.base/jit-elf.exp: # because "set args"does not work 
under gdbserver.
gdb/testsuite/gdb.base/a2-run.exp:# Use "set args"command to specify no 
arguments as default and run again.
gdb/testsuite/gdb.base/a2-run.exp:gdb_test_no_output "set args"
gdb/testsuite/gdb.base/a2-run.exp:# Use "set args"command to specify an 
argument and run again.
gdb/testsuite/gdb.base/a2-run.exp:gdb_test_no_output "set args 6"
gdb/testsuite/gdb.base/info-proc.exp:# cmdline". However, if we're using 
a stub, then "set args" would not
gdb/testsuite/gdb.base/info-proc.exp: gdb_test_no_output "set args 
$cmdline""set args"
gdb/testsuite/gdb.base/gcore-buffer-overflow.exp:gdb_test_no_output "set 
args ${pattern}"\
gdb/testsuite/gdb.base/pie-execl.exp:# In remote mode we cannot use the 
'set args'command, and this
gdb/testsuite/gdb.base/pie-execl.exp:gdb_test_no_output "set args 
${binfile2}""set args ${binfile2_test_msg}"
gdb/testsuite/gdb.base/break-interp.exp: gdb_test_no_output "set args segv"
gdb/testsuite/gdb.base/break-interp.exp: gdb_test_no_output "set args 
[standard_output_file $binfile_test]"\
gdb/testsuite/gdb.base/break-interp.exp: "set args 
OBJDIR/${subdir}/$binfile_test"
gdb/testsuite/gdb.base/default.exp:#test set args
gdb/testsuite/gdb.base/default.exp:gdb_test_no_output "set args""set args"
gdb/testsuite/gdb.base/startup-with-shell.exp: gdb_test_no_output "set 
args $run_args"\
gdb/testsuite/gdb.base/startup-with-shell.exp: "set args \$run_args"
Tiezhu Yang Nov. 23, 2021, 12:36 p.m. | #3
On 11/19/2021 09:17 AM, Tiezhu Yang wrote:
> On 11/18/2021 11:28 PM, Tom Tromey wrote:

>>>>>>> ">" == Tiezhu Yang <yangtiezhu@loongson.cn> writes:

>>>> In order to improve test coverage, add a testcase to specify two args

>>>> for "set args" command in a2-run.exp.

>> When you say to improve coverage -- did you do before/after coverage

>> runs and see some improvement?  If so, could you say where?

>>

>> I tend to suspect there are other spots testing 'set args'.

>>

>> thanks,

>> Tom

>

> Hi Tom,

> Thank you very much for your reply.

> It was intended to test the following case in gdb/testsuite/gdb.base/run.c:

> if (argc != 2) {

> printf ("usage: factorial <number>\n");

> return 1;

> }

> Additionally, I do not find a test case with two args for "set

> args"command,

> maybe am I missing something?

> $ grep -r "set args"gdb/testsuite/gdb.base

> gdb/testsuite/gdb.base/gdb_history:set args

> gdb/testsuite/gdb.base/setshow.exp: gdb_test_no_output "set args ~"

> gdb/testsuite/gdb.base/setshow.exp: #test set args

> gdb/testsuite/gdb.base/setshow.exp: gdb_test_no_output "set args foo bar

> blup baz bubble""set args"

> gdb/testsuite/gdb.base/jit-elf-so.exp: # Poke desired values directly

> into inferior instead of using "set args"

> gdb/testsuite/gdb.base/jit-elf-so.exp: # because "set args"does not work

> under gdbserver.

> gdb/testsuite/gdb.base/sigbpt.exp: set args [concat $args "*[at_segv]"]

> gdb/testsuite/gdb.base/inferior-args.exp: } elseif { $method == "set

> args"} {

> gdb/testsuite/gdb.base/inferior-args.exp: # Using "set args"does not

> make sense with a stub.

> gdb/testsuite/gdb.base/inferior-args.exp: gdb_test_no_output "set args

> $inferior_args"

> gdb/testsuite/gdb.base/inferior-args.exp:foreach_with_prefix method {

> "start""starti""run""set args"} {

> gdb/testsuite/gdb.base/jit-elf.exp: # Poke desired values directly into

> inferior instead of using "set args"

> gdb/testsuite/gdb.base/jit-elf.exp: # because "set args"does not work

> under gdbserver.

> gdb/testsuite/gdb.base/a2-run.exp:# Use "set args"command to specify no

> arguments as default and run again.

> gdb/testsuite/gdb.base/a2-run.exp:gdb_test_no_output "set args"

> gdb/testsuite/gdb.base/a2-run.exp:# Use "set args"command to specify an

> argument and run again.

> gdb/testsuite/gdb.base/a2-run.exp:gdb_test_no_output "set args 6"

> gdb/testsuite/gdb.base/info-proc.exp:# cmdline". However, if we're using

> a stub, then "set args" would not

> gdb/testsuite/gdb.base/info-proc.exp: gdb_test_no_output "set args

> $cmdline""set args"

> gdb/testsuite/gdb.base/gcore-buffer-overflow.exp:gdb_test_no_output "set

> args ${pattern}"\

> gdb/testsuite/gdb.base/pie-execl.exp:# In remote mode we cannot use the

> 'set args'command, and this

> gdb/testsuite/gdb.base/pie-execl.exp:gdb_test_no_output "set args

> ${binfile2}""set args ${binfile2_test_msg}"

> gdb/testsuite/gdb.base/break-interp.exp: gdb_test_no_output "set args segv"

> gdb/testsuite/gdb.base/break-interp.exp: gdb_test_no_output "set args

> [standard_output_file $binfile_test]"\

> gdb/testsuite/gdb.base/break-interp.exp: "set args

> OBJDIR/${subdir}/$binfile_test"

> gdb/testsuite/gdb.base/default.exp:#test set args

> gdb/testsuite/gdb.base/default.exp:gdb_test_no_output "set args""set args"

> gdb/testsuite/gdb.base/startup-with-shell.exp: gdb_test_no_output "set

> args $run_args"\

> gdb/testsuite/gdb.base/startup-with-shell.exp: "set args \$run_args"

>


Hi,

If this small patchset looks good to you, could you please apply them
to binutils-gdb.git? Maybe other cleanup about arm-coff could be done
in the future.

[PATCH 0/2] Do some changes in gdb/testsuite/gdb.base/a2-run.exp
https://sourceware.org/pipermail/gdb-patches/2021-November/183525.html

[PATCH 1/2] gdb: testsuite: no need to setup_xfail "arm-*-coff" in 
a2-run.exp
https://sourceware.org/pipermail/gdb-patches/2021-November/183524.html

[PATCH 2/2] gdb: testsuite: specify two args for "set args" command in 
a2-run.exp
https://sourceware.org/pipermail/gdb-patches/2021-November/183523.html

Thanks,
Tiezhu

Patch

diff --git a/gdb/testsuite/gdb.base/a2-run.exp b/gdb/testsuite/gdb.base/a2-run.exp
index 2042c26..fc9fa58 100644
--- a/gdb/testsuite/gdb.base/a2-run.exp
+++ b/gdb/testsuite/gdb.base/a2-run.exp
@@ -156,6 +156,11 @@  gdb_test_no_output "set args 6"
 gdb_run_cmd
 gdb_test_stdio "" "720" "" "run \"$testfile\" again after setting args"
 
+# Use "set args" command to specify two arguments and run again.
+gdb_test_no_output "set args 6 7"
+gdb_run_cmd
+gdb_test_stdio "" "usage:  factorial <number>" "" "run after setting two args"
+
 # GOAL: Test that shell is being used with "run".  For remote debugging
 # targets, there is no guarantee that a "shell" (whatever that is) is used.
 if ![is_remote target] then {