mirror of https://gitee.com/openkylin/libvirt.git
tests: Mock access to /dev/kvm
Some of our tests try to validate domain XMLs they are working with (not intentionally, simply because they call top level domain XML parse function). Anyway, this implies that we build domain capabilities also - see virQEMUDriverGetDomainCapabilities(). And since some domain XMLs are type of 'kvm' the control gets through virQEMUCapsFillDomainCaps() and virHostCPUGetKVMMaxVCPUs() to opening /dev/kvm which may be missing on the machine we're running 'make check'. Previously, we did not see this issue, because it was masked. If building domain capabilities failed for whatever reason, we ignored the failure. Only v5.9.0-207-gc69e6edea3 uncovered the problem (it changed reval from 0 to -1 if virQEMUDriverGetDomainCapabilities() fails). Since the referenced commit is correct, we need to mock access to /dev/kvm in our tests. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
7bd41cb62c
commit
9e4445ebc3
|
@ -878,5 +878,6 @@ mymain(void)
|
|||
|
||||
VIR_TEST_MAIN_PRELOAD(mymain,
|
||||
VIR_TEST_MOCK("virpci"),
|
||||
VIR_TEST_MOCK("domaincaps"),
|
||||
VIR_TEST_MOCK("virprocess"),
|
||||
VIR_TEST_MOCK("qemuhotplug"));
|
||||
|
|
|
@ -151,7 +151,9 @@ mymain(void)
|
|||
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virpci"))
|
||||
VIR_TEST_MAIN_PRELOAD(mymain,
|
||||
VIR_TEST_MOCK("virpci"),
|
||||
VIR_TEST_MOCK("domaincaps"))
|
||||
|
||||
#else
|
||||
|
||||
|
|
|
@ -217,4 +217,5 @@ mymain(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
VIR_TEST_MAIN(mymain)
|
||||
VIR_TEST_MAIN_PRELOAD(mymain,
|
||||
VIR_TEST_MOCK("domaincaps"))
|
||||
|
|
|
@ -3033,6 +3033,7 @@ mymain(void)
|
|||
|
||||
VIR_TEST_MAIN_PRELOAD(mymain,
|
||||
VIR_TEST_MOCK("qemuxml2argv"),
|
||||
VIR_TEST_MOCK("domaincaps"),
|
||||
VIR_TEST_MOCK("virrandom"),
|
||||
VIR_TEST_MOCK("qemucpu"),
|
||||
VIR_TEST_MOCK("virpci"))
|
||||
|
|
|
@ -1355,6 +1355,7 @@ mymain(void)
|
|||
VIR_TEST_MAIN_PRELOAD(mymain,
|
||||
VIR_TEST_MOCK("virpci"),
|
||||
VIR_TEST_MOCK("virrandom"),
|
||||
VIR_TEST_MOCK("domaincaps"),
|
||||
VIR_TEST_MOCK("virdeterministichash"))
|
||||
|
||||
#else
|
||||
|
|
|
@ -371,4 +371,6 @@ mymain(void)
|
|||
return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/libsecurityselinuxhelper.so")
|
||||
VIR_TEST_MAIN_PRELOAD(mymain,
|
||||
VIR_TEST_MOCK("domaincaps"),
|
||||
abs_builddir "/.libs/libsecurityselinuxhelper.so")
|
||||
|
|
Loading…
Reference in New Issue