Beispiel #1
0
 def test__get_core_details(self):
     with mock.patch("yardstick.ssh.SSH") as ssh:
         ssh_mock = mock.Mock(autospec=ssh.SSH)
         ssh_mock.execute = \
             mock.Mock(return_value=(1, "", ""))
         ssh_mock.put = \
             mock.Mock(return_value=(1, "", ""))
         cpu_topo = CpuSysCores(ssh_mock)
         subprocess.check_output = mock.Mock(return_value=0)
         lines = ["cpu:1", "topo:2", ""]
         self.assertEqual([{
             'topo': '2',
             'cpu': '1'
         }], cpu_topo._get_core_details(lines))
Beispiel #2
0
 def test_validate_cpu_cfg(self):
     with mock.patch("yardstick.ssh.SSH") as ssh:
         ssh_mock = mock.Mock(autospec=ssh.SSH)
         ssh_mock.execute = \
                 mock.Mock(return_value=(1, "cpu:1\ntest:2\n \n", ""))
         ssh_mock.put = \
             mock.Mock(return_value=(1, "", ""))
         cpu_topo = CpuSysCores(ssh_mock)
         subprocess.check_output = mock.Mock(return_value=0)
         cpu_topo._get_core_details = \
             mock.Mock(side_effect=[[{'Core(s) per socket': '2', 'Thread(s) per core': '1'}],
                                    [{'physical id': '2', 'processor': '1'}]])
         cpu_topo.core_map = \
             {'thread_per_core': '1', '2':['1'], 'cores_per_socket': '2'}
         self.assertEqual(-1, cpu_topo.validate_cpu_cfg())