aboutsummaryrefslogtreecommitdiff
path: root/binutils/testsuite
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2011-05-02 12:47:47 +0000
committerH.J. Lu <hjl.tools@gmail.com>2011-05-02 12:47:47 +0000
commitfde6f1fc677f2dabc5f81d73b80d36b0d75a722d (patch)
treebd252c9ab3f8deed895c36f3eb987f38c2d7c19c /binutils/testsuite
parent4510857d06b0cfd22754a1714a460768fe8f67df (diff)
downloadgdb-fde6f1fc677f2dabc5f81d73b80d36b0d75a722d.zip
gdb-fde6f1fc677f2dabc5f81d73b80d36b0d75a722d.tar.gz
gdb-fde6f1fc677f2dabc5f81d73b80d36b0d75a722d.tar.bz2
Add testcases for "ar -d" and "ar -m".
2011-05-02 H.J. Lu <hongjiu.lu@intel.com> PR binutils/12720 * binutils-all/ar.exp (delete_an_element): New. (move_an_element): Likewise. Run delete_an_element and move_an_element.
Diffstat (limited to 'binutils/testsuite')
-rw-r--r--binutils/testsuite/ChangeLog7
-rw-r--r--binutils/testsuite/binutils-all/ar.exp84
2 files changed, 91 insertions, 0 deletions
diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog
index 178b3eb..773070b 100644
--- a/binutils/testsuite/ChangeLog
+++ b/binutils/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2011-05-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/12720
+ * binutils-all/ar.exp (delete_an_element): New.
+ (move_an_element): Likewise.
+ Run delete_an_element and move_an_element.
+
2011-04-30 H.J. Lu <hongjiu.lu@intel.com>
* binutils-all/x86-64/compressed-1a.d: Adjust for change in output
diff --git a/binutils/testsuite/binutils-all/ar.exp b/binutils/testsuite/binutils-all/ar.exp
index 4b8a2da..0caa847 100644
--- a/binutils/testsuite/binutils-all/ar.exp
+++ b/binutils/testsuite/binutils-all/ar.exp
@@ -438,6 +438,88 @@ proc unique_symbol { } {
pass $testname
}
+# Test deleting an element.
+
+proc delete_an_element { } {
+ global AR
+ global AS
+ global srcdir
+ global subdir
+
+ set testname "ar deleting an element"
+
+ if ![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o] {
+ unresolved $testname
+ return
+ }
+
+ if [is_remote host] {
+ set archive artest.a
+ set objfile [remote_download host tmpdir/bintest.o]
+ remote_file host delete $archive
+ } else {
+ set archive tmpdir/artest.a
+ set objfile tmpdir/bintest.o
+ }
+
+ remote_file build delete tmpdir/artest.a
+
+ set got [binutils_run $AR "-r -c $archive ${objfile}"]
+ if ![string match "" $got] {
+ fail $testname
+ return
+ }
+
+ set got [binutils_run $AR "-d $archive ${objfile}"]
+ if ![string match "" $got] {
+ fail $testname
+ return
+ }
+
+ pass $testname
+}
+
+# Test moving an element.
+
+proc move_an_element { } {
+ global AR
+ global AS
+ global srcdir
+ global subdir
+
+ set testname "ar moving an element"
+
+ if ![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o] {
+ unresolved $testname
+ return
+ }
+
+ if [is_remote host] {
+ set archive artest.a
+ set objfile [remote_download host tmpdir/bintest.o]
+ remote_file host delete $archive
+ } else {
+ set archive tmpdir/artest.a
+ set objfile tmpdir/bintest.o
+ }
+
+ remote_file build delete tmpdir/artest.a
+
+ set got [binutils_run $AR "-r -c $archive ${objfile}"]
+ if ![string match "" $got] {
+ fail $testname
+ return
+ }
+
+ set got [binutils_run $AR "-m $archive ${objfile}"]
+ if ![string match "" $got] {
+ fail $testname
+ return
+ }
+
+ pass $testname
+}
+
# Run the tests.
long_filenames
@@ -446,6 +528,8 @@ thin_archive
thin_archive_with_nested
argument_parsing
deterministic_archive
+delete_an_element
+move_an_element
if { [is_elf_format]
&& ![istarget "*-*-hpux*"]
&& ![istarget "msp*-*-*"] } {