aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2010-11-05 17:07:36 +0000
committerDoug Evans <dje@google.com>2010-11-05 17:07:36 +0000
commitb521dba8314f58f8dd0234297d8539628f9e5e7a (patch)
tree7b8e9b321ba75cf53c3ba8806e1622a595a0dfab /gdb/testsuite
parent99e7ae30ed872f3f81762504c930634c47055b7c (diff)
downloadgdb-b521dba8314f58f8dd0234297d8539628f9e5e7a.zip
gdb-b521dba8314f58f8dd0234297d8539628f9e5e7a.tar.gz
gdb-b521dba8314f58f8dd0234297d8539628f9e5e7a.tar.bz2
* gdb.python/py-param.exp: Delete, contents moved to ...
* gdb.python/py-parameter.exp: ... here. New file. Add test for gdb.parameter ("directories").
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.python/py-param.exp113
-rw-r--r--gdb/testsuite/gdb.python/py-parameter.exp85
3 files changed, 87 insertions, 115 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index cb81219..2532be2 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,7 +1,9 @@
2010-11-05 Doug Evans <dje@google.com>
* gdb.base/help.exp: Update expected output.
- * gdb.python/py-parameter.exp: New file.
+ * gdb.python/py-param.exp: Delete, contents moved to ...
+ * gdb.python/py-parameter.exp: ... here. New file.
+ Add test for gdb.parameter ("directories").
2010-11-05 Ken Werner <ken.werner@de.ibm.com>
diff --git a/gdb/testsuite/gdb.python/py-param.exp b/gdb/testsuite/gdb.python/py-param.exp
deleted file mode 100644
index a82b4ca..0000000
--- a/gdb/testsuite/gdb.python/py-param.exp
+++ /dev/null
@@ -1,113 +0,0 @@
-# Copyright (C) 2010 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 the mechanism
-# exposing convenience functions to Python.
-
-if $tracelevel then {
- strace $tracelevel
-}
-
-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 }
-
-# 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 whether the state of the Test Parameter does something useful\"" ""\
- " set_doc = \"Set whether the state of the Test Parameter does something useful\"" "" \
- " 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" "Whether the state of the Test Parameter does something useful is on.*" "Show parameter on"
-gdb_py_test_silent_cmd "set print test-param off" "Turn off parameter" 1
-gdb_test "show print test-param" "Whether the state of the Test Parameter does something useful is off.*" "Show parameter off"
-gdb_test "python print test_param.value" "False" "Test parameter value"
-gdb_test "help show print test-param" "Show whether the state of the Test Parameter does something useful.*" "Test show help"
-gdb_test "help set print test-param" "Set whether the state of the Test Parameter does something useful.*" "Test set help"
-gdb_test "help set print" "set print test-param -- Set whether the state of the Test Parameter.*" "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 __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_py_test_silent_cmd "set print test-enum-param two" "Set parameter to enum value" 1
-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 __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_py_test_silent_cmd "set test-file-param 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 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 __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 parameter value"
-gdb_test "show test-file-param" "The name of the file is \"foo.txt\".*" "Show parameter on"
-gdb_py_test_silent_cmd "set test-file-param bar.txt" "Turn off parameter" 1
-gdb_test "show test-file-param" "The name of the file is \"bar.txt\".*" "Show parameter on"
-gdb_test "python print test_file_param.value" "bar.txt" "Test parameter value"
-gdb_test "set test-file-param" "Argument required.*"
diff --git a/gdb/testsuite/gdb.python/py-parameter.exp b/gdb/testsuite/gdb.python/py-parameter.exp
index 2332fa4..1bb960d 100644
--- a/gdb/testsuite/gdb.python/py-parameter.exp
+++ b/gdb/testsuite/gdb.python/py-parameter.exp
@@ -13,7 +13,8 @@
# 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.
+# This file is part of the GDB testsuite.
+# It tests gdb.parameter and gdb.Parameter.
if $tracelevel then {
strace $tracelevel
@@ -31,3 +32,85 @@ if { [skip_python_tests] } { continue }
# We use "." here instead of ":" so that this works on win32 too.
gdb_test "python print gdb.parameter ('directories')" "$srcdir/$subdir.\\\$cdir.\\\$cwd"
+
+# 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 whether the state of the Test Parameter does something useful\"" ""\
+ " set_doc = \"Set whether the state of the Test Parameter does something useful\"" "" \
+ " 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" "Whether the state of the Test Parameter does something useful is on.*" "Show parameter on"
+gdb_py_test_silent_cmd "set print test-param off" "Turn off parameter" 1
+gdb_test "show print test-param" "Whether the state of the Test Parameter does something useful is off.*" "Show parameter off"
+gdb_test "python print test_param.value" "False" "Test parameter value"
+gdb_test "help show print test-param" "Show whether the state of the Test Parameter does something useful.*" "Test show help"
+gdb_test "help set print test-param" "Set whether the state of the Test Parameter does something useful.*" "Test set help"
+gdb_test "help set print" "set print test-param -- Set whether the state of the Test Parameter.*" "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 __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_py_test_silent_cmd "set print test-enum-param two" "Set parameter to enum value" 1
+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 __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_py_test_silent_cmd "set test-file-param 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 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 __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 parameter value"
+gdb_test "show test-file-param" "The name of the file is \"foo.txt\".*" "Show parameter on"
+gdb_py_test_silent_cmd "set test-file-param bar.txt" "Turn off parameter" 1
+gdb_test "show test-file-param" "The name of the file is \"bar.txt\".*" "Show parameter on"
+gdb_test "python print test_file_param.value" "bar.txt" "Test parameter value"
+gdb_test "set test-file-param" "Argument required.*"