]> xenbits.xensource.com Git - libvirt.git/commitdiff
test: Fix testNodeGetFreePages
authorMartin Kletzander <mkletzan@redhat.com>
Tue, 26 Sep 2023 12:18:53 +0000 (14:18 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Tue, 3 Oct 2023 07:13:49 +0000 (09:13 +0200)
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>
src/test/test_driver.c

index c962aa74786edca6323ccd38630c8e9401862873..e87d7cfd445b0d4caa8da68de957b3fea7dc320f 100644 (file)
@@ -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)