diff options
author | Ian Lance Taylor <ian@airs.com> | 2010-01-20 00:09:13 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2010-01-20 00:09:13 +0000 |
commit | 500ee42ee091d6e8860d237bd5e74e8cdcf61d70 (patch) | |
tree | 60cf2ebadc06364c7e00c8ae0010e00b887b9c8e /binutils/testsuite | |
parent | 1696f399f791173c5714c877514861b706f2f6ad (diff) | |
download | gdb-500ee42ee091d6e8860d237bd5e74e8cdcf61d70.zip gdb-500ee42ee091d6e8860d237bd5e74e8cdcf61d70.tar.gz gdb-500ee42ee091d6e8860d237bd5e74e8cdcf61d70.tar.bz2 |
binutils/:
* objcopy.c (copy_main): Rewrite OPTION_ADD_SECTION code to work
with non-ordinary files like /dev/null.
binutils/testsuite/:
* lib/utils-lib.exp (run_dump_test): Permit option values to use
$srcdir to refer to the source directory.
* binutils-all/add-section.d: New test.
* binutils-all/add-empty-section.d: New test.
* binutils-all/empty-file: New test input file.
* binutils-all/objcopy.exp: Run new tests.
Diffstat (limited to 'binutils/testsuite')
-rw-r--r-- | binutils/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/add-empty-section.d | 9 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/add-section.d | 11 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/empty-file | 0 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/objcopy.exp | 3 | ||||
-rw-r--r-- | binutils/testsuite/lib/utils-lib.exp | 10 |
6 files changed, 42 insertions, 0 deletions
diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog index 4ebc7e9..4591887 100644 --- a/binutils/testsuite/ChangeLog +++ b/binutils/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2010-01-19 Ian Lance Taylor <iant@google.com> + + * lib/utils-lib.exp (run_dump_test): Permit option values to use + $srcdir to refer to the source directory. + * binutils-all/add-section.d: New test. + * binutils-all/add-empty-section.d: New test. + * binutils-all/empty-file: New test input file. + * binutils-all/objcopy.exp: Run new tests. + 2010-01-08 H.J. Lu <hongjiu.lu@intel.com> * binutils-all/elfedit-2.d: New. diff --git a/binutils/testsuite/binutils-all/add-empty-section.d b/binutils/testsuite/binutils-all/add-empty-section.d new file mode 100644 index 0000000..c9162a5 --- /dev/null +++ b/binutils/testsuite/binutils-all/add-empty-section.d @@ -0,0 +1,9 @@ +#PROG: objcopy +#name: objcopy add-empty-section +#source: empty.s +#objcopy: --add-section NEW=$srcdir/empty-file +#readelf: -S --wide + +#... + \[[ 0-9]+\] NEW[ \t]+PROGBITS[ \t]+[0-9a-f]+[ \t]+[0-9a-f]+[ \t]+0+[ \t]+[ \t0-9a-f]+ +#... diff --git a/binutils/testsuite/binutils-all/add-section.d b/binutils/testsuite/binutils-all/add-section.d new file mode 100644 index 0000000..37a24cf --- /dev/null +++ b/binutils/testsuite/binutils-all/add-section.d @@ -0,0 +1,11 @@ +#PROG: objcopy +#name: objcopy add-section +#source: empty.s +#objcopy: --add-section NEW=$srcdir/empty.s +#objdump: -s -j NEW + +.*: +file format .* + +Contents of section NEW: + 0000 2320416e 20656d70 74792066 696c652e # An empty file. + 0010 0a . diff --git a/binutils/testsuite/binutils-all/empty-file b/binutils/testsuite/binutils-all/empty-file new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/binutils/testsuite/binutils-all/empty-file diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp index de9b116..f7f6cde 100644 --- a/binutils/testsuite/binutils-all/objcopy.exp +++ b/binutils/testsuite/binutils-all/objcopy.exp @@ -875,5 +875,8 @@ if [is_elf_format] { run_dump_test "localize-hidden-1" run_dump_test "testranges" run_dump_test "testranges-ia64" + + run_dump_test "add-section" + run_dump_test "add-empty-section" } run_dump_test "localize-hidden-2" diff --git a/binutils/testsuite/lib/utils-lib.exp b/binutils/testsuite/lib/utils-lib.exp index 393aae8..66a97a4 100644 --- a/binutils/testsuite/lib/utils-lib.exp +++ b/binutils/testsuite/lib/utils-lib.exp @@ -327,6 +327,11 @@ proc run_dump_test { name {extra_options {}} } { unresolved $subdir/$name return } + + # Permit the option to use $srcdir to refer to the source + # directory. + regsub -all "\\\$srcdir" "$opt_val" "$srcdir/$subdir" opt_val + if [string length $opts($opt_name)] { perror "option $opt_name multiply set in $file.d" unresolved $subdir/$name @@ -343,6 +348,11 @@ proc run_dump_test { name {extra_options {}} } { unresolved $subdir/$name return } + + # Permit the option to use $srcdir to refer to the source + # directory. + regsub -all "\\\$srcdir" "$opt_val" "$srcdir/$subdir" opt_val + # add extra option to end of existing option, adding space # if necessary. if [string length $opts($opt_name)] { |