summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-08-22 13:51:07 +0000
committerTom Tromey <tromey@redhat.com>2013-08-22 13:51:07 +0000
commite72ae2219f5ee66107bb22f5bfd9d3a3629a3e5e (patch)
tree8bce75733926f58e1b93972e2ca1291a1296bcc3 /gdb/testsuite/gdb.python
parent9668b9fd28fdde7939197a5c156db0deed6fc7bc (diff)
downloadgdb-e72ae2219f5ee66107bb22f5bfd9d3a3629a3e5e.tar.gz
fix gdb.python to be parallel-safe
This fixes gdb.python to be parallel-safe, mostly by changing it to use gdb_remote_download. Tested on x86-64 Fedora 18. * gdb.python/py-error.exp: Use gdb_remote_download. * gdb.python/py-mi.exp: Use gdb_remote_download. * gdb.python/py-objfile-script.exp: Use standard_output_file. * gdb.python/py-prettyprint.exp: Use gdb_remote_download. (run_lang_tests): Likewise. * gdb.python/py-section-script.c: Use SCRIPT_FILE rather than filename. * gdb.python/py-section-script.exp: Set SCRIPT_FILE when compiling. Use gdb_remote_download. Update some tests. * gdb.python/py-strfns.exp (test_strfns_core_file): Use standard_output_file. * gdb.python/py-typeprint.exp: Use gdb_remote_download. * gdb.python/py-frame-args.exp: Use gdb_remote_download. * gdb.python/py-framefilter-mi.exp: Use gdb_remote_download. * gdb.python/py-framefilter.exp: Use gdb_remote_download, standard_output_file.
Diffstat (limited to 'gdb/testsuite/gdb.python')
-rw-r--r--gdb/testsuite/gdb.python/py-error.exp3
-rw-r--r--gdb/testsuite/gdb.python/py-frame-args.exp6
-rw-r--r--gdb/testsuite/gdb.python/py-framefilter-mi.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-framefilter.exp10
-rw-r--r--gdb/testsuite/gdb.python/py-mi.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-objfile-script.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-prettyprint.exp12
-rw-r--r--gdb/testsuite/gdb.python/py-section-script.c2
-rw-r--r--gdb/testsuite/gdb.python/py-section-script.exp18
-rw-r--r--gdb/testsuite/gdb.python/py-strfns.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-typeprint.exp6
11 files changed, 43 insertions, 26 deletions
diff --git a/gdb/testsuite/gdb.python/py-error.exp b/gdb/testsuite/gdb.python/py-error.exp
index a204302d468..922798d6eb9 100644
--- a/gdb/testsuite/gdb.python/py-error.exp
+++ b/gdb/testsuite/gdb.python/py-error.exp
@@ -48,7 +48,8 @@ if {$test2 == ""} {
return 0
}
-set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
+set remote_python_file [gdb_remote_download host \
+ ${srcdir}/${subdir}/${testfile}.py]
# argc=LookupError: unknown encoding: IBM1047
gdb_test "source $remote_python_file" "Traceback.*ClassName.*\r\nLookupError: unknown encoding: $charset" $test2
diff --git a/gdb/testsuite/gdb.python/py-frame-args.exp b/gdb/testsuite/gdb.python/py-frame-args.exp
index ff082dda9ec..be6defdacc4 100644
--- a/gdb/testsuite/gdb.python/py-frame-args.exp
+++ b/gdb/testsuite/gdb.python/py-frame-args.exp
@@ -26,9 +26,11 @@ if ![runto_main] {
return -1
}
-set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
+set remote_python_file [gdb_remote_download host \
+ ${srcdir}/${subdir}/${testfile}.py]
-gdb_test_no_output "python exec (open ('${remote_python_file}').read ())"
+gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
+ "python exec (open ('[file tail ${remote_python_file}]').read ())"
gdb_breakpoint [gdb_get_line_number "break-here"]
gdb_continue_to_breakpoint "break-here" ".* break-here .*"
diff --git a/gdb/testsuite/gdb.python/py-framefilter-mi.exp b/gdb/testsuite/gdb.python/py-framefilter-mi.exp
index 54fedf82ec2..8228a911150 100644
--- a/gdb/testsuite/gdb.python/py-framefilter-mi.exp
+++ b/gdb/testsuite/gdb.python/py-framefilter-mi.exp
@@ -44,7 +44,7 @@ if {[lsearch -exact [mi_get_features] python] < 0} {
mi_runto main
-set remote_python_file [remote_download host ${srcdir}/${subdir}/${pyfile}]
+set remote_python_file [gdb_remote_download host ${srcdir}/${subdir}/${pyfile}]
mi_gdb_test "python execfile ('${remote_python_file}')" ".*\\^done." \
"Load python file"
diff --git a/gdb/testsuite/gdb.python/py-framefilter.exp b/gdb/testsuite/gdb.python/py-framefilter.exp
index 6c9946bb0fc..be5a4795460 100644
--- a/gdb/testsuite/gdb.python/py-framefilter.exp
+++ b/gdb/testsuite/gdb.python/py-framefilter.exp
@@ -39,7 +39,7 @@ if { [skip_python_tests] } { continue }
set remote_obj_python_file \
[remote_download \
host ${srcdir}/${subdir}/${testfile}-gdb.py.in \
- ${subdir}/${testfile}-gdb.py]
+ [standard_output_file ${testfile}-gdb.py]]
gdb_reinitialize_dir $srcdir/$subdir
gdb_test_no_output "set auto-load safe-path ${remote_obj_python_file}" \
@@ -57,7 +57,8 @@ gdb_test_no_output "set python print-stack full" \
"Set python print-stack to full"
# Load global frame-filters
-set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
+set remote_python_file [gdb_remote_download host \
+ ${srcdir}/${subdir}/${testfile}.py]
gdb_test_no_output "python execfile ('${remote_python_file}')" \
"Load python file"
@@ -199,7 +200,7 @@ if { [skip_python_tests] } { continue }
set remote_obj_python_file \
[remote_download \
host ${srcdir}/${subdir}/${testfile}-gdb.py.in \
- ${subdir}/${testfile}-gdb.py]
+ [standard_output_file ${testfile}-gdb.py]]
gdb_reinitialize_dir $srcdir/$subdir
gdb_test_no_output "set auto-load safe-path ${remote_obj_python_file}" \
@@ -218,7 +219,8 @@ gdb_test_no_output "set python print-stack full" \
"set python print-stack full for no debuginfo tests"
# Load global frame-filters
-set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
+set remote_python_file [gdb_remote_download host \
+ ${srcdir}/${subdir}/${testfile}.py]
gdb_test_no_output "python execfile ('${remote_python_file}')" \
"Load python file for no debuginfo tests"
diff --git a/gdb/testsuite/gdb.python/py-mi.exp b/gdb/testsuite/gdb.python/py-mi.exp
index ae8bfe569f1..28aa2c8b556 100644
--- a/gdb/testsuite/gdb.python/py-mi.exp
+++ b/gdb/testsuite/gdb.python/py-mi.exp
@@ -42,7 +42,7 @@ if {[lsearch -exact [mi_get_features] python] < 0} {
mi_runto main
-set remote_python_file [remote_download host ${srcdir}/${subdir}/${pyfile}]
+set remote_python_file [gdb_remote_download host ${srcdir}/${subdir}/${pyfile}]
mi_gdb_test "python exec (open ('${remote_python_file}').read ())" ""
diff --git a/gdb/testsuite/gdb.python/py-objfile-script.exp b/gdb/testsuite/gdb.python/py-objfile-script.exp
index 097de49b337..f75b9ba139c 100644
--- a/gdb/testsuite/gdb.python/py-objfile-script.exp
+++ b/gdb/testsuite/gdb.python/py-objfile-script.exp
@@ -32,7 +32,9 @@ if { [skip_python_tests] } { continue }
# Make the -gdb.py script available to gdb, it is automagically loaded by gdb.
# Care is taken to put it in the same directory as the binary so that
# gdb will find it.
-set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}-gdb.py.in ${subdir}/${testfile}-gdb.py]
+set remote_python_file [remote_download host \
+ ${srcdir}/${subdir}/${testfile}-gdb.py.in \
+ [standard_output_file ${testfile}-gdb.py]]
gdb_reinitialize_dir $srcdir/$subdir
gdb_test_no_output "set auto-load safe-path ${remote_python_file}" "set auto-load safe-path"
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp
index b7dd5b79faf..d124a7261e2 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.exp
+++ b/gdb/testsuite/gdb.python/py-prettyprint.exp
@@ -53,9 +53,11 @@ proc run_lang_tests {exefile lang} {
".*Breakpoint.*"
gdb_test "continue" ".*Breakpoint.*"
- set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
+ set remote_python_file [gdb_remote_download host \
+ ${srcdir}/${subdir}/${testfile}.py]
- gdb_test_no_output "python exec (open ('${remote_python_file}').read ())"
+ gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
+ "python exec (open ('[file tail ${remote_python_file}]').read ())"
gdb_test "print ss" " = a=< a=<1> b=<$hex>> b=< a=<2> b=<$hex>>"
gdb_test "print ssa\[1\]" " = a=< a=<5> b=<$hex>> b=< a=<6> b=<$hex>>"
@@ -123,9 +125,11 @@ if ![runto_main ] then {
return
}
-set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
+set remote_python_file [gdb_remote_download host \
+ ${srcdir}/${subdir}/${testfile}.py]
-gdb_test_no_output "python exec (open ('${remote_python_file}').read ())"
+gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
+ "python exec (open ('[file tail ${remote_python_file}]').read ())"
gdb_breakpoint [gdb_get_line_number "eval-break"]
gdb_continue_to_breakpoint "eval-break" ".* eval-break .*"
diff --git a/gdb/testsuite/gdb.python/py-section-script.c b/gdb/testsuite/gdb.python/py-section-script.c
index ebe7b9b2fe3..db1daea47d3 100644
--- a/gdb/testsuite/gdb.python/py-section-script.c
+++ b/gdb/testsuite/gdb.python/py-section-script.c
@@ -26,7 +26,7 @@
.popsection \n\
");
-DEFINE_GDB_SCRIPT ("py-section-script.py")
+DEFINE_GDB_SCRIPT (SCRIPT_FILE)
struct ss
{
diff --git a/gdb/testsuite/gdb.python/py-section-script.exp b/gdb/testsuite/gdb.python/py-section-script.exp
index 7f710d34132..66f1117b830 100644
--- a/gdb/testsuite/gdb.python/py-section-script.exp
+++ b/gdb/testsuite/gdb.python/py-section-script.exp
@@ -31,7 +31,15 @@ if {![istarget *-*-linux*]
standard_testfile
-if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
+# Make this available to gdb before the program starts, it is
+# automagically loaded by gdb.
+set remote_python_file [gdb_remote_download host \
+ ${srcdir}/${subdir}/${testfile}.py]
+
+set quoted_name "\"$remote_python_file\""
+
+if {[build_executable $testfile.exp $testfile $srcfile \
+ [list debug additional_flags=-DSCRIPT_FILE=$quoted_name]] == -1} {
return -1
}
@@ -42,18 +50,14 @@ gdb_start
# Skip all tests if Python scripting is not enabled.
if { [skip_python_tests] } { continue }
-# Make this available to gdb before the program starts, it is
-# automagically loaded by gdb.
-set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
-
gdb_reinitialize_dir $srcdir/$subdir
gdb_test_no_output "set auto-load safe-path ${remote_python_file}" "set auto-load safe-path"
gdb_load ${binfile}
# Verify gdb loaded the script.
-gdb_test "info auto-load python-scripts" "Yes.*${testfile}.py.*full name: .*/${testfile}.py.*"
+gdb_test "info auto-load python-scripts" "Yes.*${testfile}.py.*"
# Again, with a regexp this time.
-gdb_test "info auto-load python-scripts ${testfile}" "Yes.*${testfile}.py.*full name: .*/${testfile}.py.*"
+gdb_test "info auto-load python-scripts ${testfile}" "Yes.*${testfile}.py.*"
# Again, with a regexp that matches no scripts.
gdb_test "info auto-load python-scripts no-script-matches-this" \
"No auto-load scripts matching no-script-matches-this."
diff --git a/gdb/testsuite/gdb.python/py-strfns.exp b/gdb/testsuite/gdb.python/py-strfns.exp
index 9d785188570..daeb852bb75 100644
--- a/gdb/testsuite/gdb.python/py-strfns.exp
+++ b/gdb/testsuite/gdb.python/py-strfns.exp
@@ -64,9 +64,9 @@ gdb_test "p /d {char\[4\]} arg" "= \\{0, 1, 2, 4\\}"
# Verify use on a core file.
proc test_strfns_core_file { } {
- global objdir subdir gdb_prompt testfile
+ global gdb_prompt testfile
- set filename "${objdir}/${subdir}/py-strfns.core"
+ set filename [standard_output_file py-strfns.core]
if {![gdb_gcore_cmd "$filename" "save a corefile"]} {
# No use proceeding from here.
diff --git a/gdb/testsuite/gdb.python/py-typeprint.exp b/gdb/testsuite/gdb.python/py-typeprint.exp
index 5e2a23807f9..8e1b3792b34 100644
--- a/gdb/testsuite/gdb.python/py-typeprint.exp
+++ b/gdb/testsuite/gdb.python/py-typeprint.exp
@@ -26,9 +26,11 @@ if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
if { [skip_python_tests] } { continue }
-set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
+set remote_python_file [gdb_remote_download host \
+ ${srcdir}/${subdir}/${testfile}.py]
-gdb_test_no_output "python exec (open ('${remote_python_file}').read ())"
+gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
+ "python exec (open ('[file tail ${remote_python_file}]').read ())"
cp_test_ptype_class s "basic test" "class" "templ<string>" {
{ field public "T x;" }