[libvirt] [PATCH] tests: mock virRandomBits to make it endian stable

Eric Blake eblake at redhat.com
Thu Aug 2 13:17:25 UTC 2018


On 08/02/2018 06:37 AM, Daniel P. Berrangé wrote:
> virRandomBits is implemented in terms of virRandomBytes. Although we
> mock virRandomBytes to give a stable value, this is not sufficient to
> make virRandomBits give a stable value. The result of virRandomBits will
> vary depending on endianness. Thus we mock virRandomBits to return a
> stable value directly.
> 
> Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
> ---

> +uint64_t virRandomBits(int nbits)
> +{
> +    /* Chosen by a fair roll of a 2^64 sided dice */

Where do I get my hands on one of those?  :)

Reviewed-by: Eric Blake <eblake at redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org




More information about the libvir-list mailing list