This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Copy .py files to remote host
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Tue, 12 Aug 2014 21:11:43 +0800
- Subject: [PATCH] Copy .py files to remote host
- Authentication-results: sourceware.org; auth=none
Some gdb.python/*.exp tests fail because the .py files aren't copied
to the (remote) host. This patch is to copy needed .py files to host.
Most of gdb.python/*.exp tests do this.
gdb/testsuite:
2014-08-12 Yao Qi <yao@codesourcery.com>
* gdb.python/py-finish-breakpoint.exp: Copy .py file to host.
Delete the .py file on host when test is finished.
* gdb.python/py-finish-breakpoint2.exp: Likewise.
* gdb.python/python.exp: Likewise. Use .py file on the host
instead of the build.
---
gdb/testsuite/gdb.python/py-finish-breakpoint.exp | 15 ++++++++++++---
gdb/testsuite/gdb.python/py-finish-breakpoint2.exp | 6 +++++-
gdb/testsuite/gdb.python/python.exp | 13 +++++++++++--
3 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
index 43d0d81..45aa231 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
@@ -53,9 +53,6 @@ if { $gdb_py_is_py24 == 1 } {
return 0
}
-set python_file ${srcdir}/${subdir}/${testfile}.py
-
-
# Skip all tests if Python scripting is not enabled.
if { [skip_python_tests] } { continue }
@@ -71,6 +68,9 @@ if ![runto_main] then {
return 0
}
+set python_file [gdb_remote_download host \
+ ${srcdir}/${subdir}/${testfile}.py]
+
gdb_test_no_output "set confirm off" "disable confirmation"
gdb_test "source $python_file" "Python script imported.*" \
"import python scripts"
@@ -115,6 +115,7 @@ gdb_test "source $python_file" "Python script imported.*" \
set cond_line [gdb_get_line_number "Condition Break."]
if ![runto_main] then {
+ remote_file host delete ${python_file}
fail "Cannot run to main."
return 0
}
@@ -141,6 +142,7 @@ gdb_test "source $python_file" "Python script imported.*" \
"import python scripts"
if ![runto call_longjmp_1] then {
+ remote_file host delete ${python_file}
perror "couldn't run to breakpoint call_longjmp"
continue
}
@@ -168,6 +170,7 @@ gdb_test "source $python_file" "Python script imported.*" \
if ![runto_main] then {
+ remote_file host delete ${python_file}
fail "Cannot run to main."
return 0
}
@@ -193,6 +196,7 @@ gdb_test "source $python_file" "Python script imported.*" \
"import python scripts"
if ![runto_main] then {
+ remote_file host delete ${python_file}
fail "Cannot run to main."
return 0
}
@@ -220,6 +224,7 @@ gdb_test "source $python_file" "Python script imported.*" \
"import python scripts"
if ![runto_main] then {
+ remote_file host delete ${python_file}
fail "Cannot run to main."
return 0
}
@@ -247,6 +252,7 @@ gdb_test "print increase(&i)" \
#
if ![runto "test_exec_exit"] then {
+ remote_file host delete ${python_file}
fail "Cannot run to test_exec_exit."
return 0
}
@@ -260,6 +266,7 @@ gdb_test "continue" "SimpleFinishBreakpoint out of scope.*" "catch out of scope
#
if ![runto "test_exec_exit"] then {
+ remote_file host delete ${python_file}
fail "Cannot run to test_exec_exit."
return 0
}
@@ -267,3 +274,5 @@ if ![runto "test_exec_exit"] then {
gdb_test "python SimpleFinishBreakpoint(gdb.newest_frame())" "SimpleFinishBreakpoint init" "set FinishBP after the exec"
gdb_test "catch exec" "Catchpoint.*\(exec\).*" "catch exec"
gdb_test "continue" "SimpleFinishBreakpoint out of scope.*" "catch out of scope after exec"
+
+remote_file host delete ${python_file}
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp
index 95f55b7..eb2f528 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp
@@ -19,7 +19,6 @@
load_lib gdb-python.exp
standard_testfile .cc
-set pyfile ${srcdir}/${subdir}/${testfile}.py
if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
return -1
@@ -33,6 +32,9 @@ if ![runto_main] then {
return 0
}
+set pyfile [gdb_remote_download host \
+ ${srcdir}/${subdir}/${testfile}.py]
+
#
# Check FinishBreakpoints against C++ exceptions
#
@@ -53,3 +55,5 @@ gdb_test "python print (len(gdb.breakpoints()))" "3" "check finish BP removal"
gdb_test "continue" ".*Breakpoint.* throw_exception_1.*" "continue to second exception"
gdb_test "python ExceptionFinishBreakpoint(gdb.newest_frame())" "init ExceptionFinishBreakpoint" "set FinishBP after the exception"
gdb_test "continue" ".*exception did not finish.*" "FinishBreakpoint with exception thrown not caught"
+
+remote_file host delete ${pyfile}
diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index c03c284..85d0314 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -30,6 +30,9 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
+set remote_source2_py [gdb_remote_download host \
+ ${srcdir}/${subdir}/source2.py]
+
# Do this instead of the skip_python_check.
# We want to do some tests when Python is not present.
gdb_test_multiple "python print (23)" "verify python support" {
@@ -38,7 +41,7 @@ gdb_test_multiple "python print (23)" "verify python support" {
# If Python is not supported, verify that sourcing a python script
# causes an error.
- gdb_test "source $srcdir/$subdir/source2.py" \
+ gdb_test "source $remote_source2_py" \
"Error in sourced command file:.*" \
"source source2.py when python disabled"
@@ -48,6 +51,7 @@ gdb_test_multiple "python print (23)" "verify python support" {
"print (23)" "" \
"end" "not supported.*"
+ remote_file host delete ${remote_source2_py}
return -1
}
-re "$gdb_prompt $" {}
@@ -73,7 +77,7 @@ gdb_py_test_multiple "indented multi-line python command" \
"foo ()" "" \
"end" "hello, world!"
-gdb_test "source $srcdir/$subdir/source2.py" "yes" "source source2.py"
+gdb_test "source $remote_source2_py" "yes" "source source2.py"
gdb_test "source -s source2.py" "yes" "source -s source2.py"
@@ -171,6 +175,7 @@ clean_restart ${testfile}
# The following tests require execution.
if ![runto_main] then {
+ remote_file host delete ${remote_source2_py}
fail "Can't run to main"
return 0
}
@@ -333,6 +338,7 @@ clean_restart ${testfile}
# The following tests require execution.
if ![runto_main] then {
+ remote_file host delete ${remote_source2_py}
fail "Can't run to main"
return 0
}
@@ -389,6 +395,7 @@ clean_restart ${testfile}
# The following tests require execution.
if ![runto_main] then {
+ remote_file host delete ${remote_source2_py}
fail "Can't run to main"
return 0
}
@@ -402,3 +409,5 @@ gdb_py_test_silent_cmd "step" "Step into func2" 1
gdb_py_test_silent_cmd "up" "Step out of func2" 1
gdb_test "python print (gdb.find_pc_line(gdb.selected_frame().pc()).line > line)" "True" "Test find_pc_line with resume address"
+
+remote_file host delete ${remote_source2_py}
--
1.9.0