This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Fix gdb.base/print-file-var-main.c value check logic
- From: Pedro Alves <palves at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 9 Oct 2017 11:43:46 -0000
- Subject: [binutils-gdb] Fix gdb.base/print-file-var-main.c value check logic
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5c9e4427a745e5e26fba320ecc62e4285b613e4f
commit 5c9e4427a745e5e26fba320ecc62e4285b613e4f
Author: Pedro Alves <palves@redhat.com>
Date: Mon Oct 9 12:33:31 2017 +0100
Fix gdb.base/print-file-var-main.c value check logic
Fix a typo introduced in commit c56e7c4390ed ("Make ctxobj.exp and
print-file-var.exp work on all platforms.").
This doesn't really affect the outcome of the testcase. I only
noticed the typo because I stepped through the program manually.
To avoid such problems if the test is extended, this moves the STOP
marker until after the program self-validates the values. With the
typo in place, this alone would have resulted in a test FAIL. I.e.,
it'd have caught the typo.
gdb/testsuite/ChangeLog:
2017-10-09 Pedro Alves <palves@redhat.com>
* gdb.base/print-file-var-main.c: Fix get_version_2 value check
logic. Move STOP marker after the value checks.
* gdb.base/print-file-var.exp (continue to STOP marker): Tighten
regexp.
Diff:
---
gdb/testsuite/ChangeLog | 7 +++++++
gdb/testsuite/gdb.base/print-file-var-main.c | 6 +++---
gdb/testsuite/gdb.base/print-file-var.exp | 2 +-
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index e6c0b7f..bb62d22 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2017-10-09 Pedro Alves <palves@redhat.com>
+
+ * gdb.base/print-file-var-main.c: Fix get_version_2 value check
+ logic. Move STOP marker after the value checks.
+ * gdb.base/print-file-var.exp (continue to STOP marker): Tighten
+ regexp.
+
2017-10-06 Sandra Loosemore <sandra@codesourcery.com>
* gdb.mi/mi-threads-interrupt.exp: Skip test if nointerrupts.
diff --git a/gdb/testsuite/gdb.base/print-file-var-main.c b/gdb/testsuite/gdb.base/print-file-var-main.c
index 0a229e5..a19f6f7 100644
--- a/gdb/testsuite/gdb.base/print-file-var-main.c
+++ b/gdb/testsuite/gdb.base/print-file-var-main.c
@@ -23,12 +23,12 @@ main (void)
int v1 = get_version_1 ();
int v2 = get_version_2 ();
- if (v1 != 104) /* STOP */
+ if (v1 != 104)
return 1;
/* The value returned by get_version_2 depends on the target system. */
- if (v2 != 104 || v2 != 203)
+ if (v2 != 104 && v2 != 203)
return 2;
- return 0;
+ return 0; /* STOP */
}
diff --git a/gdb/testsuite/gdb.base/print-file-var.exp b/gdb/testsuite/gdb.base/print-file-var.exp
index abbd5b1..223a67d 100644
--- a/gdb/testsuite/gdb.base/print-file-var.exp
+++ b/gdb/testsuite/gdb.base/print-file-var.exp
@@ -79,7 +79,7 @@ gdb_test "break $executable.c:$bp_location" \
"breapoint past v1 & v2 initialization"
gdb_test "continue" \
- "Breakpoint \[0-9\]+, main \\(\\) at.*" \
+ "Breakpoint \[0-9\]+, main \\(\\) at.*STOP.*" \
"continue to STOP marker"
# Now check the value of this_version_id in both print-file-var-lib1.c