]> xenbits.xensource.com Git - libvirt.git/commitdiff
test driver: Implement testNodeGetFreePages.
authorTomáš Ryšavý <tom.rysavy.0@gmail.com>
Thu, 15 Sep 2016 08:27:09 +0000 (10:27 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 15 Sep 2016 13:28:22 +0000 (15:28 +0200)
Signed-off-by: Tomáš Ryšavý <tom.rysavy.0@gmail.com>
src/test/test_driver.c

index 0391e231865cb33e134e2a0d73aab767a80fd2a4..87799e176b45abff3a29d93c6b7134e0905037f5 100644 (file)
@@ -2791,6 +2791,30 @@ testNodeGetFreeMemory(virConnectPtr conn)
     return freeMem;
 }
 
+static int
+testNodeGetFreePages(virConnectPtr conn ATTRIBUTE_UNUSED,
+                     unsigned int npages,
+                     unsigned int *pages ATTRIBUTE_UNUSED,
+                     int startCell ATTRIBUTE_UNUSED,
+                     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++) {
+        for (j = 0; j < npages; j++) {
+            x = x * 2 + 7;
+            counts[(i * npages) +  j] = x;
+        }
+    }
+
+    return 0;
+}
+
 static int testDomainCreateWithFlags(virDomainPtr domain, unsigned int flags)
 {
     testDriverPtr privconn = domain->conn->privateData;
@@ -6784,6 +6808,7 @@ static virHypervisorDriver testHypervisorDriver = {
     .nodeGetInfo = testNodeGetInfo, /* 0.1.1 */
     .nodeGetCPUStats = testNodeGetCPUStats, /* 2.3.0 */
     .nodeGetFreeMemory = testNodeGetFreeMemory, /* 2.3.0 */
+    .nodeGetFreePages = testNodeGetFreePages, /* 2.3.0 */
     .connectGetCapabilities = testConnectGetCapabilities, /* 0.2.1 */
     .connectGetSysinfo = testConnectGetSysinfo, /* 2.3.0 */
     .connectGetType = testConnectGetType, /* 2.3.0 */