This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
FYI: unset previous output vars in standard_testfile
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 10 Jul 2012 08:33:43 -0600
- Subject: FYI: unset previous output vars in standard_testfile
I'm checking this in.
While updating more tests, I noticed that I occasionally introduced a
bug where one test case erroneously referred to a setting from an
earlier test.
This patch helps detect this problem earlier by having standard_testfile
unset the output variables from the previous invocation. It also unsets
'executable', as many tests use that as well.
Regtested on x86-64 Fedora 16.
Tom
2012-07-10 Tom Tromey <tromey@redhat.com>
* lib/gdb.exp (standard_testfile): Unset output variables from
earlier invocations.
Index: lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.210
diff -u -r1.210 gdb.exp
--- lib/gdb.exp 2 Jul 2012 12:06:56 -0000 1.210
+++ lib/gdb.exp 10 Jul 2012 14:32:54 -0000
@@ -3098,6 +3098,7 @@
proc standard_testfile {args} {
global gdb_test_file_name
global objdir subdir
+ global gdb_test_file_last_vars
# Outputs.
global testfile binfile
@@ -3109,6 +3110,17 @@
set args .c
}
+ # Unset our previous output variables.
+ # This can help catch hidden bugs.
+ if {[info exists gdb_test_file_last_vars]} {
+ foreach varname $gdb_test_file_last_vars {
+ global $varname
+ catch {unset $varname}
+ }
+ }
+ # 'executable' is often set by tests.
+ set gdb_test_file_last_vars {executable}
+
set suffix ""
foreach arg $args {
set varname srcfile$suffix
@@ -3122,6 +3134,7 @@
}
set $varname $arg
+ lappend gdb_test_file_last_vars $varname
if {$suffix == ""} {
set suffix 2