From: Martin Kletzander Date: Tue, 26 Sep 2023 12:18:53 +0000 (+0200) Subject: test: Fix testNodeGetFreePages X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=95a53a04a43cba52df4d9683250c444174e9d5de;p=libvirt.git test: Fix testNodeGetFreePages 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 (cherry picked from commit 208569b07b6479e0acd05c5a7e1978b0b641e188) Reviewed-by: Ján Tomko Reviewed-by: Michal Privoznik --- diff --git a/src/test/test_driver.c b/src/test/test_driver.c index c962aa7478..e87d7cfd44 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -4497,24 +4497,25 @@ static int 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)