mirror of
https://github.com/versity/scoutfs.git
synced 2025-12-23 05:25:18 +00:00
Add t_require_meta_size function
Add a function that tests can use to skip when the metadata device isn't large enough. I thought we needed to avoid enospc in a particular test, but it turns out the test's failure was unrelated. So this isn't used for now but it seems nice to keep around. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -23,3 +23,18 @@ t_require_mounts() {
|
|||||||
test "$T_NR_MOUNTS" -ge "$req" || \
|
test "$T_NR_MOUNTS" -ge "$req" || \
|
||||||
t_skip "$req mounts required, only have $T_NR_MOUNTS"
|
t_skip "$req mounts required, only have $T_NR_MOUNTS"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Require that the meta device be at least the size string argument, as
|
||||||
|
# parsed by numfmt using single char base 2 suffixes (iec).. 64G, etc.
|
||||||
|
#
|
||||||
|
t_require_meta_size() {
|
||||||
|
local dev="$T_META_DEVICE"
|
||||||
|
local req_iec="$1"
|
||||||
|
local req_bytes=$(numfmt --from=iec --to=none $req_iec)
|
||||||
|
local dev_bytes=$(blockdev --getsize64 $dev)
|
||||||
|
local dev_iec=$(numfmt --from=auto --to=iec $dev_bytes)
|
||||||
|
|
||||||
|
test "$dev_bytes" -ge "$req_bytes" || \
|
||||||
|
t_skip "$dev must be at least $req_iec, is $dev_iec"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user