ohai 8.13.0 → 8.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/lib/ohai/common/dmi.rb +1 -1
- data/lib/ohai/config.rb +2 -2
- data/lib/ohai/dsl/plugin.rb +1 -1
- data/lib/ohai/loader.rb +1 -1
- data/lib/ohai/mixin/command.rb +18 -5
- data/lib/ohai/mixin/ec2_metadata.rb +1 -1
- data/lib/ohai/plugins/aix/os.rb +1 -1
- data/lib/ohai/plugins/c.rb +49 -67
- data/lib/ohai/plugins/darwin/memory.rb +1 -1
- data/lib/ohai/plugins/darwin/network.rb +3 -3
- data/lib/ohai/plugins/darwin/platform.rb +1 -1
- data/lib/ohai/plugins/darwin/system_profiler.rb +1 -1
- data/lib/ohai/plugins/digital_ocean.rb +1 -1
- data/lib/ohai/plugins/ec2.rb +42 -41
- data/lib/ohai/plugins/erlang.rb +1 -1
- data/lib/ohai/plugins/ip_scopes.rb +1 -1
- data/lib/ohai/plugins/kernel.rb +1 -1
- data/lib/ohai/plugins/linux/network.rb +2 -2
- data/lib/ohai/plugins/linux/platform.rb +6 -1
- data/lib/ohai/plugins/mono.rb +1 -1
- data/lib/ohai/plugins/network.rb +2 -2
- data/lib/ohai/plugins/packages.rb +59 -46
- data/lib/ohai/plugins/python.rb +2 -2
- data/lib/ohai/plugins/rackspace.rb +4 -4
- data/lib/ohai/plugins/sigar/network.rb +1 -1
- data/lib/ohai/plugins/sigar/network_route.rb +1 -1
- data/lib/ohai/plugins/solaris2/dmi.rb +1 -1
- data/lib/ohai/plugins/solaris2/network.rb +25 -8
- data/lib/ohai/plugins/ssh_host_key.rb +1 -1
- data/lib/ohai/plugins/windows/network.rb +5 -5
- data/lib/ohai/provides_map.rb +2 -2
- data/lib/ohai/system.rb +1 -1
- data/lib/ohai/version.rb +1 -1
- data/spec/functional/loader_spec.rb +1 -1
- data/spec/unit/mixin/command_spec.rb +118 -0
- data/spec/unit/plugins/aix/os_spec.rb +6 -5
- data/spec/unit/plugins/c_spec.rb +169 -118
- data/spec/unit/plugins/digital_ocean_spec.rb +7 -7
- data/spec/unit/plugins/dmi_spec.rb +4 -4
- data/spec/unit/plugins/ec2_spec.rb +64 -69
- data/spec/unit/plugins/linode_spec.rb +6 -6
- data/spec/unit/plugins/linux/platform_spec.rb +7 -0
- data/spec/unit/plugins/linux/sessions_spec.rb +2 -2
- data/spec/unit/plugins/network_spec.rb +16 -16
- data/spec/unit/plugins/openstack_spec.rb +1 -1
- data/spec/unit/plugins/packages_spec.rb +165 -191
- data/spec/unit/plugins/rackspace_spec.rb +203 -130
- data/spec/unit/plugins/solaris2/filesystem.rb +2 -2
- data/spec/unit/plugins/solaris2/network_spec.rb +36 -5
- metadata +3 -3
data/lib/ohai/version.rb
CHANGED
@@ -23,7 +23,7 @@ RSpec.describe "Ohai::Loader" do
|
|
23
23
|
describe "#load_all" do
|
24
24
|
context "when the plugin path contains backslash characters", :windows_only do
|
25
25
|
let(:plugin_directory) { Dir.mktmpdir("plugins") }
|
26
|
-
let(:plugin_path) { plugin_directory.
|
26
|
+
let(:plugin_path) { plugin_directory.tr("/", "\\") }
|
27
27
|
|
28
28
|
before(:each) do
|
29
29
|
Ohai.config[:plugin_path] = plugin_path
|
@@ -85,5 +85,123 @@ describe Ohai::Mixin::Command, "popen4" do
|
|
85
85
|
end
|
86
86
|
expect(reaped_procs).to eq(0)
|
87
87
|
end
|
88
|
+
end
|
89
|
+
|
90
|
+
describe Ohai::Mixin::Command, "shell_out" do
|
91
|
+
let(:cmd) { "sparkle-dream --version" }
|
92
|
+
|
93
|
+
let(:shell_out) { double("Mixlib::ShellOut") }
|
94
|
+
|
95
|
+
let(:plugin_name) { :OSSparkleDream }
|
96
|
+
|
97
|
+
before(:each) do
|
98
|
+
allow(Ohai::Mixin::Command).to receive(:name).and_return(plugin_name)
|
99
|
+
end
|
100
|
+
|
101
|
+
describe "when the command runs" do
|
102
|
+
it "logs the command and exitstatus" do
|
103
|
+
expect(Mixlib::ShellOut).
|
104
|
+
to receive(:new).
|
105
|
+
with(cmd, { timeout: 30 }).
|
106
|
+
and_return(shell_out)
|
107
|
+
|
108
|
+
expect(shell_out).
|
109
|
+
to receive(:run_command)
|
110
|
+
|
111
|
+
expect(shell_out).
|
112
|
+
to receive(:exitstatus).
|
113
|
+
and_return(256)
|
114
|
+
|
115
|
+
expect(Ohai::Log).to receive(:debug).
|
116
|
+
with("Plugin OSSparkleDream ran 'sparkle-dream --version' and returned 256")
|
117
|
+
|
118
|
+
Ohai::Mixin::Command.shell_out(cmd)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
describe "when the command does not exist" do
|
123
|
+
it "logs the command and error message" do
|
124
|
+
expect(Mixlib::ShellOut).
|
125
|
+
to receive(:new).
|
126
|
+
with(cmd, { timeout: 30 }).
|
127
|
+
and_return(shell_out)
|
128
|
+
|
129
|
+
expect(shell_out).
|
130
|
+
to receive(:run_command).
|
131
|
+
and_raise(Errno::ENOENT, "sparkle-dream")
|
132
|
+
|
133
|
+
expect(Ohai::Log).
|
134
|
+
to receive(:debug).
|
135
|
+
with("Plugin OSSparkleDream ran 'sparkle-dream --version' and failed " \
|
136
|
+
"#<Errno::ENOENT: No such file or directory - sparkle-dream>")
|
137
|
+
|
138
|
+
expect { Ohai::Mixin::Command.shell_out(cmd) }.
|
139
|
+
to raise_error(Ohai::Exceptions::Exec)
|
140
|
+
end
|
141
|
+
end
|
88
142
|
|
143
|
+
describe "when the command times out" do
|
144
|
+
it "logs the command an timeout error message" do
|
145
|
+
expect(Mixlib::ShellOut).
|
146
|
+
to receive(:new).
|
147
|
+
with(cmd, { timeout: 30 }).
|
148
|
+
and_return(shell_out)
|
149
|
+
|
150
|
+
expect(shell_out).
|
151
|
+
to receive(:run_command).
|
152
|
+
and_raise(Mixlib::ShellOut::CommandTimeout)
|
153
|
+
|
154
|
+
expect(Ohai::Log).
|
155
|
+
to receive(:debug).
|
156
|
+
with("Plugin OSSparkleDream ran 'sparkle-dream --version' and timed " \
|
157
|
+
"out after 30 seconds")
|
158
|
+
|
159
|
+
expect { Ohai::Mixin::Command.shell_out(cmd) }.
|
160
|
+
to raise_error(Ohai::Exceptions::Exec)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
describe "when a timeout option is provided" do
|
165
|
+
let(:options) { { timeout: 10 } }
|
166
|
+
|
167
|
+
it "runs the command with the provided timeout" do
|
168
|
+
expect(Mixlib::ShellOut).
|
169
|
+
to receive(:new).
|
170
|
+
with(cmd, options).
|
171
|
+
and_return(shell_out)
|
172
|
+
|
173
|
+
expect(shell_out).
|
174
|
+
to receive(:run_command)
|
175
|
+
|
176
|
+
expect(shell_out).
|
177
|
+
to receive(:exitstatus).
|
178
|
+
and_return(256)
|
179
|
+
|
180
|
+
expect(Ohai::Log).to receive(:debug).
|
181
|
+
with("Plugin OSSparkleDream ran 'sparkle-dream --version' and returned 256")
|
182
|
+
|
183
|
+
Ohai::Mixin::Command.shell_out(cmd, options)
|
184
|
+
end
|
185
|
+
|
186
|
+
describe "when the command times out" do
|
187
|
+
it "logs the command an timeout error message" do
|
188
|
+
expect(Mixlib::ShellOut).
|
189
|
+
to receive(:new).
|
190
|
+
with(cmd, options).
|
191
|
+
and_return(shell_out)
|
192
|
+
|
193
|
+
expect(shell_out).
|
194
|
+
to receive(:run_command).
|
195
|
+
and_raise(Mixlib::ShellOut::CommandTimeout)
|
196
|
+
|
197
|
+
expect(Ohai::Log).
|
198
|
+
to receive(:debug).
|
199
|
+
with("Plugin OSSparkleDream ran 'sparkle-dream --version' and timed " \
|
200
|
+
"out after 10 seconds")
|
201
|
+
|
202
|
+
expect { Ohai::Mixin::Command.shell_out(cmd, options) }.
|
203
|
+
to raise_error(Ohai::Exceptions::Exec)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
89
207
|
end
|
@@ -20,15 +20,16 @@ require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
|
|
20
20
|
describe Ohai::System, "AIX os plugin" do
|
21
21
|
before(:each) do
|
22
22
|
@plugin = get_plugin("aix/os")
|
23
|
-
kernel = Mash.new
|
24
|
-
kernel[:version] = "6"
|
25
|
-
kernel[:release] = "1"
|
26
23
|
allow(@plugin).to receive(:collect_os).and_return(:aix)
|
27
|
-
allow(@plugin).to receive(:
|
24
|
+
allow(@plugin).to receive(:shell_out).with("oslevel -s").and_return(mock_shell_out(0, "7200-00-01-1543\n", nil))
|
28
25
|
@plugin.run
|
29
26
|
end
|
30
27
|
|
28
|
+
it "should set the top-level os attribute" do
|
29
|
+
expect(@plugin[:os]).to eql(:aix)
|
30
|
+
end
|
31
|
+
|
31
32
|
it "should set the top-level os_level attribute" do
|
32
|
-
expect(@plugin[:os_version]).to eql("
|
33
|
+
expect(@plugin[:os_version]).to eql("7200-00-01-1543")
|
33
34
|
end
|
34
35
|
end
|
data/spec/unit/plugins/c_spec.rb
CHANGED
@@ -102,207 +102,258 @@ EOF
|
|
102
102
|
|
103
103
|
describe Ohai::System, "plugin c" do
|
104
104
|
|
105
|
+
let(:plugin) { get_plugin("c") }
|
106
|
+
|
105
107
|
before(:each) do
|
106
|
-
@plugin = get_plugin("c")
|
107
108
|
|
108
|
-
|
109
|
+
plugin[:languages] = Mash.new
|
109
110
|
#gcc
|
110
|
-
allow(
|
111
|
+
allow(plugin).to receive(:shell_out).with("gcc -v").and_return(mock_shell_out(0, "", C_GCC))
|
111
112
|
#glibc
|
112
|
-
allow(
|
113
|
+
allow(plugin).to receive(:shell_out).with("/lib/libc.so.6").and_return(mock_shell_out(0, C_GLIBC_2_3_4, ""))
|
113
114
|
#ms cl
|
114
|
-
allow(
|
115
|
+
allow(plugin).to receive(:shell_out).with("cl /\?").and_return(mock_shell_out(0, "", C_CL))
|
115
116
|
#ms vs
|
116
|
-
allow(
|
117
|
+
allow(plugin).to receive(:shell_out).with("devenv.com /\?").and_return(mock_shell_out(0, C_VS, ""))
|
117
118
|
#ibm xlc
|
118
|
-
allow(
|
119
|
+
allow(plugin).to receive(:shell_out).with("xlc -qversion").and_return(mock_shell_out(0, C_XLC, ""))
|
119
120
|
#sun pro
|
120
|
-
allow(
|
121
|
+
allow(plugin).to receive(:shell_out).with("cc -V -flags").and_return(mock_shell_out(0, "", C_SUN))
|
121
122
|
#hpux cc
|
122
|
-
allow(
|
123
|
+
allow(plugin).to receive(:shell_out).with("what /opt/ansic/bin/cc").and_return(mock_shell_out(0, C_HPUX, ""))
|
123
124
|
end
|
124
125
|
|
125
126
|
#gcc
|
126
|
-
it "
|
127
|
-
expect(
|
128
|
-
|
127
|
+
it "gets the gcc version from running gcc -v" do
|
128
|
+
expect(plugin).to receive(:shell_out).with("gcc -v").and_return(mock_shell_out(0, "", C_GCC))
|
129
|
+
plugin.run
|
130
|
+
end
|
131
|
+
|
132
|
+
it "sets languages[:c][:gcc][:version]" do
|
133
|
+
plugin.run
|
134
|
+
expect(plugin.languages[:c][:gcc][:version]).to eql("3.4.6")
|
129
135
|
end
|
130
136
|
|
131
|
-
it "
|
132
|
-
|
133
|
-
expect(
|
137
|
+
it "sets languages[:c][:gcc][:description]" do
|
138
|
+
plugin.run
|
139
|
+
expect(plugin.languages[:c][:gcc][:description]).to eql(C_GCC.split($/).last)
|
134
140
|
end
|
135
141
|
|
136
|
-
it "
|
137
|
-
|
138
|
-
|
142
|
+
it "does not set the languages[:c][:gcc] tree up if gcc command exits nonzero" do
|
143
|
+
allow(plugin).to receive(:shell_out).with("gcc -v").and_return(mock_shell_out(1, "", ""))
|
144
|
+
plugin.run
|
145
|
+
expect(plugin[:languages][:c]).not_to have_key(:gcc)
|
139
146
|
end
|
140
147
|
|
141
|
-
it "
|
142
|
-
allow(
|
143
|
-
|
144
|
-
expect(
|
148
|
+
it "does not set the languages[:c][:gcc] tree up if gcc command fails" do
|
149
|
+
allow(plugin).to receive(:shell_out).with("gcc -v").and_raise(Ohai::Exceptions::Exec)
|
150
|
+
plugin.run
|
151
|
+
expect(plugin[:languages][:c]).not_to have_key(:gcc)
|
152
|
+
expect(plugin[:languages][:c]).not_to be_empty # expect other attributes
|
145
153
|
end
|
146
154
|
|
147
155
|
#glibc
|
148
|
-
it "
|
149
|
-
expect(
|
150
|
-
|
156
|
+
it "gets the glibc x.x.x version from running /lib/libc.so.6" do
|
157
|
+
expect(plugin).to receive(:shell_out).with("/lib/libc.so.6").and_return(mock_shell_out(0, C_GLIBC_2_3_4, ""))
|
158
|
+
plugin.run
|
159
|
+
end
|
160
|
+
|
161
|
+
it "sets languages[:c][:glibc][:version]" do
|
162
|
+
plugin.run
|
163
|
+
expect(plugin.languages[:c][:glibc][:version]).to eql("2.3.4")
|
151
164
|
end
|
152
165
|
|
153
|
-
it "
|
154
|
-
|
155
|
-
expect(
|
166
|
+
it "sets languages[:c][:glibc][:description]" do
|
167
|
+
plugin.run
|
168
|
+
expect(plugin.languages[:c][:glibc][:description]).to eql(C_GLIBC_2_3_4.split($/).first)
|
156
169
|
end
|
157
170
|
|
158
|
-
it "
|
159
|
-
|
160
|
-
|
171
|
+
it "does not set the languages[:c][:glibc] tree up if glibc exits nonzero" do
|
172
|
+
allow(plugin).to receive(:shell_out).with("/lib/libc.so.6").and_return(mock_shell_out(1, "", ""))
|
173
|
+
allow(plugin).to receive(:shell_out).with("/lib64/libc.so.6").and_return(mock_shell_out(1, "", ""))
|
174
|
+
plugin.run
|
175
|
+
expect(plugin[:languages][:c]).not_to have_key(:glibc)
|
161
176
|
end
|
162
177
|
|
163
|
-
it "
|
164
|
-
allow(
|
165
|
-
allow(
|
166
|
-
|
167
|
-
expect(
|
178
|
+
it "does not set the languages[:c][:glibc] tree up if glibc fails" do
|
179
|
+
allow(plugin).to receive(:shell_out).with("/lib/libc.so.6").and_raise(Ohai::Exceptions::Exec)
|
180
|
+
allow(plugin).to receive(:shell_out).with("/lib64/libc.so.6").and_raise(Ohai::Exceptions::Exec)
|
181
|
+
plugin.run
|
182
|
+
expect(plugin[:languages][:c]).not_to have_key(:glibc)
|
183
|
+
expect(plugin[:languages][:c]).not_to be_empty # expect other attributes
|
168
184
|
end
|
169
185
|
|
170
|
-
it "
|
171
|
-
allow(
|
172
|
-
expect(
|
173
|
-
|
174
|
-
expect(
|
186
|
+
it "gets the glibc x.x version from running /lib/libc.so.6" do
|
187
|
+
allow(plugin).to receive(:shell_out).with("/lib/libc.so.6").and_return(mock_shell_out(0, C_GLIBC_2_5, ""))
|
188
|
+
expect(plugin).to receive(:shell_out).with("/lib/libc.so.6").and_return(mock_shell_out(0, C_GLIBC_2_5, ""))
|
189
|
+
plugin.run
|
190
|
+
expect(plugin.languages[:c][:glibc][:version]).to eql("2.5")
|
175
191
|
end
|
176
192
|
|
177
193
|
#ms cl
|
178
|
-
it "
|
179
|
-
expect(
|
180
|
-
|
194
|
+
it "gets the cl version from running cl /?" do
|
195
|
+
expect(plugin).to receive(:shell_out).with("cl /\?").and_return(mock_shell_out(0, "", C_CL))
|
196
|
+
plugin.run
|
197
|
+
end
|
198
|
+
|
199
|
+
it "sets languages[:c][:cl][:version]" do
|
200
|
+
plugin.run
|
201
|
+
expect(plugin.languages[:c][:cl][:version]).to eql("14.00.50727.762")
|
181
202
|
end
|
182
203
|
|
183
|
-
it "
|
184
|
-
|
185
|
-
expect(
|
204
|
+
it "sets languages[:c][:cl][:description]" do
|
205
|
+
plugin.run
|
206
|
+
expect(plugin.languages[:c][:cl][:description]).to eql(C_CL.split($/).first)
|
186
207
|
end
|
187
208
|
|
188
|
-
it "
|
189
|
-
|
190
|
-
|
209
|
+
it "does not set the languages[:c][:cl] tree up if cl command exits nonzero" do
|
210
|
+
allow(plugin).to receive(:shell_out).with("cl /\?").and_return(mock_shell_out(1, "", ""))
|
211
|
+
plugin.run
|
212
|
+
expect(plugin[:languages][:c]).not_to have_key(:cl)
|
191
213
|
end
|
192
214
|
|
193
|
-
it "
|
194
|
-
allow(
|
195
|
-
|
196
|
-
expect(
|
215
|
+
it "does not set the languages[:c][:cl] tree up if cl command fails" do
|
216
|
+
allow(plugin).to receive(:shell_out).with("cl /\?").and_raise(Ohai::Exceptions::Exec)
|
217
|
+
plugin.run
|
218
|
+
expect(plugin[:languages][:c]).not_to have_key(:cl)
|
219
|
+
expect(plugin[:languages][:c]).not_to be_empty # expect other attributes
|
197
220
|
end
|
198
221
|
|
199
222
|
#ms vs
|
200
|
-
it "
|
201
|
-
expect(
|
202
|
-
|
223
|
+
it "gets the vs version from running devenv.com /?" do
|
224
|
+
expect(plugin).to receive(:shell_out).with("devenv.com /\?").and_return(mock_shell_out(0, C_VS, ""))
|
225
|
+
plugin.run
|
203
226
|
end
|
204
227
|
|
205
|
-
it "
|
206
|
-
|
207
|
-
expect(
|
228
|
+
it "sets languages[:c][:vs][:version]" do
|
229
|
+
plugin.run
|
230
|
+
expect(plugin.languages[:c][:vs][:version]).to eql("8.0.50727.762")
|
208
231
|
end
|
209
232
|
|
210
|
-
it "
|
211
|
-
|
212
|
-
expect(
|
233
|
+
it "sets languages[:c][:vs][:description]" do
|
234
|
+
plugin.run
|
235
|
+
expect(plugin.languages[:c][:vs][:description]).to eql(C_VS.split($/)[1])
|
213
236
|
end
|
214
237
|
|
215
|
-
it "
|
216
|
-
allow(
|
217
|
-
|
218
|
-
expect(
|
238
|
+
it "does not set the languages[:c][:vs] tree up if devenv command exits nonzero" do
|
239
|
+
allow(plugin).to receive(:shell_out).with("devenv.com /\?").and_return(mock_shell_out(1, "", ""))
|
240
|
+
plugin.run
|
241
|
+
expect(plugin[:languages][:c]).not_to have_key(:vs)
|
242
|
+
end
|
243
|
+
|
244
|
+
it "does not set the languages[:c][:vs] tree up if devenv command fails" do
|
245
|
+
allow(plugin).to receive(:shell_out).with("devenv.com /\?").and_raise(Ohai::Exceptions::Exec)
|
246
|
+
plugin.run
|
247
|
+
expect(plugin[:languages][:c]).not_to have_key(:vs)
|
248
|
+
expect(plugin[:languages][:c]).not_to be_empty # expect other attributes
|
219
249
|
end
|
220
250
|
|
221
251
|
#ibm xlc
|
222
|
-
it "
|
223
|
-
expect(
|
224
|
-
|
252
|
+
it "gets the xlc version from running xlc -qversion" do
|
253
|
+
expect(plugin).to receive(:shell_out).with("xlc -qversion").and_return(mock_shell_out(0, C_XLC, ""))
|
254
|
+
plugin.run
|
255
|
+
end
|
256
|
+
|
257
|
+
it "sets languages[:c][:xlc][:version]" do
|
258
|
+
plugin.run
|
259
|
+
expect(plugin.languages[:c][:xlc][:version]).to eql("9.0")
|
225
260
|
end
|
226
261
|
|
227
|
-
it "
|
228
|
-
|
229
|
-
expect(
|
262
|
+
it "sets languages[:c][:xlc][:description]" do
|
263
|
+
plugin.run
|
264
|
+
expect(plugin.languages[:c][:xlc][:description]).to eql(C_XLC.split($/).first)
|
230
265
|
end
|
231
266
|
|
232
|
-
it "
|
233
|
-
|
234
|
-
|
267
|
+
it "does not set the languages[:c][:xlc] tree up if xlc command exits nonzero" do
|
268
|
+
allow(plugin).to receive(:shell_out).with("xlc -qversion").and_return(mock_shell_out(1, "", ""))
|
269
|
+
plugin.run
|
270
|
+
expect(plugin[:languages][:c]).not_to have_key(:xlc)
|
235
271
|
end
|
236
272
|
|
237
|
-
it "
|
238
|
-
allow(
|
239
|
-
|
240
|
-
expect(
|
273
|
+
it "does not set the languages[:c][:xlc] tree up if xlc command fails" do
|
274
|
+
allow(plugin).to receive(:shell_out).with("xlc -qversion").and_raise(Ohai::Exceptions::Exec)
|
275
|
+
plugin.run
|
276
|
+
expect(plugin[:languages][:c]).not_to have_key(:xlc)
|
277
|
+
expect(plugin[:languages][:c]).not_to be_empty # expect other attributes
|
241
278
|
end
|
242
279
|
|
243
|
-
it "
|
244
|
-
allow(
|
245
|
-
|
246
|
-
expect(
|
280
|
+
it "sets the languages[:c][:xlc] tree up if xlc exit status is 249" do
|
281
|
+
allow(plugin).to receive(:shell_out).with("xlc -qversion").and_return(mock_shell_out(63744, "", ""))
|
282
|
+
plugin.run
|
283
|
+
expect(plugin[:languages][:c]).not_to have_key(:xlc)
|
247
284
|
end
|
248
285
|
|
249
286
|
#sun pro
|
250
|
-
it "
|
251
|
-
expect(
|
252
|
-
|
287
|
+
it "gets the cc version from running cc -V -flags" do
|
288
|
+
expect(plugin).to receive(:shell_out).with("cc -V -flags").and_return(mock_shell_out(0, "", C_SUN))
|
289
|
+
plugin.run
|
253
290
|
end
|
254
291
|
|
255
|
-
it "
|
256
|
-
|
257
|
-
expect(
|
292
|
+
it "sets languages[:c][:sunpro][:version]" do
|
293
|
+
plugin.run
|
294
|
+
expect(plugin.languages[:c][:sunpro][:version]).to eql("5.8")
|
258
295
|
end
|
259
296
|
|
260
|
-
it "
|
261
|
-
|
262
|
-
expect(
|
297
|
+
it "sets languages[:c][:sunpro][:description]" do
|
298
|
+
plugin.run
|
299
|
+
expect(plugin.languages[:c][:sunpro][:description]).to eql(C_SUN.chomp)
|
263
300
|
end
|
264
301
|
|
265
|
-
it "
|
266
|
-
allow(
|
267
|
-
|
268
|
-
expect(
|
302
|
+
it "does not set the languages[:c][:sunpro] tree up if cc command exits nonzero" do
|
303
|
+
allow(plugin).to receive(:shell_out).with("cc -V -flags").and_return(mock_shell_out(1, "", ""))
|
304
|
+
plugin.run
|
305
|
+
expect(plugin[:languages][:c]).not_to have_key(:sunpro)
|
269
306
|
end
|
270
307
|
|
271
|
-
it "
|
308
|
+
it "does not set the languages[:c][:sunpro] tree up if cc command fails" do
|
309
|
+
allow(plugin).to receive(:shell_out).with("cc -V -flags").and_raise(Ohai::Exceptions::Exec)
|
310
|
+
plugin.run
|
311
|
+
expect(plugin[:languages][:c]).not_to have_key(:sunpro)
|
312
|
+
expect(plugin[:languages][:c]).not_to be_empty # expect other attributes
|
313
|
+
end
|
314
|
+
|
315
|
+
it "does not set the languages[:c][:sunpro] tree if the corresponding cc command fails on linux" do
|
272
316
|
fedora_error_message = "cc: error trying to exec 'i686-redhat-linux-gcc--flags': execvp: No such file or directory"
|
273
317
|
|
274
|
-
allow(
|
275
|
-
|
276
|
-
expect(
|
318
|
+
allow(plugin).to receive(:shell_out).with("cc -V -flags").and_return(mock_shell_out(0, "", fedora_error_message))
|
319
|
+
plugin.run
|
320
|
+
expect(plugin[:languages][:c]).not_to have_key(:sunpro)
|
277
321
|
end
|
278
322
|
|
279
|
-
it "
|
323
|
+
it "does not set the languages[:c][:sunpro] tree if the corresponding cc command fails on hpux" do
|
280
324
|
hpux_error_message = "cc: warning 901: unknown option: `-flags': use +help for online documentation.\ncc: HP C/aC++ B3910B A.06.25 [Nov 30 2009]"
|
281
|
-
allow(
|
282
|
-
|
283
|
-
expect(
|
325
|
+
allow(plugin).to receive(:shell_out).with("cc -V -flags").and_return(mock_shell_out(0, "", hpux_error_message))
|
326
|
+
plugin.run
|
327
|
+
expect(plugin[:languages][:c]).not_to have_key(:sunpro)
|
284
328
|
end
|
285
329
|
|
286
330
|
#hpux cc
|
287
|
-
it "
|
288
|
-
expect(
|
289
|
-
|
331
|
+
it "gets the cc version from running what cc" do
|
332
|
+
expect(plugin).to receive(:shell_out).with("what /opt/ansic/bin/cc").and_return(mock_shell_out(0, C_HPUX, ""))
|
333
|
+
plugin.run
|
334
|
+
end
|
335
|
+
|
336
|
+
it "sets languages[:c][:hpcc][:version]" do
|
337
|
+
plugin.run
|
338
|
+
expect(plugin.languages[:c][:hpcc][:version]).to eql("B.11.11.16")
|
290
339
|
end
|
291
340
|
|
292
|
-
it "
|
293
|
-
|
294
|
-
expect(
|
341
|
+
it "sets languages[:c][:hpcc][:description]" do
|
342
|
+
plugin.run
|
343
|
+
expect(plugin.languages[:c][:hpcc][:description]).to eql(C_HPUX.split($/)[3].strip)
|
295
344
|
end
|
296
345
|
|
297
|
-
it "
|
298
|
-
|
299
|
-
|
346
|
+
it "does not set the languages[:c][:hpcc] tree up if cc command exits nonzero" do
|
347
|
+
allow(plugin).to receive(:shell_out).with("what /opt/ansic/bin/cc").and_return(mock_shell_out(1, "", ""))
|
348
|
+
plugin.run
|
349
|
+
expect(plugin[:languages][:c]).not_to have_key(:hpcc)
|
300
350
|
end
|
301
351
|
|
302
|
-
it "
|
303
|
-
allow(
|
304
|
-
|
305
|
-
expect(
|
352
|
+
it "does not set the languages[:c][:hpcc] tree up if cc command fails" do
|
353
|
+
allow(plugin).to receive(:shell_out).with("what /opt/ansic/bin/cc").and_raise(Ohai::Exceptions::Exec)
|
354
|
+
plugin.run
|
355
|
+
expect(plugin[:languages][:c]).not_to have_key(:hpcc)
|
356
|
+
expect(plugin[:languages][:c]).not_to be_empty # expect other attributes
|
306
357
|
end
|
307
358
|
|
308
359
|
end
|