aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJie Zhang <jie.zhang@analog.com>2010-03-19 14:49:46 +0000
committerJie Zhang <jie.zhang@analog.com>2010-03-19 14:49:46 +0000
commitbb6be443ae1d1c907b6edfae9bfe7ddc9560630b (patch)
tree3f312b8cb14ac79f4b62d6d7b53deba498dff2d5
parent0f020cefaaafef23c09c563bb2f39794117a9748 (diff)
downloadgdb-bb6be443ae1d1c907b6edfae9bfe7ddc9560630b.zip
gdb-bb6be443ae1d1c907b6edfae9bfe7ddc9560630b.tar.gz
gdb-bb6be443ae1d1c907b6edfae9bfe7ddc9560630b.tar.bz2
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.
-rw-r--r--ld/testsuite/ChangeLog8
-rw-r--r--ld/testsuite/ld-elf/pr11304.d11
-rw-r--r--ld/testsuite/ld-elf/pr11304a.s4
-rw-r--r--ld/testsuite/ld-elf/pr11304b.s4
-rw-r--r--ld/testsuite/lib/ld-lib.exp13
5 files changed, 40 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 61f62dd..dd02aef 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -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
index 0000000..d0b8408
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr11304.d
@@ -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
index 0000000..22fbbee
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr11304a.s
@@ -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
index 0000000..22fbbee
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr11304b.s
@@ -0,0 +1,4 @@
+.section .zzz,"ax",%progbits
+.long 0
+.text
+.long 0
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 65a5ffb..924d5ef 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -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