mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-10 12:51:15 -03:00
[tests] Fix pre-epoch test workaround on non-Linux
I forgot `stat` is non-portable. There's no great way to portably get a machine-readable representation of stat(2) for a file. I don't want to ship our own lstat(2) wrapper executable just for this test and don't want to fork out to python or perl for this either - I just wanted to get the tests to pass under WSL :'( Anyway, just give up and make it skip just for WSL. If another OS fails this test in the future, the comments and existing workaround will make it easy to figure out what the problem is and what needs to be done. We'll cross that bridge when we get there.
This commit is contained in:
@@ -66,7 +66,9 @@ touch -m -t 190212112045.40 old
|
||||
touch -m -t 190112112040.39 oldest
|
||||
touch -m -t 203801080314.07 newest
|
||||
|
||||
if string match -qr '^(0|'(stat -c %Y epoch)')$' -- (stat -c %Y oldest)
|
||||
# XXX: This workaround only works w/ GNU `stat`. There is no great portable way of getting mtime.
|
||||
if string match -qr -- "GNU coreutils" "$(stat --version 2>/dev/null)" && \
|
||||
string match -qr -- '^(0|'(stat -c %Y epoch)')$' (stat -c %Y oldest)
|
||||
# Filesystem does not support dates older than epoch, so silently skip this test - there's no
|
||||
# guarantee that an FS supports pre-epoch timestamps and lxfs (virtual WSLv1 fs) doesn't.
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user