From: Ian Jackson Date: Fri, 22 Jan 2021 15:09:45 +0000 (+0000) Subject: mfi-common: Provide stripy_rand X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=c7807df60e7eb04445237f8e5ab30c7c9773e10d;p=osstest.git mfi-common: Provide stripy_rand We will use this in a moment. Signed-off-by: Ian Jackson --- diff --git a/mfi-common b/mfi-common index 34b0c11..35efd23 100644 --- a/mfi-common +++ b/mfi-common @@ -31,6 +31,18 @@ stripy () { eval "$out_vn=\"\$out_$out_val\"" } +stripy_rand () { + # feel free to pass not-real values for $job + # if desired to perturb the hash, etc. + local job="$1"; shift + local out_vn="$1"; shift + local hash="$( echo "$job $out_vn" | sha256sum )" + hash="${hash:0:7}" + local ix=$(( (0x$hash * $#) / 0x10000000 + 1 )) + out_val="${@:$ix:1}" + eval "$out_vn=\"\$out_val\"" +} + branch_wants_migrupgrade_tests () { case "$branch" in xen-3.*-testing) return 1 ;;