summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2012-01-25 15:17:46 +0000
committerDaniel P. Berrange <berrange@redhat.com>2012-01-26 14:03:14 +0000
commite95ef67b35726e80ebeabeb3633268cb82176cdc (patch)
tree1f2078bd3ddc3311c01e21b6ed682902601fcc73 /src/test
parentschema: Relax schema for domain name (diff)
downloadlibvirt-e95ef67b35726e80ebeabeb3633268cb82176cdc.tar.gz
libvirt-e95ef67b35726e80ebeabeb3633268cb82176cdc.tar.bz2
libvirt-e95ef67b35726e80ebeabeb3633268cb82176cdc.zip
Introduce new API for generating random numbers
The old virRandom() API was not generating good random numbers. Replace it with a new API virRandomBits which instead of being told the upper limit, gets told the number of bits of randomness required. * src/util/virrandom.c, src/util/virrandom.h: Add virRandomBits, and move virRandomInitialize * src/util/util.h, src/util/util.c: Delete virRandom and virRandomInitialize * src/libvirt.c, src/security/security_selinux.c, src/test/test_driver.c, src/util/iohelper.c: Update for changes from virRandom to virRandomBits * src/storage/storage_backend_iscsi.c: Remove bogus call to virRandomInitialize & convert to virRandomBits
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test_driver.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 55b889b14..bf6b14835 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -51,6 +51,7 @@
#include "logging.h"
#include "virfile.h"
#include "virtypedparam.h"
+#include "virrandom.h"
#define VIR_FROM_THIS VIR_FROM_TEST
@@ -5316,7 +5317,7 @@ testNodeDeviceCreateXML(virConnectPtr conn,
if (caps->type != VIR_NODE_DEV_CAP_SCSI_HOST)
continue;
- caps->data.scsi_host.host = virRandom(1024);
+ caps->data.scsi_host.host = virRandomBits(10);
caps = caps->next;
}