From: Jie Zhang Date: Fri, 19 Mar 2010 14:49:46 +0000 (+0000) Subject: PR ld/11304 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bb6be443ae1d1c907b6edfae9bfe7ddc9560630b;p=binutils-gdb.git 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. --- diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 61f62dddc64..dd02aefef92 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2010-03-19 Jie Zhang + + 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 * 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 00000000000..d0b8408b3f5 --- /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 00000000000..22fbbee8a8e --- /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 00000000000..22fbbee8a8e --- /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 65a5ffb116a..924d5ef2f38 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