sys-proctable 1.2.5 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/{CHANGES.rdoc → CHANGES.md} +72 -48
- data/Gemfile +2 -0
- data/{MANIFEST.rdoc → MANIFEST.md} +11 -8
- data/README.md +8 -3
- data/Rakefile +7 -4
- data/certs/djberg96_pub.pem +26 -0
- data/lib/darwin/sys/proctable.rb +59 -22
- data/lib/freebsd/sys/proctable.rb +1 -1
- data/lib/linux/sys/proctable/cgroup_entry.rb +4 -2
- data/lib/linux/sys/proctable/smaps.rb +29 -17
- data/lib/linux/sys/proctable.rb +41 -35
- data/lib/sunos/sys/proctable.rb +2 -2
- data/lib/sys/proctable/version.rb +1 -1
- data/lib/sys/top.rb +1 -1
- data/lib/windows/sys/proctable.rb +36 -32
- data/spec/spec_helper.rb +11 -20
- data/spec/sys_proctable_aix_spec.rb +74 -76
- data/spec/sys_proctable_all_spec.rb +45 -45
- data/spec/sys_proctable_darwin_spec.rb +87 -60
- data/spec/sys_proctable_freebsd_spec.rb +111 -113
- data/spec/sys_proctable_linux_spec.rb +196 -195
- data/spec/sys_proctable_sunos_spec.rb +190 -192
- data/spec/sys_proctable_windows_spec.rb +153 -153
- data/spec/sys_top_spec.rb +20 -21
- data/sys-proctable.gemspec +15 -24
- data.tar.gz.sig +0 -0
- metadata +56 -19
- metadata.gz.sig +0 -0
@@ -2,13 +2,11 @@
|
|
2
2
|
# sys_proctable_sunos_spec.rb
|
3
3
|
#
|
4
4
|
# Test suite for sys-proctable for SunOS/Solaris. This should be run
|
5
|
-
# run via the 'rake
|
5
|
+
# run via the 'rake spec' task.
|
6
6
|
#######################################################################
|
7
|
-
require '
|
8
|
-
require 'sys/proctable'
|
9
|
-
require_relative 'sys_proctable_all_spec'
|
7
|
+
require 'spec_helper'
|
10
8
|
|
11
|
-
describe Sys::ProcTable do
|
9
|
+
RSpec.describe Sys::ProcTable, :sunos do
|
12
10
|
let(:fields){
|
13
11
|
%w[
|
14
12
|
flag nlwp pid ppid pgid sid uid euid gid egid addr size
|
@@ -23,294 +21,294 @@ describe Sys::ProcTable do
|
|
23
21
|
]
|
24
22
|
}
|
25
23
|
|
26
|
-
context
|
27
|
-
it
|
24
|
+
context 'fields singleton method' do
|
25
|
+
it 'responds to a fields method' do
|
28
26
|
expect(described_class).to respond_to(:fields)
|
29
27
|
end
|
30
28
|
|
31
|
-
it
|
29
|
+
it 'returns the expected results for the fields method' do
|
32
30
|
expect(described_class.fields).to be_kind_of(Array)
|
33
31
|
expect(described_class.fields).to eql(fields)
|
34
32
|
end
|
35
33
|
end
|
36
34
|
|
37
|
-
context
|
38
|
-
subject
|
35
|
+
context 'ProcTable::Struct members' do
|
36
|
+
subject(:process){ described_class.ps(:pid => Process.pid) }
|
39
37
|
|
40
|
-
it
|
41
|
-
expect(
|
42
|
-
expect(
|
43
|
-
expect(
|
38
|
+
it 'contains a pid member and returns the expected value' do
|
39
|
+
expect(process).to respond_to(:pid)
|
40
|
+
expect(process.pid).to be_kind_of(Numeric)
|
41
|
+
expect(process.pid).to eql(Process.pid)
|
44
42
|
end
|
45
43
|
|
46
|
-
it
|
47
|
-
expect(
|
48
|
-
expect(
|
49
|
-
expect(
|
44
|
+
it 'contains a ppid member and returns the expected value' do
|
45
|
+
expect(process).to respond_to(:ppid)
|
46
|
+
expect(process.ppid).to be_kind_of(Numeric)
|
47
|
+
expect(process.ppid).to eql(Process.ppid)
|
50
48
|
end
|
51
49
|
|
52
|
-
it
|
53
|
-
expect(
|
54
|
-
expect(
|
55
|
-
expect(
|
50
|
+
it 'contains a pgid member and returns the expected value' do
|
51
|
+
expect(process).to respond_to(:pgid)
|
52
|
+
expect(process.pgid).to be_kind_of(Numeric)
|
53
|
+
expect(process.pgid).to eql(Process.getpgrp)
|
56
54
|
end
|
57
55
|
|
58
|
-
it
|
59
|
-
expect(
|
60
|
-
expect(
|
56
|
+
it 'has a flag member that returns the expected value' do
|
57
|
+
expect(process).to respond_to(:flag)
|
58
|
+
expect(process.flag).to be_kind_of(Integer)
|
61
59
|
end
|
62
60
|
|
63
|
-
it
|
64
|
-
expect(
|
65
|
-
expect(
|
66
|
-
expect(
|
61
|
+
it 'has an nlwp member that returns the expected value' do
|
62
|
+
expect(process).to respond_to(:nlwp)
|
63
|
+
expect(process.nlwp).to be_kind_of(Integer)
|
64
|
+
expect(process.nlwp).to be >= 0
|
67
65
|
end
|
68
66
|
|
69
|
-
it
|
70
|
-
expect(
|
71
|
-
expect(
|
72
|
-
expect(
|
67
|
+
it 'has a sid member that returns the expected value' do
|
68
|
+
expect(process).to respond_to(:sid)
|
69
|
+
expect(process.sid).to be_kind_of(Integer)
|
70
|
+
expect(process.sid).to be >= 0
|
73
71
|
end
|
74
72
|
|
75
|
-
it
|
76
|
-
expect(
|
77
|
-
expect(
|
78
|
-
expect(
|
73
|
+
it 'has a uid member that returns the expected value' do
|
74
|
+
expect(process).to respond_to(:uid)
|
75
|
+
expect(process.uid).to be_kind_of(Integer)
|
76
|
+
expect(process.uid).to eql(Process.uid)
|
79
77
|
end
|
80
78
|
|
81
|
-
it
|
82
|
-
expect(
|
83
|
-
expect(
|
84
|
-
expect(
|
79
|
+
it 'has a euid member that returns the expected value' do
|
80
|
+
expect(process).to respond_to(:euid)
|
81
|
+
expect(process.euid).to be_kind_of(Integer)
|
82
|
+
expect(process.euid).to eql(Process.euid)
|
85
83
|
end
|
86
84
|
|
87
|
-
it
|
88
|
-
expect(
|
89
|
-
expect(
|
90
|
-
expect(
|
85
|
+
it 'has a gid member that returns the expected value' do
|
86
|
+
expect(process).to respond_to(:gid)
|
87
|
+
expect(process.gid).to be_kind_of(Integer)
|
88
|
+
expect(process.gid).to eql(Process.gid)
|
91
89
|
end
|
92
90
|
|
93
|
-
it
|
94
|
-
expect(
|
95
|
-
expect(
|
96
|
-
expect(
|
91
|
+
it 'has a egid member that returns the expected value' do
|
92
|
+
expect(process).to respond_to(:egid)
|
93
|
+
expect(process.egid).to be_kind_of(Integer)
|
94
|
+
expect(process.egid).to eql(Process.egid)
|
97
95
|
end
|
98
96
|
|
99
|
-
it
|
100
|
-
expect(
|
101
|
-
expect(
|
102
|
-
expect(
|
97
|
+
it 'has an addr member that returns the expected value' do
|
98
|
+
expect(process).to respond_to(:addr)
|
99
|
+
expect(process.addr).to be_kind_of(Integer)
|
100
|
+
expect(process.addr).to be >= 0
|
103
101
|
end
|
104
102
|
|
105
|
-
it
|
106
|
-
expect(
|
107
|
-
expect(
|
108
|
-
expect(
|
103
|
+
it 'has a size member that returns the expected value' do
|
104
|
+
expect(process).to respond_to(:size)
|
105
|
+
expect(process.size).to be_kind_of(Integer)
|
106
|
+
expect(process.size).to be >= 0
|
109
107
|
end
|
110
108
|
|
111
|
-
it
|
112
|
-
expect(
|
113
|
-
expect(
|
114
|
-
expect(
|
109
|
+
it 'has a rssize member that returns the expected value' do
|
110
|
+
expect(process).to respond_to(:rssize)
|
111
|
+
expect(process.rssize).to be_kind_of(Integer)
|
112
|
+
expect(process.rssize).to be >= 0
|
115
113
|
end
|
116
114
|
|
117
|
-
it
|
118
|
-
expect(
|
119
|
-
expect(
|
120
|
-
expect(
|
115
|
+
it 'has a ttydev member that returns the expected value' do
|
116
|
+
expect(process).to respond_to(:ttydev)
|
117
|
+
expect(process.ttydev).to be_kind_of(Integer)
|
118
|
+
expect(process.ttydev).to be >= -1
|
121
119
|
end
|
122
120
|
|
123
|
-
it
|
124
|
-
expect(
|
125
|
-
expect(
|
126
|
-
expect(
|
121
|
+
it 'has a pctcpu member that returns the expected value' do
|
122
|
+
expect(process).to respond_to(:pctcpu)
|
123
|
+
expect(process.pctcpu).to be_kind_of(Float)
|
124
|
+
expect(process.pctcpu).to be >= 0.0
|
127
125
|
end
|
128
126
|
|
129
|
-
it
|
130
|
-
expect(
|
131
|
-
expect(
|
132
|
-
expect(
|
127
|
+
it 'has a pctmem member that returns the expected value' do
|
128
|
+
expect(process).to respond_to(:pctmem)
|
129
|
+
expect(process.pctmem).to be_kind_of(Float)
|
130
|
+
expect(process.pctmem).to be >= 0.0
|
133
131
|
end
|
134
132
|
|
135
|
-
it
|
136
|
-
expect(
|
137
|
-
expect(
|
133
|
+
it 'has a start member that returns the expected value' do
|
134
|
+
expect(process).to respond_to(:start)
|
135
|
+
expect(process.start).to be_kind_of(Time)
|
138
136
|
end
|
139
137
|
|
140
|
-
it
|
141
|
-
expect(
|
142
|
-
expect(
|
143
|
-
expect(
|
138
|
+
it 'has a time member that returns the expected value' do
|
139
|
+
expect(process).to respond_to(:time)
|
140
|
+
expect(process.time).to be_kind_of(Integer)
|
141
|
+
expect(process.time).to be >= 0
|
144
142
|
end
|
145
143
|
|
146
|
-
it
|
147
|
-
expect(
|
148
|
-
expect(
|
149
|
-
expect(
|
144
|
+
it 'has a ctime member that returns the expected value' do
|
145
|
+
expect(process).to respond_to(:ctime)
|
146
|
+
expect(process.ctime).to be_kind_of(Integer)
|
147
|
+
expect(process.ctime).to be >= 0
|
150
148
|
end
|
151
149
|
|
152
|
-
it
|
153
|
-
expect(
|
154
|
-
expect(
|
155
|
-
expect(
|
150
|
+
it 'has a fname member that returns the expected value' do
|
151
|
+
expect(process).to respond_to(:fname)
|
152
|
+
expect(process.fname).to be_kind_of(String)
|
153
|
+
expect(process.fname.size).to be > 0
|
156
154
|
end
|
157
155
|
|
158
|
-
it
|
159
|
-
expect(
|
156
|
+
it 'has a comm alias member' do
|
157
|
+
expect(process.method(:comm)).to eql(process.method(:fname))
|
160
158
|
end
|
161
159
|
|
162
|
-
it
|
163
|
-
expect(
|
164
|
-
expect(
|
165
|
-
expect(
|
160
|
+
it 'has a psargs member that returns the expected value' do
|
161
|
+
expect(process).to respond_to(:psargs)
|
162
|
+
expect(process.psargs).to be_kind_of(String)
|
163
|
+
expect(process.psargs.size).to be > 0
|
166
164
|
end
|
167
165
|
|
168
|
-
it
|
169
|
-
expect(
|
170
|
-
expect(
|
171
|
-
expect(
|
166
|
+
it 'has a wstat member that returns the expected value' do
|
167
|
+
expect(process).to respond_to(:wstat)
|
168
|
+
expect(process.wstat).to be_kind_of(Integer)
|
169
|
+
expect(process.wstat).to be >= 0
|
172
170
|
end
|
173
171
|
|
174
|
-
it
|
175
|
-
expect(
|
176
|
-
expect(
|
177
|
-
expect(
|
172
|
+
it 'has an args member that returns the expected value' do
|
173
|
+
expect(process).to respond_to(:argc)
|
174
|
+
expect(process.argc).to be_kind_of(Integer)
|
175
|
+
expect(process.argc).to be >= 0
|
178
176
|
end
|
179
177
|
|
180
|
-
it
|
181
|
-
expect(
|
182
|
-
expect(
|
183
|
-
expect(
|
178
|
+
it 'has an argv member that returns the expected value' do
|
179
|
+
expect(process).to respond_to(:argv)
|
180
|
+
expect(process.argv).to be_kind_of(Integer)
|
181
|
+
expect(process.argv).to be >= 0
|
184
182
|
end
|
185
183
|
|
186
|
-
it
|
187
|
-
expect(
|
188
|
-
expect(
|
189
|
-
expect(
|
184
|
+
it 'has a envp member that returns the expected value' do
|
185
|
+
expect(process).to respond_to(:envp)
|
186
|
+
expect(process.envp).to be_kind_of(Integer)
|
187
|
+
expect(process.envp).to be >= 0
|
190
188
|
end
|
191
189
|
|
192
|
-
it
|
193
|
-
expect(
|
194
|
-
expect(
|
195
|
-
expect(
|
190
|
+
it 'has a dmodel member that returns the expected value' do
|
191
|
+
expect(process).to respond_to(:dmodel)
|
192
|
+
expect(process.dmodel).to be_kind_of(Integer)
|
193
|
+
expect(process.dmodel).to be >= 0
|
196
194
|
end
|
197
195
|
|
198
|
-
it
|
199
|
-
expect(
|
200
|
-
expect(
|
201
|
-
expect(
|
196
|
+
it 'has a taskid member that returns the expected value' do
|
197
|
+
expect(process).to respond_to(:taskid)
|
198
|
+
expect(process.taskid).to be_kind_of(Integer)
|
199
|
+
expect(process.taskid).to be >= 0
|
202
200
|
end
|
203
201
|
|
204
|
-
it
|
205
|
-
expect(
|
206
|
-
expect(
|
207
|
-
expect(
|
202
|
+
it 'has a projid member that returns the expected value' do
|
203
|
+
expect(process).to respond_to(:projid)
|
204
|
+
expect(process.projid).to be_kind_of(Integer)
|
205
|
+
expect(process.projid).to be >= 0
|
208
206
|
end
|
209
207
|
|
210
|
-
it
|
211
|
-
expect(
|
212
|
-
expect(
|
213
|
-
expect(
|
208
|
+
it 'has a nzomb member that returns the expected value' do
|
209
|
+
expect(process).to respond_to(:nzomb)
|
210
|
+
expect(process.nzomb).to be_kind_of(Integer)
|
211
|
+
expect(process.nzomb).to be >= 0
|
214
212
|
end
|
215
213
|
|
216
|
-
it
|
217
|
-
expect(
|
218
|
-
expect(
|
219
|
-
expect(
|
214
|
+
it 'has a poolid member that returns the expected value' do
|
215
|
+
expect(process).to respond_to(:poolid)
|
216
|
+
expect(process.poolid).to be_kind_of(Integer)
|
217
|
+
expect(process.poolid).to be >= 0
|
220
218
|
end
|
221
219
|
|
222
|
-
it
|
223
|
-
expect(
|
224
|
-
expect(
|
225
|
-
expect(
|
220
|
+
it 'has a zoneid member that returns the expected value' do
|
221
|
+
expect(process).to respond_to(:zoneid)
|
222
|
+
expect(process.zoneid).to be_kind_of(Integer)
|
223
|
+
expect(process.zoneid).to be >= 0
|
226
224
|
end
|
227
225
|
|
228
|
-
it
|
229
|
-
expect(
|
230
|
-
expect(
|
231
|
-
expect(
|
226
|
+
it 'has a contract member that returns the expected value' do
|
227
|
+
expect(process).to respond_to(:contract)
|
228
|
+
expect(process.contract).to be_kind_of(Integer)
|
229
|
+
expect(process.contract).to be >= 0
|
232
230
|
end
|
233
231
|
end
|
234
232
|
|
235
|
-
context
|
236
|
-
|
233
|
+
context 'lwpsinfo struct' do
|
234
|
+
process { described_class.ps(:pid => Process.pid) }
|
237
235
|
|
238
|
-
it
|
239
|
-
expect(
|
240
|
-
expect(
|
241
|
-
expect(
|
236
|
+
it 'has a lwpid member that returns the expected value' do
|
237
|
+
expect(process).to respond_to(:lwpid)
|
238
|
+
expect(process.lwpid).to be_kind_of(Integer)
|
239
|
+
expect(process.lwpid).to be >= 0
|
242
240
|
end
|
243
241
|
|
244
|
-
it
|
245
|
-
expect(
|
246
|
-
expect(
|
247
|
-
expect(
|
242
|
+
it 'has a wchan member that returns the expected value' do
|
243
|
+
expect(process).to respond_to(:wchan)
|
244
|
+
expect(process.wchan).to be_kind_of(Integer)
|
245
|
+
expect(process.wchan).to be >= 0
|
248
246
|
end
|
249
247
|
|
250
|
-
it
|
251
|
-
expect(
|
252
|
-
expect(
|
253
|
-
expect(
|
248
|
+
it 'has a stype member that returns the expected value' do
|
249
|
+
expect(process).to respond_to(:stype)
|
250
|
+
expect(process.stype).to be_kind_of(Integer)
|
251
|
+
expect(process.stype).to be >= 0
|
254
252
|
end
|
255
253
|
|
256
|
-
it
|
257
|
-
expect(
|
258
|
-
expect(
|
259
|
-
expect(
|
254
|
+
it 'has a state member that returns the expected value' do
|
255
|
+
expect(process).to respond_to(:state)
|
256
|
+
expect(process.state).to be_kind_of(Integer)
|
257
|
+
expect(process.state).to be >= 0
|
260
258
|
end
|
261
259
|
|
262
|
-
it
|
263
|
-
expect(
|
264
|
-
expect(
|
265
|
-
expect([
|
260
|
+
it 'has a sname member that returns the expected value' do
|
261
|
+
expect(process).to respond_to(:sname)
|
262
|
+
expect(process.sname).to be_kind_of(String)
|
263
|
+
expect(%w[S R Z T I O]).to include(process.sname)
|
266
264
|
end
|
267
265
|
|
268
|
-
it
|
269
|
-
expect(
|
270
|
-
expect(
|
271
|
-
expect(
|
266
|
+
it 'has a nice member that returns the expected value' do
|
267
|
+
expect(process).to respond_to(:nice)
|
268
|
+
expect(process.nice).to be_kind_of(Integer)
|
269
|
+
expect(process.nice).to be >= 0
|
272
270
|
end
|
273
271
|
|
274
|
-
it
|
275
|
-
expect(
|
276
|
-
expect(
|
277
|
-
expect(
|
272
|
+
it 'has a syscall member that returns the expected value' do
|
273
|
+
expect(process).to respond_to(:syscall)
|
274
|
+
expect(process.syscall).to be_kind_of(Integer)
|
275
|
+
expect(process.syscall).to be >= 0
|
278
276
|
end
|
279
277
|
|
280
|
-
it
|
281
|
-
expect(
|
282
|
-
expect(
|
283
|
-
expect(
|
278
|
+
it 'has a pri member that returns the expected value' do
|
279
|
+
expect(process).to respond_to(:pri)
|
280
|
+
expect(process.pri).to be_kind_of(Integer)
|
281
|
+
expect(process.pri).to be >= 0
|
284
282
|
end
|
285
283
|
|
286
|
-
it
|
287
|
-
expect(
|
288
|
-
expect(
|
289
|
-
expect(
|
284
|
+
it 'has a clname member that returns the expected value' do
|
285
|
+
expect(process).to respond_to(:clname)
|
286
|
+
expect(process.clname).to be_kind_of(String)
|
287
|
+
expect(process.clname.size).to be_between(0, 8)
|
290
288
|
end
|
291
289
|
|
292
|
-
it
|
293
|
-
expect(
|
294
|
-
expect(
|
295
|
-
expect(
|
290
|
+
it 'has a name member that returns the expected value' do
|
291
|
+
expect(process).to respond_to(:name)
|
292
|
+
expect(process.name).to be_kind_of(String)
|
293
|
+
expect(process.name.size).to be_between(0, 16)
|
296
294
|
end
|
297
295
|
|
298
|
-
it
|
299
|
-
expect(
|
300
|
-
expect(
|
301
|
-
expect(
|
296
|
+
it 'has an onpro member that returns the expected value' do
|
297
|
+
expect(process).to respond_to(:onpro)
|
298
|
+
expect(process.onpro).to be_kind_of(Integer)
|
299
|
+
expect(process.onpro).to be >= 0
|
302
300
|
end
|
303
301
|
|
304
|
-
it
|
305
|
-
expect(
|
306
|
-
expect(
|
307
|
-
expect(
|
302
|
+
it 'has a bindpro member that returns the expected value' do
|
303
|
+
expect(process).to respond_to(:bindpro)
|
304
|
+
expect(process.bindpro).to be_kind_of(Integer)
|
305
|
+
expect(process.bindpro).to be >= -1
|
308
306
|
end
|
309
307
|
|
310
|
-
it
|
311
|
-
expect(
|
312
|
-
expect(
|
313
|
-
expect(
|
308
|
+
it 'has a bindpset member that returns the expected value' do
|
309
|
+
expect(process).to respond_to(:bindpset)
|
310
|
+
expect(process.bindpset).to be_kind_of(Integer)
|
311
|
+
expect(process.bindpset).to be >= -1
|
314
312
|
end
|
315
313
|
end
|
316
314
|
end
|