Update copyright year range in all GDB files
[external/binutils.git] / gdb / testsuite / gdb.python / py-finish-breakpoint.exp
index d521021..63074ba 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2012 Free Software Foundation, Inc.
+# Copyright (C) 2011-2018 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
@@ -17,7 +17,7 @@
 # exposing values to Python.
 
 if {[skip_shlib_tests]} {
-       untested py-finish-breakpoint.exp
+       untested "skipping shared library tests"
     return 0
 }
 
@@ -37,15 +37,21 @@ if [get_compiler_info] {
 
 if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
      || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != ""} {
-    untested "Could not compile either $libsrc or $srcdir/$subdir/$srcfile."
+    untested "failed to compile"
     return -1
 }
 
 # Start with a fresh gdb.
 clean_restart ${testfile}
 
-set python_file ${srcdir}/${subdir}/${testfile}.py
+if { [skip_python_tests] } { continue }
 
+if { $gdb_py_is_py24 == 1 } {
+    # Python 2.4, 2.5 do not support the "ValueError as e" syntax used in
+    # the py-finish-breakpoint.py script.
+       untested "missing support on Python 2.4 and 2.5"
+    return 0
+}
 
 # Skip all tests if Python scripting is not enabled.
 if { [skip_python_tests] } { continue }
@@ -55,13 +61,16 @@ if { [skip_python_tests] } { continue }
 #
 
 clean_restart ${testfile}
-gdb_load_shlibs ${lib_sl}
+gdb_load_shlib ${lib_sl}
 
 if ![runto_main] then {
-    fail "Cannot run to main."
+    fail "cannot run to main."
     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"
@@ -74,17 +83,17 @@ gdb_test "python finishbp_default = gdb.FinishBreakpoint ()" \
          "Temporary breakpoint.*" "set FinishBreakpoint with default frame value"
 gdb_test "python finishbp = MyFinishBreakpoint (gdb.parse_and_eval ('a'), gdb.newest_frame ())" \
          "Temporary breakpoint.*" "set FinishBreakpoint"
-gdb_test "python print finishbp.return_value" "None.*" \
+gdb_test "python print (finishbp.return_value)" "None.*" \
          "check return_value at init"
 
 # check normal bp hit
 
 gdb_test "continue" "MyFinishBreakpoint stop with.*return_value is: -5.*#0.*increase.*" \
          "check MyFinishBreakpoint hit"
-gdb_test "python print finishbp.return_value" "-5.*" "check return_value"
+gdb_test "python print (finishbp.return_value)" "-5.*" "check return_value"
 
-gdb_test "python print finishbp_default.hit_count" "1.*" "check finishBP on default frame has been hit"
-gdb_test "python print finishbp.is_valid()" "False.*"\
+gdb_test "python print (finishbp_default.hit_count)" "1.*" "check finishBP on default frame has been hit"
+gdb_test "python print (finishbp.is_valid())" "False.*"\
          "ensure that finish bp is invalid afer normal hit"
 
 # check FinishBreakpoint in main no allowed
@@ -99,14 +108,14 @@ gdb_test "python MyFinishBreakpoint (None, gdb.selected_frame ())" \
 #
 
 clean_restart ${testfile}
-gdb_load_shlibs ${lib_sl}
+gdb_load_shlib ${lib_sl}
 
 gdb_test "source $python_file" "Python script imported.*" \
          "import python scripts"
 set cond_line [gdb_get_line_number "Condition Break."]
 
 if ![runto_main] then {
-    fail "Cannot run to main."
+    fail "cannot run to main."
     return 0
 }
 
@@ -119,14 +128,14 @@ gdb_test "python finishBP = SimpleFinishBreakpoint(gdb.newest_frame())" \
          "SimpleFinishBreakpoint init" \
          "set finish breakpoint"
 gdb_test "continue" "SimpleFinishBreakpoint stop.*" "check FinishBreakpoint hit"
-gdb_test "python print finishBP.return_value" "None" "check return value without debug symbol"
+gdb_test "python print (finishBP.return_value)" "None" "check return value without debug symbol"
 
 #
 # Test FinishBreakpoint in function returned by longjmp 
 #
 
 clean_restart ${testfile}
-gdb_load_shlibs ${lib_sl}
+gdb_load_shlib ${lib_sl}
 
 gdb_test "source $python_file" "Python script imported.*" \
          "import python scripts"
@@ -143,7 +152,7 @@ gdb_test "break [gdb_get_line_number "after longjmp."]" "Breakpoint.* at .*" \
          "set BP after the jump"
 gdb_test "continue" "SimpleFinishBreakpoint out of scope.*" \
          "check FinishBP out of scope notification"
-gdb_test "python print finishbp.is_valid()" "False.*"\
+gdb_test "python print (finishbp.is_valid())" "False.*"\
          "ensure that finish bp is invalid afer out of scope notification"
 
 #
@@ -152,14 +161,14 @@ gdb_test "python print finishbp.is_valid()" "False.*"\
 #
 
 clean_restart ${testfile}
-gdb_load_shlibs ${lib_sl}
+gdb_load_shlib ${lib_sl}
 
 gdb_test "source $python_file" "Python script imported.*" \
          "import python scripts"
 
 
 if ![runto_main] then {
-    fail "Cannot run to main."
+    fail "cannot run to main."
     return 0
 }
          
@@ -178,13 +187,13 @@ gdb_test "print i" "8" "check stopped location"
 #
 
 clean_restart ${testfile}
-gdb_load_shlibs ${lib_sl}
+gdb_load_shlib ${lib_sl}
 
 gdb_test "source $python_file" "Python script imported.*" \
          "import python scripts"
 
 if ![runto_main] then {
-    fail "Cannot run to main."
+    fail "cannot run to main."
     return 0
 }
 
@@ -205,13 +214,13 @@ gdb_test "print i" "8" "check stopped location"
 #
 
 clean_restart ${testfile}
-gdb_load_shlibs ${lib_sl}
+gdb_load_shlib ${lib_sl}
 
 gdb_test "source $python_file" "Python script imported.*" \
          "import python scripts"
 
 if ![runto_main] then {
-    fail "Cannot run to main."
+    fail "cannot run to main."
     return 0
 }
 
@@ -238,7 +247,7 @@ gdb_test "print increase(&i)" \
 #
 
 if ![runto "test_exec_exit"] then {
-    fail "Cannot run to test_exec_exit."
+    fail "cannot run to test_exec_exit."
     return 0
 }
 
@@ -251,7 +260,7 @@ gdb_test "continue" "SimpleFinishBreakpoint out of scope.*" "catch out of scope
 #
 
 if ![runto "test_exec_exit"] then {
-    fail "Cannot run to test_exec_exit."
+    fail "cannot run to test_exec_exit."
     return 0
 }