1*cce85725SThomas Huth#!/usr/bin/env python3
2*cce85725SThomas Huth#
3*cce85725SThomas Huth# Ensure CPU die-id can be omitted on -device
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 library is free software; you can redistribute it and/or
11*cce85725SThomas Huth# modify it under the terms of the GNU Lesser General Public
12*cce85725SThomas Huth# License as published by the Free Software Foundation; either
13*cce85725SThomas Huth# version 2.1 of the License, or (at your option) any later version.
14*cce85725SThomas Huth#
15*cce85725SThomas Huth# This library is distributed in the hope that it will be useful,
16*cce85725SThomas Huth# but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cce85725SThomas Huth# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18*cce85725SThomas Huth# Lesser General Public License for more details.
19*cce85725SThomas Huth#
20*cce85725SThomas Huth# You should have received a copy of the GNU Lesser General Public
21*cce85725SThomas Huth# License along with this library; if not, see <http://www.gnu.org/licenses/>.
22*cce85725SThomas Huth#
23*cce85725SThomas Huth
24*cce85725SThomas Huthfrom qemu_test import QemuSystemTest
25*cce85725SThomas Huth
26*cce85725SThomas Huthclass OmittedCPUProps(QemuSystemTest):
27*cce85725SThomas Huth
28*cce85725SThomas Huth    def test_no_die_id(self):
29*cce85725SThomas Huth        self.vm.add_args('-nodefaults', '-S')
30*cce85725SThomas Huth        self.vm.add_args('-smp', '1,sockets=2,cores=2,threads=2,maxcpus=8')
31*cce85725SThomas Huth        self.vm.add_args('-device', 'qemu64-x86_64-cpu,socket-id=1,core-id=0,thread-id=0')
32*cce85725SThomas Huth        self.vm.launch()
33*cce85725SThomas Huth        self.assertEqual(len(self.vm.cmd('query-cpus-fast')), 2)
34*cce85725SThomas Huth
35*cce85725SThomas Huthif __name__ == '__main__':
36*cce85725SThomas Huth    QemuSystemTest.main()
37