PR ld/11304
authorJie Zhang <jie.zhang@analog.com>
Fri, 19 Mar 2010 14:49:46 +0000 (14:49 +0000)
committerJie Zhang <jie.zhang@analog.com>
Fri, 19 Mar 2010 14:49:46 +0000 (14:49 +0000)
* ld-elf/pr11304.d: New test.
* ld-elf/pr11304a.s: New test.
* ld-elf/pr11304b.s: New test.
* lib/ld-lib.exp (regexp_diff): Add support for #failif.

ld/testsuite/ChangeLog
ld/testsuite/ld-elf/pr11304.d [new file with mode: 0644]
ld/testsuite/ld-elf/pr11304a.s [new file with mode: 0644]
ld/testsuite/ld-elf/pr11304b.s [new file with mode: 0644]
ld/testsuite/lib/ld-lib.exp

index 61f62dddc64c106f9811a2f982b0f9308385ef2f..dd02aefef928895439bd22791bdb708d22d20315 100644 (file)
@@ -1,3 +1,11 @@
+2010-03-19  Jie Zhang  <jie@codesourcery.com>
+
+       PR ld/11304
+       * ld-elf/pr11304.d: New test.
+       * ld-elf/pr11304a.s: New test.
+       * ld-elf/pr11304b.s: New test.
+       * lib/ld-lib.exp (regexp_diff): Add support for #failif.
+
 2010-03-15  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * ld-elf/orphan-region.d, ld-elf/orphan-region.ld,
diff --git a/ld/testsuite/ld-elf/pr11304.d b/ld/testsuite/ld-elf/pr11304.d
new file mode 100644 (file)
index 0000000..d0b8408
--- /dev/null
@@ -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?.*
+#...
diff --git a/ld/testsuite/ld-elf/pr11304a.s b/ld/testsuite/ld-elf/pr11304a.s
new file mode 100644 (file)
index 0000000..22fbbee
--- /dev/null
@@ -0,0 +1,4 @@
+.section .zzz,"ax",%progbits
+.long 0
+.text
+.long 0
diff --git a/ld/testsuite/ld-elf/pr11304b.s b/ld/testsuite/ld-elf/pr11304b.s
new file mode 100644 (file)
index 0000000..22fbbee
--- /dev/null
@@ -0,0 +1,4 @@
+.section .zzz,"ax",%progbits
+.long 0
+.text
+.long 0
index 65a5ffb116a351630fb5493f84d865ce89500ab4..924d5ef2f38777943d9b8bf9185101a1c675978d 100644 (file)
@@ -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