]> xenbits.xensource.com Git - libvirt.git/commitdiff
domaincapstest: Don't read data from host
authorJiri Denemark <jdenemar@redhat.com>
Mon, 27 Jun 2016 13:40:31 +0000 (15:40 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Fri, 1 Jul 2016 10:20:54 +0000 (12:20 +0200)
virQEMUCapsFillDomainCaps would use virHostCPUGetKVMMaxVCPUs for KVM
domains.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
tests/Makefile.am
tests/domaincapsmock.c [new file with mode: 0644]
tests/domaincapstest.c

index 444e0fddfbbd9b2cb6192673ee93e87d6ab3b896..16395403da1812e5e4f78f29490e5ce66e7a2155 100644 (file)
@@ -404,6 +404,7 @@ test_libraries = libshunload.la \
                virrandommock.la \
                virhostcpumock.la \
                nssmock.la \
+               domaincapsmock.la \
                $(NULL)
 if WITH_QEMU
 test_libraries += libqemumonitortestutils.la \
@@ -919,6 +920,12 @@ vircaps2xmltest_SOURCES = \
        vircaps2xmltest.c testutils.h testutils.c
 vircaps2xmltest_LDADD = $(LDADDS)
 
+
+domaincapsmock_la_SOURCES = domaincapsmock.c
+domaincapsmock_la_CFLAGS = $(AM_CFLAGS)
+domaincapsmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+domaincapsmock_la_LIBADD = $(MOCKLIBS_LIBS)
+
 domaincapstest_SOURCES = \
        domaincapstest.c testutils.h testutils.c
 domaincapstest_LDADD = $(LDADDS)
diff --git a/tests/domaincapsmock.c b/tests/domaincapsmock.c
new file mode 100644 (file)
index 0000000..838bc6f
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include <limits.h>
+
+#include "virhostcpu.h"
+
+int
+virHostCPUGetKVMMaxVCPUs(void)
+{
+    return INT_MAX;
+}
index 01ebfcc313862128f6de3f488d07272a836d4b36..efd47695d88e7214f94da5b6616a655f2aaf052b 100644 (file)
@@ -386,4 +386,4 @@ mymain(void)
     return ret;
 }
 
-VIRT_TEST_MAIN(mymain)
+VIRT_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/domaincapsmock.so")