File: cpu_spec.rb

package info (click to toggle)
ruby-specinfra 2.94.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,448 kB
  • sloc: ruby: 10,538; sh: 4; makefile: 4
file content (123 lines) | stat: -rw-r--r-- 3,036 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
require 'spec_helper'

str = <<-EOH
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 60
model name	: Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz
stepping	: 3
microcode	: 0x19
cpu MHz		: 3132.076
cache size	: 6144 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 2
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 5
wp		: yes
flags		: fpu vme de pse
bogomips	: 6264.15
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 60
model name	: Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz
stepping	: 3
microcode	: 0x19
cpu MHz		: 3132.076
cache size	: 6144 KB
physical id	: 0
siblings	: 2
core id		: 1
cpu cores	: 2
apicid		: 1
initial apicid	: 1
fpu		: yes
fpu_exception	: yes
cpuid level	: 5
wp		: yes
flags		: fpu vme de
bogomips	: 6264.15
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:
EOH

describe Specinfra::HostInventory::Cpu do
  let(:host_inventory) { nil }
  describe 'Example of Ubuntu 14.04.1 LTS Kernel version 3.13.11' do
    ret = Specinfra::HostInventory::Cpu.new(host_inventory).parse(str)
    example do
      expect(ret["0"]).to include(
        "vendor_id" => "GenuineIntel",
        "cpu_family" => "6",
        "model" => "60",
        "model_name" => "Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz",
        "stepping" => "3",
        "microcode" => "0x19",
        "cpu_mhz" => "3132.076",
        "cache_size" => "6144KB",
        "physical_id" => "0",
        "siblings" => "2",
        "core_id" => "0",
        "cpu_cores" => "2",
        "apicid" => "0",
        "initial_apicid" => "0",
        "fpu" => "yes",
        "fpu_exception" => "yes",
        "cpuid_level" => "5",
        "wp" => "yes",
        "flags" => ["fpu", "vme", "de", "pse"],
        "bogomips" => "6264.15",
        "clflush_size" => "64",
        "cache_alignment" => "64",
        "address_sizes" => "39 bits physical, 48 bits virtual",
        "power_management" => ""
      )
    end

    example do
      expect(ret["1"]).to include(
        "vendor_id" => "GenuineIntel",
        "cpu_family" => "6",
        "model" => "60",
        "model_name" => "Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz",
        "stepping" => "3",
        "microcode" => "0x19",
        "cpu_mhz" => "3132.076",
        "cache_size" => "6144KB",
        "physical_id" => "0",
        "siblings" => "2",
        "core_id" => "1",
        "cpu_cores" => "2",
        "apicid" => "1",
        "initial_apicid" => "1",
        "fpu" => "yes",
        "fpu_exception" => "yes",
        "cpuid_level" => "5",
        "wp" => "yes",
        "flags" => ["fpu", "vme", "de"],
        "bogomips" => "6264.15",
        "clflush_size" => "64",
        "cache_alignment" => "64",
        "address_sizes" => "39 bits physical, 48 bits virtual",
        "power_management" => ""
      )
    end

    example do
      expect(ret["total"]).to eq "2"
    end
  end
end