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