aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2017-11-15 17:22:25 -0800
committerEryu Guan <eguan@redhat.com>2017-11-16 12:08:43 +0800
commit01140c76e4854634b6ec0c94eadc2045864e7fb1 (patch)
treea3fcafc90a031fa1e82824ad32401c399a143932
parenteb48c305021f4d233075b2b899a289c8aa34998b (diff)
downloadxfstests-01140c76e4854634b6ec0c94eadc2045864e7fb1.tar.gz
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>
-rw-r--r--common/fuzzy11
1 files changed, 8 insertions, 3 deletions
diff --git a/common/fuzzy b/common/fuzzy
index 3d86e1c865..d70964f476 100644
--- a/common/fuzzy
+++ b/common/fuzzy
@@ -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