X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Ftestsuite%2Fgdb.base%2Fcheckpoint.exp;h=73ea08a92c867ab450efbb631d663b8f8a873d9d;hb=84c93cd5f1ff869eb8c04314738eaa2cddb3c29e;hp=bf65c7a832199ed6c512a8cc25d05b6a54ca9b9e;hpb=9b254dd1ce46c19dde1dde5b8d1e22e862dfacce;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/testsuite/gdb.base/checkpoint.exp b/gdb/testsuite/gdb.base/checkpoint.exp index bf65c7a832..73ea08a92c 100644 --- a/gdb/testsuite/gdb.base/checkpoint.exp +++ b/gdb/testsuite/gdb.base/checkpoint.exp @@ -1,4 +1,4 @@ -# Copyright 2005, 2007, 2008 Free Software Foundation, Inc. +# Copyright 2005-2016 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 @@ -13,13 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . */ -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - -if $tracelevel then { - strace $tracelevel - } - if { [is_remote target] || ![isnative] } then { continue } @@ -31,33 +24,30 @@ if {![istarget "*-*-linux*"]} then { continue } -set prms_id 0 -set bug_id 0 +# 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 testfile "checkpoint" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +set pi_txt [gdb_remote_download host ${srcdir}/${subdir}/pi.txt] +if {[is_remote host]} { + set copy1_txt copy1.txt +} else { + set copy1_txt [standard_output_file copy1.txt] +} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested checkpoint.exp +if {[prepare_for_testing ${testfile}.exp $testfile $srcfile \ + [list debug "additional_flags=-DPI_TXT=\"$pi_txt\" -DCOPY1_TXT=\"$copy1_txt\""]]} { + untested "failed to compile" return -1 } -# Start with a fresh gdb - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} - global gdb_prompt # # This tests gdb checkpoint and restart. # -remote_download host ${srcdir}/${subdir}/pi.txt pi.txt - runto_main set break1_loc [gdb_get_line_number "breakpoint 1"] set break2_loc [gdb_get_line_number "breakpoint 2"] @@ -67,37 +57,37 @@ set break4_loc [gdb_get_line_number "breakpoint 4"] gdb_breakpoint $break1_loc gdb_test "continue" "breakpoint 1.*" "break1 start" -gdb_test "checkpoint" "" "" +gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 two" -gdb_test "checkpoint" "" "" +gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 three" -gdb_test "checkpoint" "" "" +gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 four" -gdb_test "checkpoint" "" "" +gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 five" -gdb_test "checkpoint" "" "" +gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 six" -gdb_test "checkpoint" "" "" +gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 seven" -gdb_test "checkpoint" "" "" +gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 eight" -gdb_test "checkpoint" "" "" +gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 nine" -gdb_test "checkpoint" "" "" +gdb_test "checkpoint" ".*" "" gdb_test "continue 10" "breakpoint 1.*" "break1 ten" -gdb_test "checkpoint" "" "" +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 @@ -162,9 +152,9 @@ gdb_test "restart 0" "Switching to .*breakpoint 2.*" "restart 0 one" gdb_breakpoint $break3_loc 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" +gdb_test "shell diff -s $pi_txt $copy1_txt" \ + "Files .*pi.txt and .*copy1.txt are identical.*" \ + "diff input and output one" # # And now run from various checkpoints, allowing @@ -174,50 +164,50 @@ gdb_test "shell diff -s pi.txt copy1.txt" \ gdb_breakpoint $break1_loc gdb_test "restart 1" "Switching to .*c == EOF.*" "restart 1 two" -gdb_test "continue" "" "" +gdb_test "continue" ".*" "" gdb_test "continue 100" "breakpoint 1.*" "breakpoint 1 1 one" gdb_test "step" "if .c == EOF.*" "step in 1 two" gdb_test "print lines" " = 102.*" "verify lines 1 two" gdb_test "restart 2" "Switching to .*c == EOF.*" "restart 2 two" -gdb_test "continue" "" "" +gdb_test "continue" ".*" "" gdb_test "continue 100" "breakpoint 1.*" "breakpoint 1 2 one" gdb_test "step" "if .c == EOF.*" "step in 2 two" gdb_test "print lines" " = 112.*" "verify lines 2 two" gdb_test "restart 3" "Switching to .*c == EOF.*" "restart 3 two" -gdb_test "continue" "" "" +gdb_test "continue" ".*" "" gdb_test "continue 500" "breakpoint 1.*" "breakpoint 1 3 one" gdb_test "step" "if .c == EOF.*" "step in 3 two" gdb_test "print lines" " = 522.*" "verify lines 3 two" gdb_test "restart 4" "Switching to .*c == EOF.*" "restart 4 two" -gdb_test "continue" "" "" +gdb_test "continue" ".*" "" gdb_test "continue 500" "breakpoint 1.*" "breakpoint 1 4 one" gdb_test "step" "if .c == EOF.*" "step in 4 two" gdb_test "print lines" " = 532.*" "verify lines 4 two" gdb_test "restart 5" "Switching to .*c == EOF.*" "restart 5 two" -gdb_test "continue" "" "" +gdb_test "continue" ".*" "" gdb_test "continue 1000" "breakpoint 1.*" "breakpoint 1 5 one" gdb_test "step" "if .c == EOF.*" "step in 5 two" gdb_test "print lines" " = 1042.*" "verify lines 5 two" gdb_test "restart 6" "Switching to .*c == EOF.*" "restart 6 two" -gdb_test "continue" "" "" +gdb_test "continue" ".*" "" gdb_test "continue 1000" "breakpoint 1.*" "breakpoint 1 6 one" gdb_test "step" "if .c == EOF.*" "step in 6 two" gdb_test "print lines" " = 1052.*" "verify lines 5 two" gdb_test "restart 7" "Switching to .*c == EOF.*" "restart 7 two" -gdb_test "continue" "" "" +gdb_test "continue" ".*" "" gdb_test "continue 1100" "breakpoint 1.*" "breakpoint 1 7 one" gdb_test "step" "if .c == EOF.*" "step in 7 two" 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" +gdb_test "shell diff -s $pi_txt $copy1_txt" \ + "Files .*pi.txt and .*copy1.txt are identical.*" \ + "diff input and output two" # # OK, now allow the original program to delete the output file, @@ -228,8 +218,8 @@ gdb_test "restart 0" "Switching to .*breakpoint 3.*" "restart 0 one" gdb_breakpoint $break4_loc gdb_test "continue" "breakpoint 4.*" "break4 one" -gdb_test "shell diff pi.txt copy1.txt" \ - "diff: copy1.txt: No such file or directory" \ +gdb_test "shell diff $pi_txt $copy1_txt" \ + "diff: .*copy1.txt: No such file or directory" \ "delete copy1" delete_breakpoints @@ -239,39 +229,39 @@ 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 1 three" +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 1 three" +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 1 three" +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 1 three" +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 1 three" +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 1 three" +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 1 three" +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 1 three" +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 1 three" +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" @@ -281,30 +271,30 @@ gdb_test "print ftell (out) > 100000" " = 1.*" "outfile still open 10" delete_breakpoints gdb_test "continue" \ - "Deleting copy.*Program exited normally.*Switching to.*" \ - "Exit, dropped into next fork one" + "Deleting copy.*$inferior_exited_re normally.*Switching to.*" \ + "exit, dropped into next fork one" gdb_test "continue" \ - "Deleting copy.*Program exited normally.*Switching to.*" \ - "Exit, dropped into next fork two" + "Deleting copy.*$inferior_exited_re normally.*Switching to.*" \ + "exit, dropped into next fork two" gdb_test "continue" \ - "Deleting copy.*Program exited normally.*Switching to.*" \ - "Exit, dropped into next fork three" + "Deleting copy.*$inferior_exited_re normally.*Switching to.*" \ + "exit, dropped into next fork three" gdb_test "continue" \ - "Deleting copy.*Program exited normally.*Switching to.*" \ - "Exit, dropped into next fork four" + "Deleting copy.*$inferior_exited_re normally.*Switching to.*" \ + "exit, dropped into next fork four" gdb_test "continue" \ - "Deleting copy.*Program exited normally.*Switching to.*" \ - "Exit, dropped into next fork five" + "Deleting copy.*$inferior_exited_re normally.*Switching to.*" \ + "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" # @@ -331,7 +321,7 @@ gdb_test "restart 9" "Not found.*" "no more checkpoint 9" gdb_test "restart 10" "Not found.*" "no more checkpoint 10" # -# Now let's try setting a large number of checkpoints (>1000) +# Now let's try setting a large number of checkpoints (>600) # gdb_exit @@ -342,18 +332,13 @@ gdb_load ${binfile} runto_main gdb_breakpoint $break1_loc -send_gdb "commands\n" -send_gdb " silent\n" -send_gdb " if (lines % 2)\n" -send_gdb " checkpoint\n" -send_gdb " end\n" -send_gdb " continue\n" -send_gdb "end\n" - -gdb_expect { - -re ".*$gdb_prompt $" { pass "set checkpoint breakpoint" } - timeout { fail "(timeout) set checkpoint breakpoint" } -} +gdb_test "commands\nsilent\nif (lines % 2)\ncheckpoint\nend\n continue\nend" \ + "" \ + "set checkpoint breakpoint" + +set prev_timeout $timeout +set timeout [expr $timeout + 120] +verbose "Timeout now $timeout sec." gdb_breakpoint $break2_loc gdb_test "continue" "breakpoint 2.*" "break2 with many checkpoints" @@ -378,11 +363,13 @@ gdb_test_multiple "info checkpoints" $msg { # OK, kill 'em all... # -gdb_test "kill" "" "kill all one" \ +gdb_test "kill" "" "kill all one with many checkpoints" \ "Kill the program being debugged.*y or n. $" "y" +# Restore old timeout +set timeout $prev_timeout +verbose "Timeout now $timeout sec." + # # Finished: cleanup # - -remote_exec build "rm -f pi.txt"