+2013-11-04 Tom Tromey <tromey@redhat.com>
+
+ * gdb.base/checkpoint.c (main): Use PI_TXT and COPY1_TXT
+ defines.
+ * gdb.base/checkpoint.exp: Define PI_TXT and COPY1_TXT during
+ compilation. Use prepare_for_testing, standard_output_file.
+
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.base/advance.exp: Use standard_testfile and
long i;
int c = 0;
- in = fopen ("pi.txt", "r");
- out = fopen ("copy1.txt", "w");
+ in = fopen (PI_TXT, "r");
+ out = fopen (COPY1_TXT, "w");
if (!in || !out)
{
fclose (in);
fclose (out);
printf ("Deleting copy.\n"); /* breakpoint 3 */
- unlink ("copy1.txt");
+ unlink (COPY1_TXT);
exit (0); /* breakpoint 4 */
}
standard_testfile .c
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+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 {[prepare_for_testing ${testfile}.exp $testfile $srcfile \
+ [list debug "additional_flags=-DPI_TXT=\"$pi_txt\" -DCOPY1_TXT=\"$copy1_txt\""]]} {
untested checkpoint.exp
return -1
}
-# Start with a fresh gdb
-
-clean_restart ${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"]
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.*" \
+gdb_test "shell diff -s $pi_txt $copy1_txt" \
+ "Files .*pi.txt and .*copy1.txt are identical.*" \
"Diff input and output 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.*" \
+gdb_test "shell diff -s $pi_txt $copy1_txt" \
+ "Files .*pi.txt and .*copy1.txt are identical.*" \
"Diff input and output two"
#
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
# Finished: cleanup
#
-remote_exec build "rm -f pi.txt"
+remote_exec host "rm -f $pi_txt"