ohai 14.2.0 → 14.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Rakefile +1 -1
- data/lib/ohai/application.rb +29 -29
- data/lib/ohai/common/dmi.rb +5 -5
- data/lib/ohai/dsl/plugin.rb +3 -3
- data/lib/ohai/dsl/plugin/versionvii.rb +3 -3
- data/lib/ohai/mixin/azure_metadata.rb +2 -2
- data/lib/ohai/mixin/do_metadata.rb +3 -3
- data/lib/ohai/mixin/ec2_metadata.rb +8 -8
- data/lib/ohai/mixin/gce_metadata.rb +2 -2
- data/lib/ohai/mixin/network_constants.rb +1 -1
- data/lib/ohai/mixin/scaleway_metadata.rb +3 -3
- data/lib/ohai/mixin/softlayer_metadata.rb +1 -1
- data/lib/ohai/mixin/string.rb +2 -2
- data/lib/ohai/plugins/aix/cpu.rb +3 -3
- data/lib/ohai/plugins/aix/filesystem.rb +1 -1
- data/lib/ohai/plugins/aix/kernel.rb +1 -1
- data/lib/ohai/plugins/aix/memory.rb +1 -1
- data/lib/ohai/plugins/aix/network.rb +3 -3
- data/lib/ohai/plugins/bsd/virtualization.rb +1 -1
- data/lib/ohai/plugins/cloud.rb +1 -1
- data/lib/ohai/plugins/darwin/hardware.rb +1 -1
- data/lib/ohai/plugins/darwin/network.rb +5 -5
- data/lib/ohai/plugins/darwin/platform.rb +1 -1
- data/lib/ohai/plugins/dmi.rb +6 -6
- data/lib/ohai/plugins/filesystem.rb +5 -5
- data/lib/ohai/plugins/hostname.rb +5 -5
- data/lib/ohai/plugins/kernel.rb +8 -8
- data/lib/ohai/plugins/linux/lspci.rb +4 -4
- data/lib/ohai/plugins/linux/memory.rb +4 -4
- data/lib/ohai/plugins/linux/network.rb +16 -16
- data/lib/ohai/plugins/linux/platform.rb +7 -1
- data/lib/ohai/plugins/netbsd/network.rb +1 -1
- data/lib/ohai/plugins/network.rb +5 -5
- data/lib/ohai/plugins/openbsd/network.rb +1 -1
- data/lib/ohai/plugins/packages.rb +1 -1
- data/lib/ohai/plugins/passwd.rb +4 -4
- data/lib/ohai/plugins/ruby.rb +13 -13
- data/lib/ohai/plugins/solaris2/dmi.rb +3 -3
- data/lib/ohai/plugins/solaris2/filesystem.rb +6 -6
- data/lib/ohai/plugins/solaris2/memory.rb +2 -2
- data/lib/ohai/plugins/solaris2/network.rb +36 -36
- data/lib/ohai/plugins/windows/network.rb +2 -2
- data/lib/ohai/util/win32/group_helper.rb +1 -1
- data/lib/ohai/version.rb +1 -1
- data/spec/functional/application_spec.rb +6 -6
- data/spec/functional/loader_spec.rb +4 -4
- data/spec/functional/plugins/windows/uptime_spec.rb +1 -2
- data/spec/spec_helper.rb +5 -5
- data/spec/unit/application_spec.rb +11 -11
- data/spec/unit/config_spec.rb +5 -5
- data/spec/unit/dsl/plugin_spec.rb +5 -5
- data/spec/unit/hints_spec.rb +2 -2
- data/spec/unit/loader_spec.rb +41 -41
- data/spec/unit/mixin/azure_metadata_spec.rb +3 -3
- data/spec/unit/mixin/command_spec.rb +64 -64
- data/spec/unit/mixin/ec2_metadata_spec.rb +6 -6
- data/spec/unit/mixin/softlayer_metadata_spec.rb +1 -1
- data/spec/unit/plugin_config_spec.rb +9 -9
- data/spec/unit/plugins/abort_spec.rb +6 -6
- data/spec/unit/plugins/aix/cpu_spec.rb +16 -16
- data/spec/unit/plugins/aix/filesystem_spec.rb +57 -57
- data/spec/unit/plugins/aix/network_spec.rb +35 -35
- data/spec/unit/plugins/aix/virtualization_spec.rb +210 -210
- data/spec/unit/plugins/azure_spec.rb +49 -49
- data/spec/unit/plugins/bsd/filesystem_spec.rb +13 -13
- data/spec/unit/plugins/bsd/virtualization_spec.rb +10 -10
- data/spec/unit/plugins/c_spec.rb +54 -54
- data/spec/unit/plugins/chef_spec.rb +3 -3
- data/spec/unit/plugins/darwin/cpu_spec.rb +54 -54
- data/spec/unit/plugins/darwin/filesystem_spec.rb +34 -34
- data/spec/unit/plugins/darwin/hardware_system_profiler_output.rb +1070 -1070
- data/spec/unit/plugins/darwin/memory_spec.rb +16 -16
- data/spec/unit/plugins/darwin/network_spec.rb +382 -382
- data/spec/unit/plugins/digital_ocean_spec.rb +7 -7
- data/spec/unit/plugins/dmi_spec.rb +83 -83
- data/spec/unit/plugins/docker_spec.rb +2 -2
- data/spec/unit/plugins/ec2_spec.rb +156 -156
- data/spec/unit/plugins/eucalyptus_spec.rb +19 -19
- data/spec/unit/plugins/fail_spec.rb +14 -14
- data/spec/unit/plugins/freebsd/cpu_spec.rb +18 -18
- data/spec/unit/plugins/freebsd/kernel_spec.rb +1 -1
- data/spec/unit/plugins/gce_spec.rb +1 -1
- data/spec/unit/plugins/init_package_spec.rb +1 -1
- data/spec/unit/plugins/java_spec.rb +4 -4
- data/spec/unit/plugins/joyent_spec.rb +9 -9
- data/spec/unit/plugins/linux/block_device_spec.rb +1 -1
- data/spec/unit/plugins/linux/cpu_spec.rb +155 -155
- data/spec/unit/plugins/linux/filesystem_spec.rb +229 -229
- data/spec/unit/plugins/linux/kernel_spec.rb +9 -9
- data/spec/unit/plugins/linux/lsb_spec.rb +18 -18
- data/spec/unit/plugins/linux/lspci_spec.rb +58 -58
- data/spec/unit/plugins/linux/mdadm_spec.rb +54 -54
- data/spec/unit/plugins/linux/memory_spec.rb +35 -35
- data/spec/unit/plugins/linux/network_spec.rb +464 -464
- data/spec/unit/plugins/linux/platform_spec.rb +84 -68
- data/spec/unit/plugins/linux/systemd_paths_spec.rb +40 -40
- data/spec/unit/plugins/linux/uptime_spec.rb +1 -1
- data/spec/unit/plugins/linux/virtualization_spec.rb +197 -197
- data/spec/unit/plugins/mono_spec.rb +11 -11
- data/spec/unit/plugins/netbsd/kernel_spec.rb +1 -1
- data/spec/unit/plugins/network_spec.rb +2 -2
- data/spec/unit/plugins/openstack_spec.rb +43 -43
- data/spec/unit/plugins/os_spec.rb +1 -1
- data/spec/unit/plugins/passwd_spec.rb +9 -9
- data/spec/unit/plugins/php_spec.rb +22 -22
- data/spec/unit/plugins/powershell_spec.rb +13 -13
- data/spec/unit/plugins/rackspace_spec.rb +38 -38
- data/spec/unit/plugins/ruby_spec.rb +14 -14
- data/spec/unit/plugins/scaleway_spec.rb +6 -6
- data/spec/unit/plugins/scsi_spec.rb +7 -7
- data/spec/unit/plugins/solaris2/cpu_spec.rb +2594 -2594
- data/spec/unit/plugins/solaris2/dmi_spec.rb +91 -91
- data/spec/unit/plugins/solaris2/filesystem.rb +8 -8
- data/spec/unit/plugins/solaris2/kernel_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/network_spec.rb +92 -93
- data/spec/unit/plugins/solaris2/platform_spec.rb +24 -24
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +22 -22
- data/spec/unit/plugins/ssh_host_keys_spec.rb +12 -12
- data/spec/unit/plugins/sysconf_spec.rb +321 -321
- data/spec/unit/plugins/virtualbox_spec.rb +27 -27
- data/spec/unit/plugins/windows/cpu_spec.rb +9 -9
- data/spec/unit/plugins/windows/kernel_spec.rb +12 -12
- data/spec/unit/plugins/windows/uptime_spec.rb +1 -1
- data/spec/unit/plugins/zpools_spec.rb +41 -41
- data/spec/unit/runner_spec.rb +2 -2
- data/spec/unit/system_spec.rb +55 -55
- metadata +3 -4
- data/docs/man/man1/ohai.1 +0 -97
@@ -53,9 +53,9 @@ describe Ohai::System, "plugin azure" do
|
|
53
53
|
|
54
54
|
before do
|
55
55
|
# skips all the metadata logic unless we want to test it
|
56
|
-
allow(plugin).to receive(:can_socket_connect?)
|
57
|
-
with(Ohai::Mixin::AzureMetadata::AZURE_METADATA_ADDR, 80)
|
58
|
-
and_return(false)
|
56
|
+
allow(plugin).to receive(:can_socket_connect?)
|
57
|
+
.with(Ohai::Mixin::AzureMetadata::AZURE_METADATA_ADDR, 80)
|
58
|
+
.and_return(false)
|
59
59
|
end
|
60
60
|
|
61
61
|
shared_examples_for "!azure" do
|
@@ -96,26 +96,26 @@ describe Ohai::System, "plugin azure" do
|
|
96
96
|
allow(Dir).to receive(:exist?).with('C:\WindowsAzure').and_return(false)
|
97
97
|
allow(File).to receive(:exist?).with("/var/lib/dhcp/dhclient.eth0.leases").and_return(true)
|
98
98
|
@double_file = double("/var/lib/dhcp/dhclient.eth0.leases")
|
99
|
-
allow(@double_file).to receive(:each)
|
100
|
-
and_yield("lease {")
|
101
|
-
and_yield(' interface "eth0";')
|
102
|
-
and_yield(" fixed-address 192.168.1.194;")
|
103
|
-
and_yield(" option subnet-mask 255.255.255.0;")
|
104
|
-
and_yield(" option routers 192.168.1.1;")
|
105
|
-
and_yield(" option dhcp-lease-time 86400;")
|
106
|
-
and_yield(" option dhcp-message-type 5;")
|
107
|
-
and_yield(" option domain-name-servers 8.8.8.8;")
|
108
|
-
and_yield(" option dhcp-server-identifier 192.168.1.2;")
|
109
|
-
and_yield(" option interface-mtu 1454;")
|
110
|
-
and_yield(" option dhcp-renewal-time 42071;")
|
111
|
-
and_yield(" option broadcast-address 192.168.1.255;")
|
112
|
-
and_yield(" option dhcp-rebinding-time 74471;")
|
113
|
-
and_yield(' option host-name "host-192-168-1-194";')
|
114
|
-
and_yield(' option domain-name "openstacklocal";')
|
115
|
-
and_yield(" renew 2 2016/03/01 01:49:41;")
|
116
|
-
and_yield(" rebind 2 2016/03/01 13:22:07;")
|
117
|
-
and_yield(" expire 2 2016/03/01 16:40:56;")
|
118
|
-
and_yield("}")
|
99
|
+
allow(@double_file).to receive(:each)
|
100
|
+
.and_yield("lease {")
|
101
|
+
.and_yield(' interface "eth0";')
|
102
|
+
.and_yield(" fixed-address 192.168.1.194;")
|
103
|
+
.and_yield(" option subnet-mask 255.255.255.0;")
|
104
|
+
.and_yield(" option routers 192.168.1.1;")
|
105
|
+
.and_yield(" option dhcp-lease-time 86400;")
|
106
|
+
.and_yield(" option dhcp-message-type 5;")
|
107
|
+
.and_yield(" option domain-name-servers 8.8.8.8;")
|
108
|
+
.and_yield(" option dhcp-server-identifier 192.168.1.2;")
|
109
|
+
.and_yield(" option interface-mtu 1454;")
|
110
|
+
.and_yield(" option dhcp-renewal-time 42071;")
|
111
|
+
.and_yield(" option broadcast-address 192.168.1.255;")
|
112
|
+
.and_yield(" option dhcp-rebinding-time 74471;")
|
113
|
+
.and_yield(' option host-name "host-192-168-1-194";')
|
114
|
+
.and_yield(' option domain-name "openstacklocal";')
|
115
|
+
.and_yield(" renew 2 2016/03/01 01:49:41;")
|
116
|
+
.and_yield(" rebind 2 2016/03/01 13:22:07;")
|
117
|
+
.and_yield(" expire 2 2016/03/01 16:40:56;")
|
118
|
+
.and_yield("}")
|
119
119
|
allow(File).to receive(:open).with("/var/lib/dhcp/dhclient.eth0.leases").and_return(@double_file)
|
120
120
|
end
|
121
121
|
|
@@ -161,26 +161,26 @@ describe Ohai::System, "plugin azure" do
|
|
161
161
|
allow(Dir).to receive(:exist?).with('C:\WindowsAzure').and_return(false)
|
162
162
|
allow(File).to receive(:exist?).with("/var/lib/dhcp/dhclient.eth0.leases").and_return(true)
|
163
163
|
@double_file = double("/var/lib/dhcp/dhclient.eth0.leases")
|
164
|
-
allow(@double_file).to receive(:each)
|
165
|
-
and_yield("lease {")
|
166
|
-
and_yield(' interface "eth0";')
|
167
|
-
and_yield(" fixed-address 10.1.0.5;")
|
168
|
-
and_yield(' server-name "RD24BE05C6F140";')
|
169
|
-
and_yield(" option subnet-mask 255.255.255.0;")
|
170
|
-
and_yield(" option dhcp-lease-time 4294967295;")
|
171
|
-
and_yield(" option routers 10.1.0.1;")
|
172
|
-
and_yield(" option dhcp-message-type 5;")
|
173
|
-
and_yield(" option dhcp-server-identifier 168.63.129.16;")
|
174
|
-
and_yield(" option domain-name-servers 168.63.129.16;")
|
175
|
-
and_yield(" option dhcp-renewal-time 4294967295;")
|
176
|
-
and_yield(" option rfc3442-classless-static-routes 0,10,1,0,1,32,168,63,129,16,10,1,0,1;")
|
177
|
-
and_yield(" option unknown-245 a8:3f:81:10;")
|
178
|
-
and_yield(" option dhcp-rebinding-time 4294967295;")
|
179
|
-
and_yield(' option domain-name "v4wvfurds4relghweduc4zqjmd.dx.internal.cloudapp.net";')
|
180
|
-
and_yield(" renew 5 2152/03/10 09:03:39;")
|
181
|
-
and_yield(" rebind 5 2152/03/10 09:03:39;")
|
182
|
-
and_yield(" expire 5 2152/03/10 09:03:39;")
|
183
|
-
and_yield("}")
|
164
|
+
allow(@double_file).to receive(:each)
|
165
|
+
.and_yield("lease {")
|
166
|
+
.and_yield(' interface "eth0";')
|
167
|
+
.and_yield(" fixed-address 10.1.0.5;")
|
168
|
+
.and_yield(' server-name "RD24BE05C6F140";')
|
169
|
+
.and_yield(" option subnet-mask 255.255.255.0;")
|
170
|
+
.and_yield(" option dhcp-lease-time 4294967295;")
|
171
|
+
.and_yield(" option routers 10.1.0.1;")
|
172
|
+
.and_yield(" option dhcp-message-type 5;")
|
173
|
+
.and_yield(" option dhcp-server-identifier 168.63.129.16;")
|
174
|
+
.and_yield(" option domain-name-servers 168.63.129.16;")
|
175
|
+
.and_yield(" option dhcp-renewal-time 4294967295;")
|
176
|
+
.and_yield(" option rfc3442-classless-static-routes 0,10,1,0,1,32,168,63,129,16,10,1,0,1;")
|
177
|
+
.and_yield(" option unknown-245 a8:3f:81:10;")
|
178
|
+
.and_yield(" option dhcp-rebinding-time 4294967295;")
|
179
|
+
.and_yield(' option domain-name "v4wvfurds4relghweduc4zqjmd.dx.internal.cloudapp.net";')
|
180
|
+
.and_yield(" renew 5 2152/03/10 09:03:39;")
|
181
|
+
.and_yield(" rebind 5 2152/03/10 09:03:39;")
|
182
|
+
.and_yield(" expire 5 2152/03/10 09:03:39;")
|
183
|
+
.and_yield("}")
|
184
184
|
allow(File).to receive(:open).with("/var/lib/dhcp/dhclient.eth0.leases").and_return(@double_file)
|
185
185
|
end
|
186
186
|
|
@@ -193,9 +193,9 @@ describe Ohai::System, "plugin azure" do
|
|
193
193
|
end
|
194
194
|
|
195
195
|
it "does not return metadata information" do
|
196
|
-
allow(plugin).to receive(:can_socket_connect?)
|
197
|
-
with(Ohai::Mixin::AzureMetadata::AZURE_METADATA_ADDR, 80)
|
198
|
-
and_return(true)
|
196
|
+
allow(plugin).to receive(:can_socket_connect?)
|
197
|
+
.with(Ohai::Mixin::AzureMetadata::AZURE_METADATA_ADDR, 80)
|
198
|
+
.and_return(true)
|
199
199
|
allow(plugin).to receive(:fetch_metadata).and_return(nil)
|
200
200
|
|
201
201
|
plugin.run
|
@@ -207,9 +207,9 @@ describe Ohai::System, "plugin azure" do
|
|
207
207
|
describe "with responsive metadata endpoint" do
|
208
208
|
before(:each) do
|
209
209
|
allow(plugin).to receive(:hint?).with("azure").and_return({})
|
210
|
-
allow(plugin).to receive(:can_socket_connect?)
|
211
|
-
with(Ohai::Mixin::AzureMetadata::AZURE_METADATA_ADDR, 80)
|
212
|
-
and_return(true)
|
210
|
+
allow(plugin).to receive(:can_socket_connect?)
|
211
|
+
.with(Ohai::Mixin::AzureMetadata::AZURE_METADATA_ADDR, 80)
|
212
|
+
.and_return(true)
|
213
213
|
allow(plugin).to receive(:fetch_metadata).and_return(response_data)
|
214
214
|
plugin.run
|
215
215
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Matthew Kent (<mkent@magoazul.com>)
|
3
3
|
# Author:: Tim Smith (<tsmith@chef.io>)
|
4
|
-
# Copyright:: Copyright (c) 2011-
|
4
|
+
# Copyright:: Copyright (c) 2011-2018, Chef Software Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -31,18 +31,18 @@ describe Ohai::System, "BSD filesystem plugin" do
|
|
31
31
|
|
32
32
|
describe "when gathering filesystem usage data from df" do
|
33
33
|
before(:each) do
|
34
|
-
@stdout =
|
35
|
-
Filesystem 1K-blocks Used Avail Capacity Mounted on
|
36
|
-
/dev/ada0p2 9637788 3313504 5553264 37% /
|
37
|
-
devfs 1 1 0 100% /dev
|
34
|
+
@stdout = <<~DF
|
35
|
+
Filesystem 1K-blocks Used Avail Capacity Mounted on
|
36
|
+
/dev/ada0p2 9637788 3313504 5553264 37% /
|
37
|
+
devfs 1 1 0 100% /dev
|
38
38
|
DF
|
39
39
|
allow(plugin).to receive(:shell_out).with("df").and_return(mock_shell_out(0, @stdout, ""))
|
40
40
|
|
41
|
-
@inode_stdout =
|
42
|
-
Filesystem 512-blocks Used Avail Capacity iused ifree %iused Mounted on
|
43
|
-
/dev/ada0p2 15411832 5109256 9069632 36% 252576 790750 24% /
|
44
|
-
devfs 2 2 0 100% 0 0 100% /dev
|
45
|
-
|
41
|
+
@inode_stdout = <<~DFI
|
42
|
+
Filesystem 512-blocks Used Avail Capacity iused ifree %iused Mounted on
|
43
|
+
/dev/ada0p2 15411832 5109256 9069632 36% 252576 790750 24% /
|
44
|
+
devfs 2 2 0 100% 0 0 100% /dev
|
45
|
+
DFI
|
46
46
|
allow(plugin).to receive(:shell_out).with("df -iP").and_return(mock_shell_out(0, @inode_stdout, ""))
|
47
47
|
end
|
48
48
|
|
@@ -103,9 +103,9 @@ DFi
|
|
103
103
|
|
104
104
|
describe "when gathering mounted filesystem data from mount" do
|
105
105
|
before(:each) do
|
106
|
-
@stdout =
|
107
|
-
/dev/ada0p2 on / (ufs, local, journaled soft-updates)
|
108
|
-
devfs on /dev (devfs, local, multilabel)
|
106
|
+
@stdout = <<~MOUNT
|
107
|
+
/dev/ada0p2 on / (ufs, local, journaled soft-updates)
|
108
|
+
devfs on /dev (devfs, local, multilabel)
|
109
109
|
MOUNT
|
110
110
|
allow(plugin).to receive(:shell_out).with("mount -l").and_return(mock_shell_out(0, @stdout, ""))
|
111
111
|
end
|
@@ -23,7 +23,7 @@ describe Ohai::System, "BSD virtualization plugin" do
|
|
23
23
|
@plugin = get_plugin("bsd/virtualization")
|
24
24
|
allow(@plugin).to receive(:collect_os).and_return(:freebsd)
|
25
25
|
allow(@plugin).to receive(:shell_out).with("sysctl -n security.jail.jailed").and_return(mock_shell_out(0, "0", ""))
|
26
|
-
allow(@plugin).to receive(:shell_out).with(
|
26
|
+
allow(@plugin).to receive(:shell_out).with((Ohai.abs_path( "/sbin/kldstat" )).to_s).and_return(mock_shell_out(0, "", ""))
|
27
27
|
allow(@plugin).to receive(:shell_out).with("jls -nd").and_return(mock_shell_out(0, "", ""))
|
28
28
|
allow(@plugin).to receive(:shell_out).with("sysctl -n hw.model").and_return(mock_shell_out(0, "", ""))
|
29
29
|
allow(@plugin).to receive(:shell_out).with("sysctl -n kern.vm_guest").and_return(mock_shell_out(0, "", ""))
|
@@ -72,12 +72,12 @@ describe Ohai::System, "BSD virtualization plugin" do
|
|
72
72
|
|
73
73
|
context "when on a virtualbox guest" do
|
74
74
|
before do
|
75
|
-
@vbox_guest =
|
76
|
-
Id Refs Address Size Name
|
77
|
-
1 40 0xffffffff80100000 d20428 kernel
|
78
|
-
7 3 0xffffffff81055000 41e88 vboxguest.ko
|
75
|
+
@vbox_guest = <<~OUT
|
76
|
+
Id Refs Address Size Name
|
77
|
+
1 40 0xffffffff80100000 d20428 kernel
|
78
|
+
7 3 0xffffffff81055000 41e88 vboxguest.ko
|
79
79
|
OUT
|
80
|
-
allow(@plugin).to receive(:shell_out).with(
|
80
|
+
allow(@plugin).to receive(:shell_out).with((Ohai.abs_path("/sbin/kldstat")).to_s).and_return(mock_shell_out(0, @vbox_guest, ""))
|
81
81
|
end
|
82
82
|
|
83
83
|
it "detects we are a guest" do
|
@@ -90,10 +90,10 @@ OUT
|
|
90
90
|
|
91
91
|
context "when on a virtualbox host" do
|
92
92
|
before do
|
93
|
-
@stdout =
|
94
|
-
Id Refs Address Size Name
|
95
|
-
1 40 0xffffffff80100000 d20428 kernel
|
96
|
-
7 3 0xffffffff81055000 41e88 vboxdrv.ko
|
93
|
+
@stdout = <<~OUT
|
94
|
+
Id Refs Address Size Name
|
95
|
+
1 40 0xffffffff80100000 d20428 kernel
|
96
|
+
7 3 0xffffffff81055000 41e88 vboxdrv.ko
|
97
97
|
OUT
|
98
98
|
allow(@plugin).to receive(:shell_out).with("/sbin/kldstat").and_return(mock_shell_out(0, @stdout, ""))
|
99
99
|
end
|
data/spec/unit/plugins/c_spec.rb
CHANGED
@@ -18,64 +18,64 @@
|
|
18
18
|
|
19
19
|
require_relative "../../spec_helper.rb"
|
20
20
|
|
21
|
-
C_GCC =
|
22
|
-
Using built-in specs.
|
23
|
-
COLLECT_GCC=gcc
|
24
|
-
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
|
25
|
-
Target: x86_64-linux-gnu
|
26
|
-
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
|
27
|
-
Thread model: posix
|
28
|
-
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
|
21
|
+
C_GCC = <<~EOF.freeze
|
22
|
+
Using built-in specs.
|
23
|
+
COLLECT_GCC=gcc
|
24
|
+
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
|
25
|
+
Target: x86_64-linux-gnu
|
26
|
+
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
|
27
|
+
Thread model: posix
|
28
|
+
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
|
29
29
|
EOF
|
30
30
|
|
31
|
-
C_GLIBC =
|
32
|
-
GNU C Library stable release version 2.5, by Roland McGrath et al.
|
33
|
-
Copyright (C) 2006 Free Software Foundation, Inc.
|
34
|
-
This is free software; see the source for copying conditions.
|
35
|
-
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
|
36
|
-
PARTICULAR PURPOSE.
|
37
|
-
Compiled by GNU CC version 4.1.2 20080704 (Red Hat 4.1.2-44).
|
38
|
-
Compiled on a Linux 2.6.9 system on 2009-09-02.
|
39
|
-
Available extensions:
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
Thread-local storage support included.
|
49
|
-
For bug reporting instructions, please see:
|
50
|
-
<http://www.gnu.org/software/libc/bugs.html>.
|
31
|
+
C_GLIBC = <<~EOF.freeze
|
32
|
+
GNU C Library stable release version 2.5, by Roland McGrath et al.
|
33
|
+
Copyright (C) 2006 Free Software Foundation, Inc.
|
34
|
+
This is free software; see the source for copying conditions.
|
35
|
+
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
|
36
|
+
PARTICULAR PURPOSE.
|
37
|
+
Compiled by GNU CC version 4.1.2 20080704 (Red Hat 4.1.2-44).
|
38
|
+
Compiled on a Linux 2.6.9 system on 2009-09-02.
|
39
|
+
Available extensions:
|
40
|
+
The C stubs add-on version 2.1.2.
|
41
|
+
crypt add-on version 2.1 by Michael Glad and others
|
42
|
+
GNU Libidn by Simon Josefsson
|
43
|
+
GNU libio by Per Bothner
|
44
|
+
NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
|
45
|
+
Native POSIX Threads Library by Ulrich Drepper et al
|
46
|
+
BIND-8.2.3-T5B
|
47
|
+
RT using linux kernel aio
|
48
|
+
Thread-local storage support included.
|
49
|
+
For bug reporting instructions, please see:
|
50
|
+
<http://www.gnu.org/software/libc/bugs.html>.
|
51
51
|
EOF
|
52
52
|
|
53
|
-
C_CL =
|
54
|
-
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86
|
55
|
-
Copyright (C) Microsoft Corporation. All rights reserved.
|
53
|
+
C_CL = <<~EOF.freeze
|
54
|
+
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86
|
55
|
+
Copyright (C) Microsoft Corporation. All rights reserved.
|
56
56
|
EOF
|
57
57
|
|
58
|
-
C_VS =
|
58
|
+
C_VS = <<~EOF.freeze
|
59
59
|
|
60
|
-
Microsoft (R) Visual Studio Version 8.0.50727.762.
|
61
|
-
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.
|
60
|
+
Microsoft (R) Visual Studio Version 8.0.50727.762.
|
61
|
+
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.
|
62
62
|
EOF
|
63
63
|
|
64
|
-
C_XLC =
|
65
|
-
IBM XL C/C++ Enterprise Edition for AIX, V9.0
|
66
|
-
Version: 09.00.0000.0000
|
64
|
+
C_XLC = <<~EOF.freeze
|
65
|
+
IBM XL C/C++ Enterprise Edition for AIX, V9.0
|
66
|
+
Version: 09.00.0000.0000
|
67
67
|
EOF
|
68
68
|
|
69
|
-
C_SUN =
|
70
|
-
cc: Sun C 5.8 Patch 121016-06 2007/08/01
|
69
|
+
C_SUN = <<~EOF.freeze
|
70
|
+
cc: Sun C 5.8 Patch 121016-06 2007/08/01
|
71
71
|
EOF
|
72
72
|
|
73
|
-
C_HPUX =
|
74
|
-
/opt/ansic/bin/cc:
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
73
|
+
C_HPUX = <<~EOF.freeze
|
74
|
+
/opt/ansic/bin/cc:
|
75
|
+
$Revision: 92453-07 linker linker crt0.o B.11.47 051104 $
|
76
|
+
LINT B.11.11.16 CXREF B.11.11.16
|
77
|
+
HP92453-01 B.11.11.16 HP C Compiler
|
78
|
+
$ PATCH/11.00:PHCO_27774 Oct 3 2002 09:45:59 $
|
79
79
|
EOF
|
80
80
|
|
81
81
|
describe Ohai::System, "plugin c" do
|
@@ -85,7 +85,7 @@ describe Ohai::System, "plugin c" do
|
|
85
85
|
before(:each) do
|
86
86
|
|
87
87
|
plugin[:languages] = Mash.new
|
88
|
-
#gcc
|
88
|
+
# gcc
|
89
89
|
allow(plugin).to receive(:shell_out).with("gcc -v").and_return(mock_shell_out(0, "", C_GCC))
|
90
90
|
end
|
91
91
|
|
@@ -95,7 +95,7 @@ describe Ohai::System, "plugin c" do
|
|
95
95
|
allow(plugin).to receive(:shell_out).with("xlc -qversion").and_return(mock_shell_out(0, C_XLC, ""))
|
96
96
|
end
|
97
97
|
|
98
|
-
#ibm xlc
|
98
|
+
# ibm xlc
|
99
99
|
it "gets the xlc version from running xlc -qversion" do
|
100
100
|
expect(plugin).to receive(:shell_out).with("xlc -qversion").and_return(mock_shell_out(0, C_XLC, ""))
|
101
101
|
plugin.run
|
@@ -138,7 +138,7 @@ describe Ohai::System, "plugin c" do
|
|
138
138
|
allow(plugin).to receive(:shell_out).with("what /opt/ansic/bin/cc").and_return(mock_shell_out(0, C_HPUX, ""))
|
139
139
|
end
|
140
140
|
|
141
|
-
#hpux cc
|
141
|
+
# hpux cc
|
142
142
|
it "gets the cc version from running what cc" do
|
143
143
|
expect(plugin).to receive(:shell_out).with("what /opt/ansic/bin/cc").and_return(mock_shell_out(0, C_HPUX, ""))
|
144
144
|
plugin.run
|
@@ -194,7 +194,7 @@ describe Ohai::System, "plugin c" do
|
|
194
194
|
allow(plugin).to receive(:shell_out).with("devenv.com /\?").and_return(mock_shell_out(0, C_VS, ""))
|
195
195
|
end
|
196
196
|
|
197
|
-
#ms cl
|
197
|
+
# ms cl
|
198
198
|
it "gets the cl version from running cl /?" do
|
199
199
|
expect(plugin).to receive(:shell_out).with("cl /\?")
|
200
200
|
plugin.run
|
@@ -223,7 +223,7 @@ describe Ohai::System, "plugin c" do
|
|
223
223
|
expect(plugin[:languages][:c]).not_to be_empty # expect other attributes
|
224
224
|
end
|
225
225
|
|
226
|
-
#ms vs
|
226
|
+
# ms vs
|
227
227
|
it "gets the vs version from running devenv.com /?" do
|
228
228
|
expect(plugin).to receive(:shell_out).with("devenv.com /\?").and_return(mock_shell_out(0, C_VS, ""))
|
229
229
|
plugin.run
|
@@ -259,11 +259,11 @@ describe Ohai::System, "plugin c" do
|
|
259
259
|
# glibc
|
260
260
|
allow(plugin).to receive(:shell_out).with("/lib/libc.so.6").and_return(mock_shell_out(0, C_GLIBC, ""))
|
261
261
|
allow(plugin).to receive(:shell_out).with("/lib64/libc.so.6").and_return(mock_shell_out(0, C_GLIBC, ""))
|
262
|
-
#sun pro
|
262
|
+
# sun pro
|
263
263
|
allow(plugin).to receive(:shell_out).with("cc -V -flags").and_return(mock_shell_out(0, "", C_SUN))
|
264
264
|
end
|
265
265
|
|
266
|
-
#gcc
|
266
|
+
# gcc
|
267
267
|
it "gets the gcc version from running gcc -v" do
|
268
268
|
expect(plugin).to receive(:shell_out).with("gcc -v")
|
269
269
|
plugin.run
|
@@ -307,7 +307,7 @@ describe Ohai::System, "plugin c" do
|
|
307
307
|
expect(plugin[:languages][:c]).not_to be_empty # expect other attributes
|
308
308
|
end
|
309
309
|
|
310
|
-
#glibc
|
310
|
+
# glibc
|
311
311
|
it "gets the glibc x.x.x version from running /lib/libc.so.6" do
|
312
312
|
expect(plugin).to receive(:shell_out).with("/lib/libc.so.6")
|
313
313
|
plugin.run
|
@@ -345,7 +345,7 @@ describe Ohai::System, "plugin c" do
|
|
345
345
|
expect(plugin.languages[:c][:glibc][:version]).to eql("2.5")
|
346
346
|
end
|
347
347
|
|
348
|
-
#sun pro
|
348
|
+
# sun pro
|
349
349
|
it "gets the cc version from running cc -V -flags" do
|
350
350
|
expect(plugin).to receive(:shell_out).with("cc -V -flags").and_return(mock_shell_out(0, "", C_SUN))
|
351
351
|
plugin.run
|
@@ -27,18 +27,18 @@ begin
|
|
27
27
|
@plugin = get_plugin("chef")
|
28
28
|
end
|
29
29
|
|
30
|
-
it "should set [:chef_packages][:chef][:version] to the current chef version", :
|
30
|
+
it "should set [:chef_packages][:chef][:version] to the current chef version", if: defined?(Chef) do
|
31
31
|
@plugin.run
|
32
32
|
expect(@plugin[:chef_packages][:chef][:version]).to eq(Chef::VERSION)
|
33
33
|
end
|
34
34
|
|
35
|
-
pending "would set [:chef_packages][:chef][:version] if chef was available", :
|
35
|
+
pending "would set [:chef_packages][:chef][:version] if chef was available", unless: defined?(Chef)
|
36
36
|
end
|
37
37
|
|
38
38
|
rescue LoadError
|
39
39
|
# the chef module is not available, ignoring.
|
40
40
|
|
41
41
|
describe Ohai::System, "plugin chef" do
|
42
|
-
pending "would set [:chef_packages][:chef][:version] if chef was available", :
|
42
|
+
pending "would set [:chef_packages][:chef][:version] if chef was available", unless: defined?(Chef)
|
43
43
|
end
|
44
44
|
end
|
@@ -21,60 +21,60 @@ require_relative "../../../spec_helper.rb"
|
|
21
21
|
describe Ohai::System, "Darwin cpu plugin" do
|
22
22
|
before(:each) do
|
23
23
|
@plugin = get_plugin("darwin/cpu")
|
24
|
-
@stdout =
|
25
|
-
hw.ncpu: 8
|
26
|
-
hw.byteorder: 1234
|
27
|
-
hw.memsize: 17179869184
|
28
|
-
hw.activecpu: 8
|
29
|
-
hw.packages: 1
|
30
|
-
hw.tbfrequency: 1000000000
|
31
|
-
hw.l3cachesize: 6291456
|
32
|
-
hw.l2cachesize: 262144
|
33
|
-
hw.l1dcachesize: 32768
|
34
|
-
hw.l1icachesize: 32768
|
35
|
-
hw.cachelinesize: 64
|
36
|
-
hw.cpufrequency: 2800000000
|
37
|
-
hw.busfrequency: 100000000
|
38
|
-
hw.pagesize32: 4096
|
39
|
-
hw.pagesize: 4096
|
40
|
-
hw.cpufamily: 280134364
|
41
|
-
hw.cpu64bit_capable: 1
|
42
|
-
hw.cpusubtype: 8
|
43
|
-
hw.cputype: 7
|
44
|
-
hw.logicalcpu_max: 8
|
45
|
-
hw.logicalcpu: 8
|
46
|
-
hw.physicalcpu_max: 4
|
47
|
-
hw.physicalcpu: 4
|
48
|
-
hw.targettype: Mac
|
49
|
-
hw.cputhreadtype: 1
|
50
|
-
machdep.cpu.thread_count: 8
|
51
|
-
machdep.cpu.core_count: 4
|
52
|
-
machdep.cpu.address_bits.virtual: 48
|
53
|
-
machdep.cpu.address_bits.physical: 39
|
54
|
-
machdep.cpu.cache.size: 256
|
55
|
-
machdep.cpu.cache.L2_associativity: 8
|
56
|
-
machdep.cpu.cache.linesize: 64
|
57
|
-
machdep.cpu.processor_flag: 5
|
58
|
-
machdep.cpu.microcode_version: 15
|
59
|
-
machdep.cpu.cores_per_package: 8
|
60
|
-
machdep.cpu.logical_per_package: 16
|
61
|
-
machdep.cpu.extfeatures: SYSCALL XD 1GBPAGE EM64T LAHF LZCNT RDTSCP TSCI
|
62
|
-
machdep.cpu.leaf7_features: SMEP ERMS RDWRFSGS TSC_THREAD_OFFSET BMI1 HLE AVX2 BMI2 INVPCID RTM FPU_CSDS
|
63
|
-
machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX SMX EST TM2 SSSE3 FMA CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC MOVBE POPCNT AES PCID XSAVE OSXSAVE SEGLIM64 TSCTMR AVX1.0 RDRAND F16C
|
64
|
-
machdep.cpu.brand: 0
|
65
|
-
machdep.cpu.signature: 263777
|
66
|
-
machdep.cpu.extfeature_bits: 142473169152
|
67
|
-
machdep.cpu.leaf7_feature_bits: 12219
|
68
|
-
machdep.cpu.feature_bits: 9221960262849657855
|
69
|
-
machdep.cpu.stepping: 1
|
70
|
-
machdep.cpu.extfamily: 0
|
71
|
-
machdep.cpu.extmodel: 4
|
72
|
-
machdep.cpu.model: 70
|
73
|
-
machdep.cpu.family: 6
|
74
|
-
machdep.cpu.brand_string: Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
|
75
|
-
machdep.cpu.vendor: GenuineIntel
|
76
|
-
machdep.cpu.max_ext: 2147483656
|
77
|
-
machdep.cpu.max_basic: 13
|
24
|
+
@stdout = <<~CTL
|
25
|
+
hw.ncpu: 8
|
26
|
+
hw.byteorder: 1234
|
27
|
+
hw.memsize: 17179869184
|
28
|
+
hw.activecpu: 8
|
29
|
+
hw.packages: 1
|
30
|
+
hw.tbfrequency: 1000000000
|
31
|
+
hw.l3cachesize: 6291456
|
32
|
+
hw.l2cachesize: 262144
|
33
|
+
hw.l1dcachesize: 32768
|
34
|
+
hw.l1icachesize: 32768
|
35
|
+
hw.cachelinesize: 64
|
36
|
+
hw.cpufrequency: 2800000000
|
37
|
+
hw.busfrequency: 100000000
|
38
|
+
hw.pagesize32: 4096
|
39
|
+
hw.pagesize: 4096
|
40
|
+
hw.cpufamily: 280134364
|
41
|
+
hw.cpu64bit_capable: 1
|
42
|
+
hw.cpusubtype: 8
|
43
|
+
hw.cputype: 7
|
44
|
+
hw.logicalcpu_max: 8
|
45
|
+
hw.logicalcpu: 8
|
46
|
+
hw.physicalcpu_max: 4
|
47
|
+
hw.physicalcpu: 4
|
48
|
+
hw.targettype: Mac
|
49
|
+
hw.cputhreadtype: 1
|
50
|
+
machdep.cpu.thread_count: 8
|
51
|
+
machdep.cpu.core_count: 4
|
52
|
+
machdep.cpu.address_bits.virtual: 48
|
53
|
+
machdep.cpu.address_bits.physical: 39
|
54
|
+
machdep.cpu.cache.size: 256
|
55
|
+
machdep.cpu.cache.L2_associativity: 8
|
56
|
+
machdep.cpu.cache.linesize: 64
|
57
|
+
machdep.cpu.processor_flag: 5
|
58
|
+
machdep.cpu.microcode_version: 15
|
59
|
+
machdep.cpu.cores_per_package: 8
|
60
|
+
machdep.cpu.logical_per_package: 16
|
61
|
+
machdep.cpu.extfeatures: SYSCALL XD 1GBPAGE EM64T LAHF LZCNT RDTSCP TSCI
|
62
|
+
machdep.cpu.leaf7_features: SMEP ERMS RDWRFSGS TSC_THREAD_OFFSET BMI1 HLE AVX2 BMI2 INVPCID RTM FPU_CSDS
|
63
|
+
machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX SMX EST TM2 SSSE3 FMA CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC MOVBE POPCNT AES PCID XSAVE OSXSAVE SEGLIM64 TSCTMR AVX1.0 RDRAND F16C
|
64
|
+
machdep.cpu.brand: 0
|
65
|
+
machdep.cpu.signature: 263777
|
66
|
+
machdep.cpu.extfeature_bits: 142473169152
|
67
|
+
machdep.cpu.leaf7_feature_bits: 12219
|
68
|
+
machdep.cpu.feature_bits: 9221960262849657855
|
69
|
+
machdep.cpu.stepping: 1
|
70
|
+
machdep.cpu.extfamily: 0
|
71
|
+
machdep.cpu.extmodel: 4
|
72
|
+
machdep.cpu.model: 70
|
73
|
+
machdep.cpu.family: 6
|
74
|
+
machdep.cpu.brand_string: Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
|
75
|
+
machdep.cpu.vendor: GenuineIntel
|
76
|
+
machdep.cpu.max_ext: 2147483656
|
77
|
+
machdep.cpu.max_basic: 13
|
78
78
|
CTL
|
79
79
|
|
80
80
|
allow(@plugin).to receive(:collect_os).and_return(:darwin)
|