aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/py-parameter.exp
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2019-09-15 21:53:11 -0400
committerAndrew Burgess <andrew.burgess@embecosm.com>2019-10-03 17:48:03 +0100
commit082cce059d78bdb4a9fadbbacc2cd1dc3668f084 (patch)
tree7130b0b97238ca89961999ec1a29cbe70b3cc0cd /gdb/testsuite/gdb.python/py-parameter.exp
parent2b74ba5a194fdfb152465e786a173b039e28964a (diff)
downloadgdb-082cce059d78bdb4a9fadbbacc2cd1dc3668f084.zip
gdb-082cce059d78bdb4a9fadbbacc2cd1dc3668f084.tar.gz
gdb-082cce059d78bdb4a9fadbbacc2cd1dc3668f084.tar.bz2
gdb/testsuite: Reduce test name duplication in gdb.python tests
This commit removes some, but not all, of the test name duplication within the gdb.python tests. On my local machine this takes the number of duplicate test names in this set of tests from 174 to 85. It is possible that different setups might encounter more duplicate tests. gdb/testsuite/ChangeLog: * gdb.python/py-parameter.exp: Make test names unique. * gdb.python/py-template.exp: Likewise. * gdb.python/py-value.exp: Likewise.
Diffstat (limited to 'gdb/testsuite/gdb.python/py-parameter.exp')
-rw-r--r--gdb/testsuite/gdb.python/py-parameter.exp317
1 files changed, 187 insertions, 130 deletions
diff --git a/gdb/testsuite/gdb.python/py-parameter.exp b/gdb/testsuite/gdb.python/py-parameter.exp
index a199f72..b2f7877 100644
--- a/gdb/testsuite/gdb.python/py-parameter.exp
+++ b/gdb/testsuite/gdb.python/py-parameter.exp
@@ -38,147 +38,204 @@ if { [is_remote host] } {
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"
+with_test_prefix "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 boolean parameter value is True"
+ 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 boolean parameter value is False"
+ 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"
+with_test_prefix "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 is one"
+ 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 is two"
+ 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.*"
+with_test_prefix "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"
+with_test_prefix "undocumented parameter" {
+ 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 undocumented parameter value is False"
+ 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_no_output "set print test-nodoc-param off" "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"
+with_test_prefix "really undocumented parameter" {
+ 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_no_output "set print test-nodoc-param off" \
+ "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 really undocumented parameter value is False"
+ 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_no_output "set print test-param off" "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"
+with_test_prefix "deprecated API 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 = \"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 deprecated API parameter value is True"
+ gdb_test "show print test-param" \
+ "State of the Test Parameter on.*" "show parameter on"
+ gdb_test_no_output "set print test-param off" "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 deprecated API parameter value is False"
+ 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"
+}
foreach kind {PARAM_ZUINTEGER PARAM_ZUINTEGER_UNLIMITED} {
gdb_py_test_multiple "Simple gdb $kind" \