aboutsummaryrefslogtreecommitdiff
path: root/binutils/testsuite
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-04-15 00:36:42 +0930
committerAlan Modra <amodra@gmail.com>2021-04-15 17:51:17 +0930
commit985e026451640c880e13827454aa31b7a636d1bc (patch)
tree2a034beb448ef79b8b57e9d207f2e0722e38cda5 /binutils/testsuite
parentd0ecdcddc363ad7f05fc50cf1eee4028fa7f8964 (diff)
downloadfsf-binutils-gdb-985e026451640c880e13827454aa31b7a636d1bc.zip
fsf-binutils-gdb-985e026451640c880e13827454aa31b7a636d1bc.tar.gz
fsf-binutils-gdb-985e026451640c880e13827454aa31b7a636d1bc.tar.bz2
PR27725, better objcopy -p times
Nanosecond rather than second resolution. PR 27725 * configure.ac: Check for sys/time.h and utimensat. Use standard checks for mkstemp and mkdtemp. Whitespace. Check for nanosecond members of struct stat. * rename.c: Prefer sys/time.h for utimes over utime.h for utime. (STAT_TIMESPEC, STAT_TIMESPEC_NS): Define (get_stat_atime_ns, get_stat_mtime_ns): New inline functions. (get_stat_atime, get_stat_mtime): Likewise. (set_times): Choose first available of utimensat, utimes, utime. Use above inline functions to set timespec and timeval values. * configure: Regenerate. * config.in: Regenerate. * testsuite/binutils-all/objcopy.exp (objcopy_test): Add test of file timestamp when --preserve-dates is used.
Diffstat (limited to 'binutils/testsuite')
-rw-r--r--binutils/testsuite/binutils-all/objcopy.exp12
1 files changed, 12 insertions, 0 deletions
diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
index ef25187..e1df9ff 100644
--- a/binutils/testsuite/binutils-all/objcopy.exp
+++ b/binutils/testsuite/binutils-all/objcopy.exp
@@ -77,6 +77,7 @@ proc objcopy_test {testname srcfile type asflags ldflags} {
return
}
set xflags "--preserve-dates"
+ sleep 1
}
set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS $xflags $t_tempfile $t_copyfile"]
@@ -102,6 +103,17 @@ proc objcopy_test {testname srcfile type asflags ldflags} {
if [string equal "" $exec_output] then {
pass "objcopy $type ($testname)"
+ if { $type == "executable" } {
+ set dir [file dirname $t_copyfile]
+ set f2 [file tail $t_copyfile]
+ set status [remote_exec host find "$dir -name $f2 -newer $t_tempfile -print"]
+ set exec_output [lindex $status 1]
+ if [string equal "" $exec_output] then {
+ pass "objcopy $type ($testname) timestamp"
+ } else {
+ fail "objcopy $type ($testname) timestamp"
+ }
+ }
} else {
send_log "$exec_output\n"
verbose "$exec_output" 1