mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
Attempt to auto-detect stat(1) being used if not given proper invocation
GNU stat(1) uses '-c "%s"' as the proper invocation to print filesize of the file in question, while BSD stat(1) uses '-f "%Uz"'. Do some trivial autodetection to check if we're using GNU stat(1) and assume we're using BSD stat(1) if we don't detect otherwise. This should allow the test suite to run properly out-of-the-box on *BSDs and MacOS in addition to the current Linux support. Signed-off-by: Kyle Evans <kevans@FreeBSD.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
e54388015a
commit
333d533a8f
1 changed files with 8 additions and 1 deletions
|
@ -8,7 +8,14 @@ fi
|
|||
|
||||
# stat differs between platforms
|
||||
if [ -z "$STATSZ" ]; then
|
||||
STATSZ="stat -c %s"
|
||||
stat --version 2>/dev/null | grep -q 'GNU'
|
||||
GNUSTAT=$?
|
||||
if [ "$GNUSTAT" -ne 0 ]; then
|
||||
# Assume BSD stat if we can't detect as GNU stat
|
||||
STATSZ="stat -f %Uz"
|
||||
else
|
||||
STATSZ="stat -c %s"
|
||||
fi
|
||||
fi
|
||||
|
||||
export QUIET_TEST=1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue