aboutsummaryrefslogtreecommitdiff
path: root/binutils/testsuite
diff options
context:
space:
mode:
authorChris Demetriou <cgd@google.com>2009-03-11 04:36:40 +0000
committerChris Demetriou <cgd@google.com>2009-03-11 04:36:40 +0000
commit36e4dce69dd23bea9ea2258dea35f034b6d6351c (patch)
treeafd2a795b17ed76d0f5353a5ed752bc483c1a929 /binutils/testsuite
parenta07dbd482b9c6d2c8e0e60409bfbb47f6f67c013 (diff)
downloadgdb-36e4dce69dd23bea9ea2258dea35f034b6d6351c.zip
gdb-36e4dce69dd23bea9ea2258dea35f034b6d6351c.tar.gz
gdb-36e4dce69dd23bea9ea2258dea35f034b6d6351c.tar.bz2
[bfd/ChangeLog]
2009-03-11 Chris Demetriou <cgd@google.com> * bfd.c (BFD_DETERMINISTIC_OUTPUT): New flag. * bfd-in2.h: Regenerate. * archive.c (bfd_ar_hdr_from_filesystem): If BFD_DETERMINISTIC_OUTPUT flag is set, use 0 for uid, gid, and timestamp, and use 0644 for file mode. (bsd_write_armap): Likewise. (_bfd_archive_bsd_update_armap_timestamp): If BFD_DETERMINISTIC_OUTPUT flag is set, do nothing. (coff_write_armap): If BFD_DETERMINISTIC_OUTPUT flag is set, use 0 for timestamp. [binutils/ChangeLog] 2009-03-11 Chris Demetriou <cgd@google.com> * ar.c (deterministic): New global variable. (main): Recognize new 'D' option, which enables 'deterministic mode'. (usage): Document new 'D' option. (write_archive): Set BFD_DETERMINISTIC_OUTPUT in output archive's flags if deterministic mode was requested. * doc/binutils.texi (ar): Document deterministic mode ('D' option). [binutils/testsuite/ChangeLog] 2009-03-11 Chris Demetriou <cgd@google.com> * binutils-all/ar.exp (deterministic_archive): New test.
Diffstat (limited to 'binutils/testsuite')
-rw-r--r--binutils/testsuite/ChangeLog4
-rw-r--r--binutils/testsuite/binutils-all/ar.exp45
2 files changed, 49 insertions, 0 deletions
diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog
index 81e6c17..1bca1a4 100644
--- a/binutils/testsuite/ChangeLog
+++ b/binutils/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2009-03-11 Chris Demetriou <cgd@google.com>
+
+ * binutils-all/ar.exp (deterministic_archive): New test.
+
2009-03-09 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/9933
diff --git a/binutils/testsuite/binutils-all/ar.exp b/binutils/testsuite/binutils-all/ar.exp
index 21a39f4..e852014 100644
--- a/binutils/testsuite/binutils-all/ar.exp
+++ b/binutils/testsuite/binutils-all/ar.exp
@@ -354,6 +354,50 @@ proc argument_parsing { } {
pass $testname
}
+# Test building a deterministic archive.
+
+proc deterministic_archive { } {
+ global AR
+ global AS
+ global NM
+ global srcdir
+ global subdir
+
+ set testname "ar deterministic archive"
+
+ 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 "rcD $archive ${objfile}"]
+ if ![string match "" $got] {
+ fail $testname
+ return
+ }
+
+ set got [binutils_run $AR "tv $archive"]
+ # This only checks the file mode and uid/gid. We can't easily match
+ # date because it's printed with the user's timezone.
+ if ![string match "rw-r--r-- 0/0 *bintest.o*" $got] {
+ fail $testname
+ return
+ }
+
+ pass $testname
+}
+
# Run the tests.
long_filenames
@@ -361,3 +405,4 @@ symbol_table
thin_archive
thin_archive_with_nested
argument_parsing
+deterministic_archive