Don't check target_info exists noargs in commands.exp

I am confused by the noargs checking at each proc in commands.exp,

    if [target_info exists noargs] {
        verbose "Skipping progvar_simple_while_test because of noargs."
        return
    }
    gdb_test_no_output "set args 5" "set args in progvar_simple_while_test"
    if { ![runto factorial] } then { gdb_suppress_tests }
    # Don't depend upon argument passing, since most simulators don't
    # currently support it.  Bash value variable to be what we want.
    gdb_test "p value=5" ".*" "set value to 5 in progvar_simple_if_test #2"

They are conflicting to me.  If the argument passing can't be done on
the target, we skip this test, why do we still have to set value below?
On the other hand, the test case is compiled with -DFAKEARGV, it doesn't
get anything from argv[1], why do we need to skip it if noargs is true?

I don't find any useful clues from the git log, as the code is quite
old, predating import to sourceware cvs.  However, I find something
useful from the ChangeLog.

Thu Jul 20 13:28:36 1995  Jeffrey A. Law  <law@rtl.cygnus.com>

        .....
        * gdb.base/commands.exp: Protect tests which need arguments with
        $noargs conditionals.

Mon Apr 21 13:38:58 1997  Fred Fish  <fnf@cygnus.com>

        * gdb.base/run.c: Use FAKEARGV to build test executable that
        does not require a command line arg, since most simulators
        don't currently support passing such an arg into the simulated
        program.
        * gdb.base/commands.exp: Change tests to insert the proper
        value as the arg to the first recursive factorial call.  Change
        compilation line to define FAKEARGV at compile time.

Jeff added noargs checking as argument is passed to the inferior.  Then,
I presume Fred wanted to run this test on simulators which don't support
argument passing, and change the code not get input from argv.  (I guess)
noargs wasn't set in simulator board files at that moment.

Since Fred changed test to set input by gdb, instead of getting input
from argv, the test should be able to run on target doesn't support
argument passing, such as simulator and gdbserver.

This patch is to remove these checks to noargs and "set args".  I run
commands.exp with these board files, and no fail is found

 - unix and native-gdbserver
 - arm-none-eabi with qemu
 - gdbserver on arm-linux-gnueabi with qemu

gdb/testsuite:

2014-10-17  Yao Qi  <yao@codesourcery.com>

	* gdb.base/commands.exp (gdbvar_complex_if_while_test): Don't check
	'target_info exists noargs'.
	(test_command_prompt_position): Likewise.
	(progvar_simple_if_test): Don't check 'target_info exists noargs'.
	 Remove "set args".
	(progvar_simple_while_test): Likewise.
	(progvar_complex_if_while_test): Likewise.
	(if_while_breakpoint_command_test): Likewise.
	(infrun_breakpoint_command_test): Likewise.
	(breakpoint_command_test): Likewise.
	(watchpoint_command_test): Likewise.
	(bp_deleted_in_command_test): Likewise.
	(temporary_breakpoint_commands): Likewise.
This commit is contained in:
Yao Qi 2014-10-10 21:17:11 +08:00
parent 48cfaa5c1d
commit 7a3517ffeb
2 changed files with 16 additions and 61 deletions

View File

@ -1,3 +1,19 @@
2014-10-17 Yao Qi <yao@codesourcery.com>
* gdb.base/commands.exp (gdbvar_complex_if_while_test): Don't
check 'target_info exists noargs'.
(test_command_prompt_position): Likewise.
(progvar_simple_if_test): Don't check 'target_info exists noargs'.
Remove "set args".
(progvar_simple_while_test): Likewise.
(progvar_complex_if_while_test): Likewise.
(if_while_breakpoint_command_test): Likewise.
(infrun_breakpoint_command_test): Likewise.
(breakpoint_command_test): Likewise.
(watchpoint_command_test): Likewise.
(bp_deleted_in_command_test): Likewise.
(temporary_breakpoint_commands): Likewise.
2014-10-16 Yao Qi <yao@codesourcery.com>
* gdb.base/remotetimeout.exp: Remove noargs checking.

View File

@ -59,11 +59,6 @@ proc gdbvar_complex_if_while_test {} {
proc progvar_simple_if_test {} {
global gdb_prompt
if [target_info exists noargs] {
verbose "Skipping progvar_simple_if_test because of noargs."
return
}
if { ![runto factorial] } then { gdb_suppress_tests; }
# Don't depend upon argument passing, since most simulators don't
# currently support it. Bash value variable to be what we want.
@ -82,12 +77,6 @@ proc progvar_simple_if_test {} {
proc progvar_simple_while_test {} {
global gdb_prompt
if [target_info exists noargs] {
verbose "Skipping progvar_simple_while_test because of noargs."
return
}
gdb_test_no_output "set args 5" "set args in progvar_simple_while_test"
if { ![runto factorial] } then { gdb_suppress_tests }
# Don't depend upon argument passing, since most simulators don't
# currently support it. Bash value variable to be what we want.
@ -102,13 +91,6 @@ proc progvar_simple_while_test {} {
proc progvar_complex_if_while_test {} {
global gdb_prompt
if [target_info exists noargs] {
verbose "Skipping progvar_simple_if_while_test because of noargs."
return
}
gdb_test_no_output "set args 4" \
"set args in progvar_complex_if_while_test"
if { ![runto factorial] } then { gdb_suppress_tests }
# Don't depend upon argument passing, since most simulators don't
# currently support it. Bash value variable to be what we want.
@ -121,13 +103,7 @@ proc progvar_complex_if_while_test {} {
}
proc if_while_breakpoint_command_test {} {
if [target_info exists noargs] {
verbose "Skipping if_while_breakpoint_command_test because of noargs."
return
}
gdb_test_no_output "set args 5" \
"set args in if_while_breakpoint_command_test"
if { ![runto factorial] } then { gdb_suppress_tests }
# Don't depend upon argument passing, since most simulators don't
# currently support it. Bash value variable to be what we want.
@ -162,13 +138,7 @@ proc if_while_breakpoint_command_test {} {
# subsection "Breakpoint command lists".
proc infrun_breakpoint_command_test {} {
if [target_info exists noargs] {
verbose "Skipping infrun_breakpoint_command_test because of noargs."
return
}
gdb_test_no_output "set args 6" \
"set args in infrun_breakpoint_command_test"
if { ![runto factorial] } then { gdb_suppress_tests }
# Don't depend upon argument passing, since most simulators don't
# currently support it. Bash value variable to be what we want.
@ -197,12 +167,7 @@ proc infrun_breakpoint_command_test {} {
}
proc breakpoint_command_test {} {
if [target_info exists noargs] {
verbose "Skipping breakpoint_command_test because of noargs."
return
}
gdb_test_no_output "set args 6" "set args in breakpoint_command_test"
if { ![runto factorial] } then { gdb_suppress_tests; }
# Don't depend upon argument passing, since most simulators don't
# currently support it. Bash value variable to be what we want.
@ -268,20 +233,13 @@ proc user_defined_command_test {} {
}
proc watchpoint_command_test {} {
global noargs
global gdb_prompt
if [target_info exists noargs] {
verbose "Skipping watchpoint_command_test because of noargs."
return
}
# Disable hardware watchpoints if necessary.
if [target_info exists gdb,no_hardware_watchpoints] {
gdb_test_no_output "set can-use-hw-watchpoints 0" ""
}
gdb_test_no_output "set args 6" "set args in watchpoint_command_test"
if { ![runto factorial] } then { return }
delete_breakpoints
@ -348,11 +306,6 @@ proc watchpoint_command_test {} {
proc test_command_prompt_position {} {
global gdb_prompt
if [target_info exists noargs] {
verbose "Skipping test_command_prompt_position because of noargs."
return
}
if { ![runto factorial] } then { gdb_suppress_tests; }
# Don't depend upon argument passing, since most simulators don't
# currently support it. Bash value variable to be what we want.
@ -446,14 +399,7 @@ proc deprecated_command_test {} {
proc bp_deleted_in_command_test {} {
global gdb_prompt
if [target_info exists noargs] {
verbose "Skipping bp_deleted_in_command_test because of noargs."
return
}
gdb_test_no_output "set args 1" \
"set args in bp_deleted_in_command_test"
delete_breakpoints
# Create a breakpoint, and associate a command-list to it, with
@ -498,14 +444,7 @@ proc bp_deleted_in_command_test {} {
proc temporary_breakpoint_commands {} {
global gdb_prompt
if [target_info exists noargs] {
verbose "Skipping temporary_breakpoint_commands because of noargs."
return
}
gdb_test_no_output "set args 1" \
"set args in temporary_breakpoint_commands"
delete_breakpoints
# Create a temporary breakpoint, and associate a commands list to it.