Update ZTS to work on FreeBSD

Update the common ZTS scripts and individual test cases as needed 
in order to allow them to be run on FreeBSD.  The high level goal
is to provide compatibility wrappers whenever possible to minimize
changes to individual test cases.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
Signed-off-by: Ryan Moeller <ryan@ixsystems.com>
Closes #9692
This commit is contained in:
Matthew Macy
2019-12-18 12:29:43 -08:00
committed by Brian Behlendorf
parent 118fc3ef07
commit 7839c4b5e1
145 changed files with 1723 additions and 573 deletions
@@ -38,13 +38,23 @@ function verify_truncate # <filename> <filesize> <option>
typeset option="$3"
log_must mkfile $sizeavg $filename # always start with $sizeavg
typeset -i timestm="$(stat -c %Y $filename)"
typeset -i timestc="$(stat -c %Z $filename)"
log_must sleep 1
log_must $STF_SUITE/tests/functional/truncate/truncate_test -s $size $filename $option
verify_eq $size "$(stat -c %s $filename)" "size"
verify_ne $timestm "$(stat -c %Y $filename)" "mtime"
verify_ne $timestc "$(stat -c %Z $filename)" "ctime"
if is_freebsd; then
typeset -i timestm="$(stat -f "%m" $filename)"
typeset -i timestc="$(stat -f "%c" $filename)"
log_must sleep 1
log_must $STF_SUITE/tests/functional/truncate/truncate_test -s $size $filename $option
verify_eq $size "$(stat_size $filename)" "size"
verify_ne $timestm "$(stat -f "%m" $filename)" "mtime"
verify_ne $timestc "$(stat -f "%c" $filename)" "ctime"
else
typeset -i timestm="$(stat -c %Y $filename)"
typeset -i timestc="$(stat -c %Z $filename)"
log_must sleep 1
log_must $STF_SUITE/tests/functional/truncate/truncate_test -s $size $filename $option
verify_eq $size "$(stat_size $filename)" "size"
verify_ne $timestm "$(stat -c %Y $filename)" "mtime"
verify_ne $timestc "$(stat -c %Z $filename)" "ctime"
fi
log_must rm -f $filename
}