
Changes in v3: Fixed incorrect substitutions. This fixes offender testcases that have test names starting with uppercase when using gdb_test in a single line construct. gdb/testsuite/ChangeLog 2016-12-01 Luis Machado <lgustavo@codesourcery.com> Fix test names starting with uppercase throughout the files. * gdb.arch/i386-mpx-simple_segv.exp * gdb.arch/i386-mpx.exp * gdb.arch/i386-permbkpt.exp * gdb.arch/pa-nullify.exp * gdb.arch/powerpc-d128-regs.exp * gdb.arch/vsx-regs.exp * gdb.base/bfp-test.exp * gdb.base/break.exp * gdb.base/breakpoint-shadow.exp * gdb.base/callfuncs.exp * gdb.base/charset.exp * gdb.base/commands.exp * gdb.base/completion.exp * gdb.base/dfp-test.exp * gdb.base/echo.exp * gdb.base/ending-run.exp * gdb.base/eval.exp * gdb.base/expand-psymtabs.exp * gdb.base/float128.exp * gdb.base/floatn.exp * gdb.base/foll-exec-mode.exp * gdb.base/gdb1056.exp * gdb.base/gdb11531.exp * gdb.base/kill-after-signal.exp * gdb.base/multi-forks.exp * gdb.base/overlays.exp * gdb.base/pending.exp * gdb.base/sepdebug.exp * gdb.base/testenv.exp * gdb.base/valgrind-db-attach.exp * gdb.base/watch_thread_num.exp * gdb.base/watchpoint-cond-gone.exp * gdb.base/watchpoint.exp * gdb.base/watchpoints.exp * gdb.cp/arg-reference.exp * gdb.cp/baseenum.exp * gdb.cp/operator.exp * gdb.cp/shadow.exp * gdb.dwarf2/dw2-op-out-param.exp * gdb.dwarf2/dw2-reg-undefined.exp * gdb.go/chan.exp * gdb.go/hello.exp * gdb.go/integers.exp * gdb.go/methods.exp * gdb.go/package.exp * gdb.guile/scm-parameter.exp * gdb.guile/scm-progspace.exp * gdb.guile/scm-value.exp * gdb.mi/mi-pending.exp * gdb.mi/user-selected-context-sync.exp * gdb.multi/multi-attach.exp * gdb.multi/tids.exp * gdb.opt/clobbered-registers-O2.exp * gdb.pascal/floats.exp * gdb.pascal/integers.exp * gdb.python/py-block.exp * gdb.python/py-events.exp * gdb.python/py-parameter.exp * gdb.python/py-symbol.exp * gdb.python/py-symtab.exp * gdb.python/py-type.exp * gdb.python/py-value.exp * gdb.python/py-xmethods.exp * gdb.python/python.exp * gdb.reverse/break-precsave.exp * gdb.reverse/consecutive-precsave.exp * gdb.reverse/finish-precsave.exp * gdb.reverse/i386-precsave.exp * gdb.reverse/machinestate-precsave.exp * gdb.reverse/sigall-precsave.exp * gdb.reverse/solib-precsave.exp * gdb.reverse/step-precsave.exp * gdb.reverse/until-precsave.exp * gdb.reverse/watch-precsave.exp * gdb.server/ext-attach.exp * gdb.server/ext-restart.exp * gdb.server/ext-run.exp * gdb.server/ext-wrapper.exp * gdb.stabs/gdb11479.exp * gdb.stabs/weird.exp * gdb.threads/attach-many-short-lived-threads.exp * gdb.threads/kill.exp * gdb.threads/watchpoint-fork.exp
181 lines
9.5 KiB
Text
181 lines
9.5 KiB
Text
# Copyright (C) 2010-2016 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
# This file is part of the GDB testsuite.
|
|
# It tests gdb.parameter and gdb.Parameter.
|
|
|
|
load_lib gdb-python.exp
|
|
|
|
# Start with a fresh gdb.
|
|
gdb_exit
|
|
gdb_start
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
|
|
|
# Skip all tests if Python scripting is not enabled.
|
|
if { [skip_python_tests] } { continue }
|
|
|
|
# We use "." here instead of ":" so that this works on win32 too.
|
|
if { [is_remote host] } {
|
|
# Don't match $srcdir/$subdir because proc gdb_reinitialize_dir
|
|
# doesn't set search directories on remote host.
|
|
set directories ".*\\\$cdir.\\\$cwd"
|
|
} else {
|
|
set escaped_directory [string_to_regexp "$srcdir/$subdir"]
|
|
set directories "$escaped_directory.\\\$cdir.\\\$cwd"
|
|
}
|
|
gdb_test "python print (gdb.parameter ('directories'))" $directories
|
|
|
|
# Test a simple boolean parameter.
|
|
gdb_py_test_multiple "Simple gdb booleanparameter" \
|
|
"python" "" \
|
|
"class TestParam (gdb.Parameter):" "" \
|
|
" \"\"\"When enabled, test param does something useful. When disabled, does nothing.\"\"\"" "" \
|
|
" show_doc = \"Show the state of the boolean test-param\"" ""\
|
|
" set_doc = \"Set the state of the boolean test-param\"" "" \
|
|
" def get_show_string (self, pvalue):" ""\
|
|
" return \"The state of the Test Parameter is \" + pvalue" ""\
|
|
" def get_set_string (self):" ""\
|
|
" val = \"on\"" ""\
|
|
" if (self.value == False):" ""\
|
|
" val = \"off\"" ""\
|
|
" return \"Test Parameter has been set to \" + val" ""\
|
|
" def __init__ (self, name):" "" \
|
|
" super (TestParam, self).__init__ (name, gdb.COMMAND_DATA, gdb.PARAM_BOOLEAN)" "" \
|
|
" self.value = True" "" \
|
|
"test_param = TestParam ('print test-param')" ""\
|
|
"end"
|
|
|
|
gdb_test "python print (test_param.value)" "True" "test parameter value"
|
|
gdb_test "show print test-param" "The state of the Test Parameter is on.*" "show parameter on"
|
|
gdb_test "set print test-param off" "Test Parameter has been set to off" "turn off parameter"
|
|
gdb_test "show print test-param" "The state of the Test Parameter is off.*" "show parameter off"
|
|
gdb_test "python print (test_param.value)" "False" "test parameter value"
|
|
gdb_test "help show print test-param" "Show the state of the boolean test-param.*" "test show help"
|
|
gdb_test "help set print test-param" "Set the state of the boolean test-param.*" "test set help"
|
|
gdb_test "help set print" "set print test-param -- Set the state of the boolean test-param.*" "test general help"
|
|
|
|
|
|
# Test an enum parameter.
|
|
gdb_py_test_multiple "enum gdb parameter" \
|
|
"python" "" \
|
|
"class TestEnumParam (gdb.Parameter):" "" \
|
|
" \"\"\"When set, test param does something useful. When disabled, does nothing.\"\"\"" "" \
|
|
" show_doc = \"Show the state of the enum\"" ""\
|
|
" set_doc = \"Set the state of the enum\"" "" \
|
|
" def get_show_string (self, pvalue):" ""\
|
|
" return \"The state of the enum is \" + pvalue" ""\
|
|
" def get_set_string (self):" ""\
|
|
" return \"The state of the enum has been set to \" + self.value" ""\
|
|
" def __init__ (self, name):" "" \
|
|
" super (TestEnumParam, self).__init__ (name, gdb.COMMAND_DATA, gdb.PARAM_ENUM, \[\"one\", \"two\"\])" "" \
|
|
" self.value = \"one\"" "" \
|
|
"test_enum_param = TestEnumParam ('print test-enum-param')" ""\
|
|
"end"
|
|
|
|
gdb_test "python print (test_enum_param.value)" "one" "test enum parameter value"
|
|
gdb_test "show print test-enum-param" "The state of the enum is one.*" "show parameter is initial value"
|
|
gdb_test "set print test-enum-param two" "The state of the enum has been set to two" "set enum to two"
|
|
gdb_test "show print test-enum-param" "The state of the enum is two.*" "show parameter is new value"
|
|
gdb_test "python print (test_enum_param.value)" "two" "test enum parameter value"
|
|
gdb_test "set print test-enum-param three" "Undefined item: \"three\".*" "set invalid enum parameter"
|
|
|
|
# Test a file parameter.
|
|
gdb_py_test_multiple "file gdb parameter" \
|
|
"python" "" \
|
|
"class TestFileParam (gdb.Parameter):" "" \
|
|
" \"\"\"When set, test param does something useful. When disabled, does nothing.\"\"\"" "" \
|
|
" show_doc = \"Show the name of the file\"" ""\
|
|
" set_doc = \"Set the name of the file\"" "" \
|
|
" def get_show_string (self, pvalue):" ""\
|
|
" return \"The name of the file is \" + pvalue" ""\
|
|
" def get_set_string (self):" ""\
|
|
" return \"The name of the file has been changed to \" + self.value" ""\
|
|
" def __init__ (self, name):" "" \
|
|
" super (TestFileParam, self).__init__ (name, gdb.COMMAND_FILES, gdb.PARAM_FILENAME)" "" \
|
|
" self.value = \"foo.txt\"" "" \
|
|
"test_file_param = TestFileParam ('test-file-param')" ""\
|
|
"end"
|
|
|
|
gdb_test "python print (test_file_param.value)" "foo.txt" "test file parameter value"
|
|
gdb_test "show test-file-param" "The name of the file is foo.txt.*" "show initial file value"
|
|
gdb_test "set test-file-param bar.txt" "The name of the file has been changed to bar.txt" "set new file parameter" 1
|
|
gdb_test "show test-file-param" "The name of the file is bar.txt.*" "show new file value"
|
|
gdb_test "python print (test_file_param.value)" "bar.txt" "test new file parameter value"
|
|
gdb_test "set test-file-param" "Argument required.*"
|
|
|
|
# Test a parameter that is not documented.
|
|
gdb_py_test_multiple "Simple gdb booleanparameter" \
|
|
"python" "" \
|
|
"class TestUndocParam (gdb.Parameter):" "" \
|
|
" def get_show_string (self, pvalue):" ""\
|
|
" return \"The state of the Test Parameter is \" + pvalue" ""\
|
|
" def get_set_string (self):" ""\
|
|
" val = \"on\"" ""\
|
|
" if (self.value == False):" ""\
|
|
" val = \"off\"" ""\
|
|
" return \"Test Parameter has been set to \" + val" ""\
|
|
" def __init__ (self, name):" "" \
|
|
" super (TestUndocParam, self).__init__ (name, gdb.COMMAND_DATA, gdb.PARAM_BOOLEAN)" "" \
|
|
" self.value = True" "" \
|
|
"test_undoc_param = TestUndocParam ('print test-undoc-param')" ""\
|
|
"end"
|
|
|
|
gdb_test "show print test-undoc-param" "The state of the Test Parameter is on.*" "show parameter on"
|
|
gdb_test "set print test-undoc-param off" "Test Parameter has been set to off" "turn off parameter"
|
|
gdb_test "show print test-undoc-param" "The state of the Test Parameter is off.*" "show parameter off"
|
|
gdb_test "python print (test_undoc_param.value)" "False" "test parameter value"
|
|
gdb_test "help show print test-undoc-param" "This command is not documented.*" "test show help"
|
|
gdb_test "help set print test-undoc-param" "This command is not documented.*" "test set help"
|
|
gdb_test "help set print" "set print test-undoc-param -- This command is not documented.*" "test general help"
|
|
|
|
# Test a parameter that is not documented in any way..
|
|
gdb_py_test_multiple "Simple gdb booleanparameter" \
|
|
"python" "" \
|
|
"class TestNodocParam (gdb.Parameter):" "" \
|
|
" def __init__ (self, name):" "" \
|
|
" super (TestNodocParam, self).__init__ (name, gdb.COMMAND_DATA, gdb.PARAM_BOOLEAN)" "" \
|
|
" self.value = True" "" \
|
|
"test_nodoc_param = TestNodocParam ('print test-nodoc-param')" ""\
|
|
"end"
|
|
|
|
gdb_test "show print test-nodoc-param" "This command is not documented.*" "show parameter on"
|
|
gdb_test "set print test-nodoc-param off" "This command is not documented.*" "turn off parameter"
|
|
gdb_test "show print test-nodoc-param" "This command is not documented.*.*" "show parameter off"
|
|
gdb_test "python print (test_nodoc_param.value)" "False" "test parameter value"
|
|
gdb_test "help show print test-nodoc-param" "This command is not documented.*" "test show help"
|
|
gdb_test "help set print test-nodoc-param" "This command is not documented.*" "test set help"
|
|
gdb_test "help set print" "set print test-nodoc-param -- This command is not documented.*" "test general help"
|
|
|
|
# Test deprecated API. Do not use in your own implementations.
|
|
gdb_py_test_multiple "Simple gdb booleanparameter" \
|
|
"python" "" \
|
|
"class TestParam (gdb.Parameter):" "" \
|
|
" \"\"\"When enabled, test param does something useful. When disabled, does nothing.\"\"\"" "" \
|
|
" show_doc = \"State of the Test Parameter\"" ""\
|
|
" set_doc = \"Set the state of the Test Parameter\"" "" \
|
|
" def __init__ (self, name):" "" \
|
|
" super (TestParam, self).__init__ (name, gdb.COMMAND_DATA, gdb.PARAM_BOOLEAN)" "" \
|
|
" self.value = True" "" \
|
|
"test_param = TestParam ('print test-param')" ""\
|
|
"end"
|
|
|
|
gdb_test "python print (test_param.value)" "True" "test parameter value"
|
|
gdb_test "show print test-param" "State of the Test Parameter on.*" "show parameter on"
|
|
gdb_test "set print test-param off" "Set the state of the Test Parameter.*" "turn off parameter"
|
|
gdb_test "show print test-param" "State of the Test Parameter off.*" "show parameter off"
|
|
gdb_test "python print (test_param.value)" "False" "test parameter value"
|
|
gdb_test "help show print test-param" "State of the Test Parameter.*" "test show help"
|
|
gdb_test "help set print test-param" "Set the state of the Test Parameter.*" "test set help"
|
|
gdb_test "help set print" "set print test-param -- Set the state of the Test Parameter.*" "test general help"
|