This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] Add a test case for PR ld/11304


This patch tries to add a test case for PR ld/11304 so we can catch the future regression. To help write the test case, I add a new #-comment "#failif". This new #-comment is used to specify that the test passes iff when the result does *not* match the regular expressions. It is required to be placed before the regular expressions, as this new test does. Regression tested on i686-pc-linux-gnu. Is it OK?


-- Jie Zhang CodeSourcery (650) 331-3385 x735
	PR ld/11304
	* ld-elf/{pr11304.d, pr11304a.s, pr11304b.s}: New test.
	* lib/ld-lib.exp (regexp_diff): Add support for #failif.

Index: ld-elf/pr11304.d
===================================================================
RCS file: ld-elf/pr11304.d
diff -N ld-elf/pr11304.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld-elf/pr11304.d	17 Mar 2010 09:08:42 -0000
@@ -0,0 +1,11 @@
+#source: pr11304a.s
+#source: pr11304b.s
+#ld: -e 0 --section-start .zzz=0x800000
+#readelf: -S --wide
+
+#failif
+#...
+  \[[ 0-9]+\] \.zzz[ \t]+PROGBITS[ \t0-9a-f]+AX?.*
+#...
+  \[[ 0-9]+\] \.zzz[ \t]+PROGBITS[ \t0-9a-f]+AX?.*
+#...
Index: ld-elf/pr11304a.s
===================================================================
RCS file: ld-elf/pr11304a.s
diff -N ld-elf/pr11304a.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld-elf/pr11304a.s	17 Mar 2010 09:08:42 -0000
@@ -0,0 +1,4 @@
+.section .zzz,"ax",%progbits
+.long 0
+.text
+.long 0
Index: ld-elf/pr11304b.s
===================================================================
RCS file: ld-elf/pr11304b.s
diff -N ld-elf/pr11304b.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld-elf/pr11304b.s	17 Mar 2010 09:08:42 -0000
@@ -0,0 +1,4 @@
+.section .zzz,"ax",%progbits
+.long 0
+.text
+.long 0
Index: lib/ld-lib.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/lib/ld-lib.exp,v
retrieving revision 1.68
diff -u -p -r1.68 ld-lib.exp
--- lib/ld-lib.exp	9 Dec 2009 21:42:00 -0000	1.68
+++ lib/ld-lib.exp	17 Mar 2010 09:08:42 -0000
@@ -1039,6 +1039,7 @@ proc regexp_diff { file_1 file_2 } {
     set end_2 0
     set differences 0
     set diff_pass 0
+    set fail_if_match 0
 
     if [file exists $file_1] then {
 	set file_a [open $file_1 r]
@@ -1071,6 +1072,10 @@ proc regexp_diff { file_1 file_2 } {
 		set end_2 1
 		set diff_pass 1
 		break
+	    } elseif [ string match "#failif" $line_b ] {
+		send_log "fail if no difference\n"
+		verbose "fail if no difference" 3
+		set fail_if_match 1
 	    } elseif [ string match "#..." $line_b ] {
 		if { [gets $file_b line_b] == $eof } {
 		    set end_2 1
@@ -1123,6 +1128,14 @@ proc regexp_diff { file_1 file_2 } {
 	set differences 1
     }
 
+    if { $fail_if_match } {
+	if { $differences == 0 } {
+	    set differences 1
+	} else {
+	    set differences 0
+	}
+    }
+
     close $file_a
     close $file_b
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]