[bfd/ChangeLog]
[deliverable/binutils-gdb.git] / binutils / testsuite / binutils-all / ar.exp
index 21a39f48ea6e003a339e4d729d71488a3a7cc9a1..e85201410bde4ab6c4d95abd100e518fec6dacc2 100644 (file)
@@ -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
This page took 0.028522 seconds and 4 git commands to generate.