tests: clitest: Cover all --clock options and aliases

This commit is contained in:
Cole Robinson 2019-05-15 16:08:28 -04:00
parent f986273e17
commit 5f5c7daca1
3 changed files with 18 additions and 9 deletions

View File

@ -32,9 +32,11 @@
<topology sockets="1" cores="3" threads="2"/>
</cpu>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
<timer name="pit" tickpolicy="catchup" present="yes"/>
<timer name="platform" present="no"/>
<timer name="rtc" present="no"/>
<timer name="tsc" present="no"/>
<timer name="hypervclock" present="no"/>
</clock>
<pm>
<suspend-to-mem enabled="no"/>

View File

@ -485,6 +485,7 @@ cache.mode=emulate,cache.level=3
c.add_compare("""
--memory 1024
--disk none
--clock rtc_present=no,pit_present=yes,pit_tickpolicy=catchup,tsc_present=no,platform_present=no,hypervclock_present=no,platform_tickpolicy=foo,hpet_tickpolicy=bar,tsc_tickpolicy=wibble,kvmclock_tickpolicy=wobble,hypervclock_tickpolicy=woo
--boot bios.useserial=no,bios.rebootTimeout=60,cmdline=root=/foo,smbios.mode=host,bootmenu.enable=yes,loader_ro=yes,loader.type=rom,loader=/tmp/foo
--memorybacking access.mode=shared,source.type=anonymous,hugepages=on
--graphics spice,gl=yes

View File

@ -2285,12 +2285,18 @@ class ParserClock(VirtCLIParser):
def _remove_old_options(self):
# These _tickpolicy options have never had any effect in libvirt,
# even though they aren't explicitly rejected. Make them no-ops
self.optdict.pop("platform_tickpolicy", None)
self.optdict.pop("hpet_tickpolicy", None)
self.optdict.pop("tsc_tickpolicy", None)
self.optdict.pop("kvmclock_tickpolicy", None)
self.optdict.pop("hypervclock_tickpolicy", None)
# even though they aren't explicitly rejected. Make them no-ops.
# Keep them unrolled so we can easily check for code coverage
if "platform_tickpolicy" in self.optdict:
self.optdict.pop("platform_tickpolicy")
if "hpet_tickpolicy" in self.optdict:
self.optdict.pop("hpet_tickpolicy")
if "tsc_tickpolicy" in self.optdict:
self.optdict.pop("tsc_tickpolicy")
if "kvmclock_tickpolicy" in self.optdict:
self.optdict.pop("kvmclock_tickpolicy")
if "hypervclock_tickpolicy" in self.optdict:
self.optdict.pop("hypervclock_tickpolicy")
def _parse(self, inst):
self._remove_old_options()