From 95a53a04a43cba52df4d9683250c444174e9d5de Mon Sep 17 00:00:00 2001 From: Martin Kletzander Date: Tue, 26 Sep 2023 14:18:53 +0200 Subject: [PATCH] test: Fix testNodeGetFreePages MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/test/test_driver.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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) -- 2.39.5