aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2010-01-18 06:31:24 +0000
committerJoel Brobecker <brobecker@gnat.com>2010-01-18 06:31:24 +0000
commit9e14a9ba25afb7116d7220271973cd11fe2d6902 (patch)
tree6e115a8061ce5c739e25d15fd218258b5f28fe00 /gdb
parent8150ff9c32f8cdd49dc8abe4ec15c48185c0924b (diff)
downloadgdb-9e14a9ba25afb7116d7220271973cd11fe2d6902.zip
gdb-9e14a9ba25afb7116d7220271973cd11fe2d6902.tar.gz
gdb-9e14a9ba25afb7116d7220271973cd11fe2d6902.tar.bz2
* gdb.python/source2.py: New file.
* gdb.python/source1: New file. * gdb.python/python.exp: Test "source" command.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/gdb.python/python.exp6
-rw-r--r--gdb/testsuite/gdb.python/source119
-rw-r--r--gdb/testsuite/gdb.python/source2.py18
4 files changed, 50 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 79b5759..3611875 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2010-01-18 Tom Tromey <tromey@redhat.com>
+ Thiago Jung Bauermann <bauerman@br.ibm.com>
+
+ * gdb.python/source2.py: New file.
+ * gdb.python/source1: New file.
+ * gdb.python/python.exp: Test "source" command.
+
2010-01-15 Stan Shebs <stan@codesourcery.com>
* gdb.trace/tfile.c: New file.
diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index 951c295..b345ad2 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -29,6 +29,10 @@ gdb_reinitialize_dir $srcdir/$subdir
gdb_test_multiple "python print 23" "verify python support" {
-re "not supported.*$gdb_prompt $" {
unsupported "python support is disabled"
+
+ # If Python is not supported, verify that sourcing a python script
+ # causes an error.
+ gdb_test "source $srcdir/$subdir/source2.py" "Error in sourced command file:.*"
return -1
}
-re "$gdb_prompt $" {}
@@ -72,5 +76,7 @@ gdb_py_test_multiple "indented multi-line python command" \
"foo ()" "" \
"end" "hello, world!"
+gdb_test "source $srcdir/$subdir/source2.py" "yes"
+
gdb_test "python print gdb.current_objfile()" "None"
gdb_test "python print gdb.objfiles()" "\\\[\\\]"
diff --git a/gdb/testsuite/gdb.python/source1 b/gdb/testsuite/gdb.python/source1
new file mode 100644
index 0000000..f9c19bd
--- /dev/null
+++ b/gdb/testsuite/gdb.python/source1
@@ -0,0 +1,19 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2008, 2009, 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 is sourced as python; pick an expression that is not valid for gdb.
+print 'y%ss' % 'e'
diff --git a/gdb/testsuite/gdb.python/source2.py b/gdb/testsuite/gdb.python/source2.py
new file mode 100644
index 0000000..4e9a9e3
--- /dev/null
+++ b/gdb/testsuite/gdb.python/source2.py
@@ -0,0 +1,18 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2008, 2009, 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/>.
+
+print 'y%ss' % 'e'