mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
common/fuzzy: if the fuzz verb is random, keep fuzzing until we get a new value
If the fuzz verb is 'random', keep generating new random values until we get one that is distinct from the previous value. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
committed by
Eryu Guan
parent
eb48c30502
commit
01140c76e4
+8
-3
@@ -179,9 +179,14 @@ _scratch_xfs_fuzz_metadata_field() {
|
||||
for arg in "$@"; do
|
||||
cmds+=("-c" "${arg}")
|
||||
done
|
||||
_scratch_xfs_db -x "${cmds[@]}" -c "fuzz ${fuzz_arg} ${key} ${value}"
|
||||
echo
|
||||
newval="$(_scratch_xfs_get_metadata_field "${key}" "$@" 2> /dev/null)"
|
||||
while true; do
|
||||
_scratch_xfs_db -x "${cmds[@]}" -c "fuzz ${fuzz_arg} ${key} ${value}"
|
||||
echo
|
||||
newval="$(_scratch_xfs_get_metadata_field "${key}" "$@" 2> /dev/null)"
|
||||
if [ "${key}" != "random" ] || [ "${oldval}" != "${newval}" ]; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
if [ "${oldval}" = "${newval}" ]; then
|
||||
echo "Field ${key} already set to ${newval}, skipping test."
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user