public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@redhat.com>
Subject: [PATCH v2 09/17] update checkpoint test
Date: Fri, 18 Oct 2013 20:49:00 -0000	[thread overview]
Message-ID: <1382129374-18344-10-git-send-email-tromey@redhat.com> (raw)
In-Reply-To: <1382129374-18344-1-git-send-email-tromey@redhat.com>

This fixes the "checkpoint" test to use the standard output directory.
This makes the test be parallel-safe.

	* 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.
---
 gdb/testsuite/gdb.base/checkpoint.c   |  6 +++---
 gdb/testsuite/gdb.base/checkpoint.exp | 30 ++++++++++++++++--------------
 2 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/gdb/testsuite/gdb.base/checkpoint.c b/gdb/testsuite/gdb.base/checkpoint.c
index c287094..d498047 100644
--- a/gdb/testsuite/gdb.base/checkpoint.c
+++ b/gdb/testsuite/gdb.base/checkpoint.c
@@ -28,8 +28,8 @@ main()
   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)
     {
@@ -54,6 +54,6 @@ main()
   fclose (in);
   fclose (out);
   printf ("Deleting copy.\n");	/* breakpoint 3 */
-  unlink ("copy1.txt");
+  unlink (COPY1_TXT);
   exit (0);			/* breakpoint 4 */
 }
diff --git a/gdb/testsuite/gdb.base/checkpoint.exp b/gdb/testsuite/gdb.base/checkpoint.exp
index b86fead..f1af471 100644
--- a/gdb/testsuite/gdb.base/checkpoint.exp
+++ b/gdb/testsuite/gdb.base/checkpoint.exp
@@ -27,23 +27,25 @@ if {![istarget "*-*-linux*"]} then {
 
 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"]
@@ -148,8 +150,8 @@ 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.*" \
+gdb_test "shell diff -s $pi_txt $copy1_txt" \
+    "Files .*pi.txt and .*copy1.txt are identical.*" \
     "Diff input and output one"
 
 #
@@ -201,8 +203,8 @@ 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.*" \
+gdb_test "shell diff -s $pi_txt $copy1_txt" \
+    "Files .*pi.txt and .*copy1.txt are identical.*" \
     "Diff input and output two"
 
 # 
@@ -214,8 +216,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
@@ -370,4 +372,4 @@ verbose "Timeout now $timeout sec."
 # Finished: cleanup
 #
 
-remote_exec build "rm -f pi.txt"
+remote_exec host "rm -f $pi_txt"
-- 
1.8.1.4

  parent reply	other threads:[~2013-10-18 20:49 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-18 20:49 [PATCH v2 00/17] test suite parallel safety Tom Tromey
2013-10-18 20:49 ` [PATCH v2 07/17] fix up gdb.trace Tom Tromey
2013-10-25 16:22   ` Pedro Alves
2013-10-25 16:37     ` Tom Tromey
2013-10-18 20:49 ` [PATCH v2 12/17] fix up gdb.server Tom Tromey
2013-10-18 20:49 ` [PATCH v2 06/17] fix up gdb.mi Tom Tromey
2013-10-18 20:49 ` [PATCH v2 03/17] fix weird.exp for parallel testing Tom Tromey
2013-10-18 20:49 ` [PATCH v2 08/17] simple changes in gdb.base Tom Tromey
2013-10-18 20:49 ` [PATCH v2 02/17] fix some simple thinkos in the test suite Tom Tromey
2013-10-18 20:49 ` [PATCH v2 01/17] fix up log-file toggling Tom Tromey
2013-10-18 20:49 ` [PATCH v2 15/17] fix some "exec" tests Tom Tromey
2013-10-25 16:21   ` Pedro Alves
2013-10-25 16:39     ` Tom Tromey
2013-10-25 17:02       ` Pedro Alves
2013-10-18 20:49 ` Tom Tromey [this message]
2013-10-18 21:00 ` [PATCH v2 14/17] fix argv0-symlink.exp for parallel mode Tom Tromey
2013-10-18 21:00 ` [PATCH v2 11/17] introduce relative_filename and use it Tom Tromey
2013-10-25 16:22   ` Pedro Alves
2013-10-25 16:42     ` Tom Tromey
2013-10-25 17:03       ` Pedro Alves
2013-10-28 19:01   ` Doug Evans
2013-10-28 20:10     ` Tom Tromey
2013-10-18 21:11 ` [PATCH v2 17/17] switch to fully parallel mode Tom Tromey
2013-10-18 21:24 ` [PATCH v2 10/17] update fileio test Tom Tromey
2013-10-18 21:24 ` [PATCH v2 13/17] make gdb.asm parallel-safe Tom Tromey
2013-10-18 21:36 ` [PATCH v2 05/17] fix up gdb.xml Tom Tromey
2013-10-25 16:21   ` Pedro Alves
2013-10-25 18:23     ` Tom Tromey
2013-10-18 21:36 ` [PATCH v2 04/17] fix up gdb.gdb Tom Tromey
2013-10-18 21:44 ` [PATCH v2 16/17] fix some fission tests Tom Tromey
2013-10-25 16:23 ` [PATCH v2 00/17] test suite parallel safety Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1382129374-18344-10-git-send-email-tromey@redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).