The function is supposed to return the number of items filled into the
array and not zero. Also change the initialization of the "randomness"
to be based on the startCell so that the values are different for each
cell even for separate calls.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit
208569b07b6479e0acd05c5a7e1978b0b641e188)
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
testNodeGetFreePages(virConnectPtr conn G_GNUC_UNUSED,
unsigned int npages,
unsigned int *pages G_GNUC_UNUSED,
- int startCell G_GNUC_UNUSED,
+ int startCell,
unsigned int cellCount,
unsigned long long *counts,
unsigned int flags)
{
size_t i = 0, j = 0;
- int x = 6;
virCheckFlags(0, -1);
for (i = 0; i < cellCount; i++) {
+ int x = (startCell + i) * 6;
+
for (j = 0; j < npages; j++) {
x = x * 2 + 7;
counts[(i * npages) + j] = x;
}
}
- return 0;
+ return cellCount * npages;
}
static int testDomainCreateWithFlags(virDomainPtr domain, unsigned int flags)