]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
tests: force non-deterministic mode in non-deterministic tests
authorStephen Kitt <steve@sk2.org>
Mon, 11 Mar 2024 07:21:47 +0000 (08:21 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 11 Mar 2024 07:21:47 +0000 (08:21 +0100)
Since ar can be built defaulting to deterministic mode, tests which
expect non-deterministic behaviour need to explicitly set the U flag.

The non-deterministic member test expects SOURCE_DATE_EPOCH to not be
set; this documents that. Unconditionally unsetting the variable
causes issues in test infrastructure (which expects unsetenv to only
be called on variables which are already set).

Signed-off-by: Stephen Kitt <steve@sk2.org>
binutils/testsuite/binutils-all/ar.exp

index d4e4f64b42e3d918ee0fad18118662e346bf3829..998cbe1f0a9f7993339bda13d1bd46321da87ca6 100644 (file)
@@ -538,6 +538,7 @@ proc replacing_deterministic_member { } {
 }
 
 # Test replacing a member of a non-deterministic archive.
+# This test expects SOURCE_DATE_EPOCH to not be set in the environment.
 
 proc replacing_non_deterministic_member { } {
     global AR
@@ -581,7 +582,7 @@ proc replacing_non_deterministic_member { } {
 
     # Build the archive with the *newer* object file.
     
-    set got [binutils_run $AR "rc $archive ${newer_objfile}"]
+    set got [binutils_run $AR "rcU $archive ${newer_objfile}"]
     if ![string match "" $got] {
        fail "$testname: (could not build archive)"
        return
@@ -589,7 +590,7 @@ proc replacing_non_deterministic_member { } {
 
     # Now try to replace the newer file with the older one.  This should not work.
     
-    set got [binutils_run $AR "ru $archive $older_objfile"]
+    set got [binutils_run $AR "ruU $archive $older_objfile"]
     if ![string match "" $got] {
        fail "$testname: (failed to replace file)"
        return
@@ -651,7 +652,7 @@ proc replacing_sde_deterministic_member { } {
     # Build the archive with the *newer* object file.
     setenv SOURCE_DATE_EPOCH "1000"
     
-    set got [binutils_run $AR "rc $archive ${newer_objfile}"]
+    set got [binutils_run $AR "rcU $archive ${newer_objfile}"]
     if ![string match "" $got] {
        fail "$testname: (could not build archive)"
        unsetenv SOURCE_DATE_EPOCH
@@ -662,7 +663,7 @@ proc replacing_sde_deterministic_member { } {
     # archive this will not work, but one created to be deterministic
     # should always replace its members.
     
-    set got [binutils_run $AR "ru $archive $older_objfile"]
+    set got [binutils_run $AR "ruU $archive $older_objfile"]
     if ![string match "" $got] {
        fail "$testname: (failed to replace file)"
        unsetenv SOURCE_DATE_EPOCH