1#!/usr/bin/env python3 2# 3# Sanity check of query-cpu-* results 4# 5# Copyright (c) 2019 Red Hat, Inc. 6# 7# Author: 8# Eduardo Habkost <ehabkost@redhat.com> 9# 10# This work is licensed under the terms of the GNU GPL, version 2 or 11# later. See the COPYING file in the top-level directory. 12 13from qemu_test import QemuSystemTest 14 15class QueryCPUModelExpansion(QemuSystemTest): 16 """ 17 Run query-cpu-model-expansion for each CPU model, and validate results 18 """ 19 20 def test(self): 21 self.set_machine('none') 22 self.vm.add_args('-S') 23 self.vm.launch() 24 25 cpus = self.vm.cmd('query-cpu-definitions') 26 for c in cpus: 27 self.log.info("Checking CPU: %s", c) 28 self.assertNotIn('', c['unavailable-features'], c['name']) 29 30 for c in cpus: 31 model = {'name': c['name']} 32 e = self.vm.cmd('query-cpu-model-expansion', model=model, 33 type='full') 34 self.assertEqual(e['model']['name'], c['name']) 35 36if __name__ == '__main__': 37 QemuSystemTest.main() 38