aboutsummaryrefslogtreecommitdiff
path: root/binutils/testsuite
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2019-10-30 10:50:23 +0000
committerNick Clifton <nickc@redhat.com>2019-10-30 10:50:23 +0000
commit197245e341aeb1b5da8ee5fbe5d6c49de650fb89 (patch)
tree046f13d6fd30949d79ec6c7eb88b1d39834c0824 /binutils/testsuite
parenta961a1e1749443516d8fe6e0570cf808a09e8f89 (diff)
downloadgdb-197245e341aeb1b5da8ee5fbe5d6c49de650fb89.zip
gdb-197245e341aeb1b5da8ee5fbe5d6c49de650fb89.tar.gz
gdb-197245e341aeb1b5da8ee5fbe5d6c49de650fb89.tar.bz2
Add a --output=<DIR> option to ar to allow the specifying of an output directory.
* ar.c (emum long option numbers): Declare. Use to provide numerical values for long options. (long_options): Add --output option. (usage): Mention the --output option. (open_output_file): New function. Create a filepath for an output file and open it. (extract_file): Use open_output_file(). (open_output_file): * testsuite/binutils-all/ar.exp: Add a test of the new feature. * doc/binutils.texi: Document the new feature. * NEWS: Mention the new feature.
Diffstat (limited to 'binutils/testsuite')
-rw-r--r--binutils/testsuite/binutils-all/ar.exp45
1 files changed, 45 insertions, 0 deletions
diff --git a/binutils/testsuite/binutils-all/ar.exp b/binutils/testsuite/binutils-all/ar.exp
index bc1fbdb..c043f7e 100644
--- a/binutils/testsuite/binutils-all/ar.exp
+++ b/binutils/testsuite/binutils-all/ar.exp
@@ -605,6 +605,50 @@ proc empty_archive { } {
pass $testname
}
+# Test extracting an element.
+
+proc extract_an_element { } {
+ global AR
+ global AS
+ global srcdir
+ global subdir
+
+ set testname "ar extracting an element"
+
+ if ![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o] {
+ unresolved $testname
+ return
+ }
+
+ set archive artest.a
+
+ if [is_remote host] {
+ set objfile [remote_download host tmpdir/bintest.o]
+ remote_file host delete $archive
+ } else {
+ set objfile tmpdir/bintest.o
+ }
+
+ remote_file build delete $archive
+
+ set got [binutils_run $AR "-r -c $archive ${objfile}"]
+ if ![string match "" $got] {
+ fail $testname
+ return
+ }
+
+ set got [binutils_run $AR "--output=tmpdir -x $archive ${objfile}"]
+ if ![string match "" $got] {
+ fail $testname
+ return
+ }
+
+ remote_file build delete $archive
+ remote_file build delete tmpdir/$archive
+
+ pass $testname
+}
+
# Run the tests.
# Only run the bfdtest checks if the programs exist. Since these
@@ -625,6 +669,7 @@ deterministic_archive
delete_an_element
move_an_element
empty_archive
+extract_an_element
if { [is_elf_format] && [supports_gnu_unique] } {
unique_symbol