[gdb/testsuite] Split up multi-exec test-cases
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / checkpoint.exp
index 2de24398aa3b558b253afe4f36596b75c262fb5f..86b098aa1b51546557daf142e8a7c8b9911a252f 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright 2005-2014 Free Software Foundation, Inc.
+#   Copyright 2005-2020 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-if { [is_remote target] || ![isnative] } then {
-    continue
-}
-
 # Until "set follow-fork-mode" and "catch fork" are implemented on
 # other targets...
 #
@@ -24,8 +20,16 @@ if {![istarget "*-*-linux*"]} then {
     continue
 }
 
+# Checkpoint support is currently implemented in the Linux native
+# target, so only works with "target native".
+if { [target_info gdb_protocol] != "" } {
+    continue
+}
 
-standard_testfile .c
+# Must name the source file explicitly, otherwise when driven by
+# checkpoints-ns.exp, we'd try compiling checkpoints-ns.c, which
+# doesn't exist.
+standard_testfile checkpoint.c
 
 set pi_txt [gdb_remote_download host ${srcdir}/${subdir}/pi.txt]
 if {[is_remote host]} {
@@ -34,9 +38,8 @@ if {[is_remote host]} {
     set copy1_txt [standard_output_file copy1.txt]
 }
 
-if {[prepare_for_testing ${testfile}.exp $testfile $srcfile \
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
         [list debug "additional_flags=-DPI_TXT=\"$pi_txt\" -DCOPY1_TXT=\"$copy1_txt\""]]} {
-     untested checkpoint.exp
      return -1
 }
 
@@ -85,7 +88,7 @@ gdb_test "continue 10" "breakpoint 1.*" "break1 ten"
 gdb_test "checkpoint" ".*" ""
 
 gdb_test "info checkpoints" \
-    " 10 .* 9 .* 8 .* 7 .* 6 .* 5 .* 4 .* 3 .* 2 .* 1 .*" \
+    " 1 .* 2 .* 3 .* 4 .* 5 .* 6 .* 7 .* 8 .* 9 .* 10 .*" \
     "info checkpoints one"
 
 delete_breakpoints
@@ -152,7 +155,7 @@ gdb_test "continue" "breakpoint 3.*" "break3 one"
 
 gdb_test "shell diff -s $pi_txt $copy1_txt" \
     "Files .*pi.txt and .*copy1.txt are identical.*" \
-    "Diff input and output one"
+    "diff input and output one"
 
 #
 # And now run from various checkpoints, allowing 
@@ -205,7 +208,7 @@ gdb_test "print lines" " = 1162.*" "verify lines 7 two"
 
 gdb_test "shell diff -s $pi_txt $copy1_txt" \
     "Files .*pi.txt and .*copy1.txt are identical.*" \
-    "Diff input and output two"
+    "diff input and output two"
 
 # 
 # OK, now allow the original program to delete the output file, 
@@ -223,45 +226,11 @@ gdb_test "shell diff $pi_txt $copy1_txt" \
 delete_breakpoints
 gdb_breakpoint $break2_loc
 
-gdb_test "restart 1" "if .c == EOF.*" "restart 1 three"
-gdb_test "continue" "breakpoint 2.*" "break2 1 one"
-gdb_test "print ftell (out) > 100000" " = 1.*" "outfile still open 1"
-
-gdb_test "restart 2" "if .c == EOF.*" "restart 2 three"
-gdb_test "continue" "breakpoint 2.*" "break2 2 one"
-gdb_test "print ftell (out) > 100000" " = 1.*" "outfile still open 2"
-
-gdb_test "restart 3" "if .c == EOF.*" "restart 3 three"
-gdb_test "continue" "breakpoint 2.*" "break2 3 one"
-gdb_test "print ftell (out) > 100000" " = 1.*" "outfile still open 3"
-
-gdb_test "restart 4" "if .c == EOF.*" "restart 4 three"
-gdb_test "continue" "breakpoint 2.*" "break2 4 one"
-gdb_test "print ftell (out) > 100000" " = 1.*" "outfile still open 4"
-
-gdb_test "restart 5" "if .c == EOF.*" "restart 5 three"
-gdb_test "continue" "breakpoint 2.*" "break2 5 one"
-gdb_test "print ftell (out) > 100000" " = 1.*" "outfile still open 5"
-
-gdb_test "restart 6" "if .c == EOF.*" "restart 6 three"
-gdb_test "continue" "breakpoint 2.*" "break2 6 one"
-gdb_test "print ftell (out) > 100000" " = 1.*" "outfile still open 6"
-
-gdb_test "restart 7" "if .c == EOF.*" "restart 7 three"
-gdb_test "continue" "breakpoint 2.*" "break2 7 one"
-gdb_test "print ftell (out) > 100000" " = 1.*" "outfile still open 7"
-
-gdb_test "restart 8" "if .c == EOF.*" "restart 8 three"
-gdb_test "continue" "breakpoint 2.*" "break2 8 one"
-gdb_test "print ftell (out) > 100000" " = 1.*" "outfile still open 8"
-
-gdb_test "restart 9" "if .c == EOF.*" "restart 9 three"
-gdb_test "continue" "breakpoint 2.*" "break2 9 one"
-gdb_test "print ftell (out) > 100000" " = 1.*" "outfile still open 9"
-
-gdb_test "restart 10" "if .c == EOF.*" "restart 10 three"
-gdb_test "continue" "breakpoint 2.*" "break2 10 one"
-gdb_test "print ftell (out) > 100000" " = 1.*" "outfile still open 10"
+for {set num 1} {$num <= 10} {incr num} {
+    gdb_test "restart $num" "if .c == EOF.*" "restart $num three"
+    gdb_test "continue" "breakpoint 2.*" "break2 $num one"
+    gdb_test "print (long) ftell (out) > 100000" " = 1.*" "outfile still open $num"
+}
 
 #
 # Now confirm that if one fork exits, we automatically switch to another one.
@@ -270,29 +239,29 @@ gdb_test "print ftell (out) > 100000" " = 1.*" "outfile still open 10"
 delete_breakpoints
 gdb_test "continue" \
     "Deleting copy.*$inferior_exited_re normally.*Switching to.*" \
-    "Exit, dropped into next fork one"
+    "exit, dropped into next fork one"
 
 gdb_test "continue" \
     "Deleting copy.*$inferior_exited_re normally.*Switching to.*" \
-    "Exit, dropped into next fork two"
+    "exit, dropped into next fork two"
 
 gdb_test "continue" \
     "Deleting copy.*$inferior_exited_re normally.*Switching to.*" \
-    "Exit, dropped into next fork three"
+    "exit, dropped into next fork three"
 
 gdb_test "continue" \
     "Deleting copy.*$inferior_exited_re normally.*Switching to.*" \
-    "Exit, dropped into next fork four"
+    "exit, dropped into next fork four"
 
 gdb_test "continue" \
     "Deleting copy.*$inferior_exited_re normally.*Switching to.*" \
-    "Exit, dropped into next fork five"
+    "exit, dropped into next fork five"
 
 #
 # There should be still at least five forks left
 # 
 
-gdb_test "info checkpoints" " 5 .* 4 .* 3 .* 2 .* 1 .*" \
+gdb_test "info checkpoints" " 1 .* 2 .* 3 .* 4 .* 5 .*" \
     "info checkpoints two"
 
 #
This page took 0.031682 seconds and 4 git commands to generate.