Sun, 02 Jul 2023 11:18:23 +0200
fix non-standard use of stat in metadata3 test script
test/bin-test/test-dav-sync-metadata3.sh | file | annotate | diff | comparison | revisions |
--- a/test/bin-test/test-dav-sync-metadata3.sh Sun Jul 02 11:11:04 2023 +0200 +++ b/test/bin-test/test-dav-sync-metadata3.sh Sun Jul 02 11:18:23 2023 +0200 @@ -40,6 +40,21 @@ XATTR=../../build/bin/xattrtool +# stat parameter for getting unix time +STAT_TIME_FMT="-c %Y" + +TEST=`uname -a | grep BSD` +if [ $? -ne 0 ]; +then + STAT_TIME_FMT="-f %m" +fi +TEST=`uname -a | grep Darwin` +if [ $? -ne 0 ]; +then + STAT_TIME_FMT="-f %m" +fi + + # checks if tmp-sync/out.txt contains a specific text # arg1: pattern # arg2: errormsg @@ -128,8 +143,8 @@ check_tmpout "0 errors" "test 1: wrong error counter (pull)" # check metadata -MTIMEA1=`stat -c %Y tmp-sync/test4a/file1` -MTIMEB1=`stat -c %Y tmp-sync/test4b/file1` +MTIMEA1=`stat $STAT_TIME_FMT tmp-sync/test4a/file1` +MTIMEB1=`stat $STAT_TIME_FMT tmp-sync/test4b/file1` if [ "$MTIMEA1" != "$MTIMEB1" ]; then echo "test 1: mtime not synced" @@ -182,8 +197,8 @@ check_tmpout "0 errors" "test 2: wrong error counter (pull)" # check metadata -MTIMEA1=`stat -c %Y tmp-sync/test4a/copy1 2> /dev/null` -MTIMEB1=`stat -c %Y tmp-sync/test4b/copy1 2> /dev/null` +MTIMEA1=`stat $STAT_TIME_FMT tmp-sync/test4a/copy1 2> /dev/null` +MTIMEB1=`stat $STAT_TIME_FMT tmp-sync/test4b/copy1 2> /dev/null` if [ "$MTIMEA1" != "$MTIMEB1" ]; then echo "test 2: mtime not synced" @@ -259,8 +274,8 @@ check_tmpout "move" "test 5: no move (pull)" # check metadata -MTIMEA1=`stat -c %Y tmp-sync/test4a/move1 2> /dev/null` -MTIMEB1=`stat -c %Y tmp-sync/test4b/move1 2> /dev/null` +MTIMEA1=`stat $STAT_TIME_FMT tmp-sync/test4a/move1 2> /dev/null` +MTIMEB1=`stat $STAT_TIME_FMT tmp-sync/test4b/move1 2> /dev/null` if [ $MTIMEA1 -ne $MTIMEB1 ]; then echo "test 5: mtime not synced" @@ -306,8 +321,8 @@ check_tmpout "move" "test 6: no move (pull)" # check metadata -MTIMEA1=`stat -c %Y tmp-sync/test4a/move_noxattr 2> /dev/null` -MTIMEB1=`stat -c %Y tmp-sync/test4b/move_noxattr 2> /dev/null` +MTIMEA1=`stat $STAT_TIME_FMT tmp-sync/test4a/move_noxattr 2> /dev/null` +MTIMEB1=`stat $STAT_TIME_FMT tmp-sync/test4b/move_noxattr 2> /dev/null` if [ $MTIMEA1 -ne $MTIMEB1 ]; then echo "test 6: mtime not synced"