sys-proctable 0.9.4-universal-linux → 0.9.5-universal-linux
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/CHANGES +6 -0
- data/Rakefile +2 -0
- data/lib/linux/sys/proctable.rb +15 -11
- data/sys-proctable.gemspec +1 -1
- data/test/test_sys_proctable_all.rb +7 -1
- data/test/test_sys_proctable_linux.rb +7 -7
- data/test/test_sys_top.rb +46 -0
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99bb7edbbd342331c80b1f70d99ec18c31adbadf
|
4
|
+
data.tar.gz: 90d82ed00cbdc63a9b28660314ef89f4eef2995f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56a5e9be9e450baff6d52ed8354ad963b62b30a6d06e23388bded5264188428443f24c3a7589b862926a621ee9cb162d56316e66a642feba4467571779d3ae6a
|
7
|
+
data.tar.gz: 78b4fbf16b223897686c2e9cfb9091d1ab125e011d7bba91a9f9d5ac8fca89b112ecad7a71d377ec6736b0f80619d894d3a918208f59d71c1acc8c2e2a58f8a9
|
data/CHANGES
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 0.9.5 - 10-Feb-2015
|
2
|
+
* Significant cleanup and memory reduction of the OSX code. Thanks go
|
3
|
+
to Ivan (toy) for the patches.
|
4
|
+
* Skip over /proc/<file>/status if unreadable on Linux. Thanks go to Jianjun
|
5
|
+
Mao for the patch.
|
6
|
+
|
1
7
|
== 0.9.4 - 4-Mar-2014
|
2
8
|
* Added support for AIX 5.3 or later courtesy of Rick Ohnemus.
|
3
9
|
* The Solaris version now uses FFI structs instead of a packed array.
|
data/Rakefile
CHANGED
@@ -174,6 +174,8 @@ namespace :gem do
|
|
174
174
|
spec.files += ['lib/windows/sys/proctable.rb']
|
175
175
|
spec.test_files << 'test/test_sys_proctable_windows.rb'
|
176
176
|
end
|
177
|
+
|
178
|
+
spec.test_files << 'test/test_sys_top.rb'
|
177
179
|
|
178
180
|
# https://github.com/rubygems/rubygems/issues/147
|
179
181
|
spec.original_platform = spec.platform
|
data/lib/linux/sys/proctable.rb
CHANGED
@@ -11,7 +11,7 @@ module Sys
|
|
11
11
|
private_class_method :new
|
12
12
|
|
13
13
|
# The version of the sys-proctable library
|
14
|
-
VERSION = '0.9.
|
14
|
+
VERSION = '0.9.5'
|
15
15
|
|
16
16
|
private
|
17
17
|
|
@@ -211,17 +211,21 @@ module Sys
|
|
211
211
|
struct.policy = stat[40].to_i
|
212
212
|
|
213
213
|
# Get /proc/<pid>/status information (name, uid, euid, gid, egid)
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
214
|
+
begin
|
215
|
+
IO.foreach("/proc/#{file}/status") do |line|
|
216
|
+
case line
|
217
|
+
when /Name:\s*?(\w+)/
|
218
|
+
struct.name = $1
|
219
|
+
when /Uid:\s*?(\d+)\s*?(\d+)/
|
220
|
+
struct.uid = $1.to_i
|
221
|
+
struct.euid = $2.to_i
|
222
|
+
when /Gid:\s*?(\d+)\s*?(\d+)/
|
223
|
+
struct.gid = $1.to_i
|
224
|
+
struct.egid = $2.to_i
|
225
|
+
end
|
224
226
|
end
|
227
|
+
rescue Errno::ESRCH, Errno::ENOENT
|
228
|
+
next
|
225
229
|
end
|
226
230
|
|
227
231
|
# If cmdline is empty use comm instead
|
data/sys-proctable.gemspec
CHANGED
@@ -19,7 +19,7 @@ class TC_ProcTable_All < Test::Unit::TestCase
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_version
|
22
|
-
assert_equal('0.9.
|
22
|
+
assert_equal('0.9.5', ProcTable::VERSION)
|
23
23
|
end
|
24
24
|
|
25
25
|
def test_fields
|
@@ -71,6 +71,12 @@ class TC_ProcTable_All < Test::Unit::TestCase
|
|
71
71
|
assert_kind_of(StandardError, Sys::ProcTable::Error.new)
|
72
72
|
end
|
73
73
|
|
74
|
+
def test_from_thread
|
75
|
+
Thread.new do
|
76
|
+
Sys::ProcTable.ps
|
77
|
+
end.value
|
78
|
+
end
|
79
|
+
|
74
80
|
def teardown
|
75
81
|
@pid = nil
|
76
82
|
end
|
@@ -42,7 +42,7 @@ class TC_ProcTable_Linux < Test::Unit::TestCase
|
|
42
42
|
|
43
43
|
def test_exe
|
44
44
|
assert_respond_to(@ptable, :exe)
|
45
|
-
assert_kind_of(String, @ptable.exe)
|
45
|
+
assert_kind_of([NilClass, String], @ptable.exe)
|
46
46
|
end
|
47
47
|
|
48
48
|
def test_fd
|
@@ -52,7 +52,7 @@ class TC_ProcTable_Linux < Test::Unit::TestCase
|
|
52
52
|
|
53
53
|
def test_root
|
54
54
|
assert_respond_to(@ptable, :root)
|
55
|
-
assert_kind_of(String, @ptable.root)
|
55
|
+
assert_kind_of([NilClass, String], @ptable.root)
|
56
56
|
end
|
57
57
|
|
58
58
|
def test_pid
|
@@ -97,7 +97,7 @@ class TC_ProcTable_Linux < Test::Unit::TestCase
|
|
97
97
|
|
98
98
|
def test_flags
|
99
99
|
assert_respond_to(@ptable, :flags)
|
100
|
-
assert_kind_of(
|
100
|
+
assert_kind_of(Numeric, @ptable.flags)
|
101
101
|
end
|
102
102
|
|
103
103
|
def test_minflt
|
@@ -212,7 +212,7 @@ class TC_ProcTable_Linux < Test::Unit::TestCase
|
|
212
212
|
|
213
213
|
def test_sigignore
|
214
214
|
assert_respond_to(@ptable, :sigignore)
|
215
|
-
assert_kind_of(
|
215
|
+
assert_kind_of(Numeric, @ptable.sigignore)
|
216
216
|
end
|
217
217
|
|
218
218
|
def test_sigcatch
|
@@ -227,17 +227,17 @@ class TC_ProcTable_Linux < Test::Unit::TestCase
|
|
227
227
|
|
228
228
|
def test_nswap
|
229
229
|
assert_respond_to(@ptable, :nswap)
|
230
|
-
assert_kind_of(
|
230
|
+
assert_kind_of(Numeric, @ptable.nswap)
|
231
231
|
end
|
232
232
|
|
233
233
|
def test_cnswap
|
234
234
|
assert_respond_to(@ptable, :cnswap)
|
235
|
-
assert_kind_of(
|
235
|
+
assert_kind_of(Numeric, @ptable.cnswap)
|
236
236
|
end
|
237
237
|
|
238
238
|
def test_exit_signal
|
239
239
|
assert_respond_to(@ptable, :exit_signal)
|
240
|
-
assert_kind_of(
|
240
|
+
assert_kind_of(Numeric, @ptable.exit_signal)
|
241
241
|
end
|
242
242
|
|
243
243
|
def test_processor
|
@@ -0,0 +1,46 @@
|
|
1
|
+
##############################################################################
|
2
|
+
# test_sys_top.rb
|
3
|
+
#
|
4
|
+
# Test suite for the sys-top library that is included with this distribution.
|
5
|
+
##############################################################################
|
6
|
+
require 'rubygems'
|
7
|
+
gem 'test-unit'
|
8
|
+
|
9
|
+
require 'test/unit'
|
10
|
+
require 'sys/top'
|
11
|
+
|
12
|
+
class TC_Top < Test::Unit::TestCase
|
13
|
+
include Sys
|
14
|
+
|
15
|
+
def test_version
|
16
|
+
assert_equal('1.0.4', Top::VERSION)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_top_basic
|
20
|
+
assert_respond_to(Top, :top)
|
21
|
+
assert_nothing_raised{ Top.top }
|
22
|
+
assert_nothing_raised{ Top.top(5) }
|
23
|
+
assert_nothing_raised{ Top.top(5, 'cmdline') }
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_top
|
27
|
+
assert_equal(10, Top.top.length)
|
28
|
+
assert_kind_of(Struct::ProcTableStruct, Top.top.first)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_top_with_size
|
32
|
+
assert_equal(5, Top.top(5).length)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_top_with_size_and_sort_by_field
|
36
|
+
assert_equal(5, Top.top(5, :cmdline).length)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_top_return_type
|
40
|
+
assert_kind_of(Array, Top.top)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_top_expected_errors
|
44
|
+
assert_raises(ArgumentError){ Top.top(1, 'foo', 2) }
|
45
|
+
end
|
46
|
+
end
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sys-proctable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.5
|
5
5
|
platform: universal-linux
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-unit
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: |2
|
@@ -65,6 +65,7 @@ files:
|
|
65
65
|
- sys-proctable.gemspec
|
66
66
|
- test/test_sys_proctable_all.rb
|
67
67
|
- test/test_sys_proctable_linux.rb
|
68
|
+
- test/test_sys_top.rb
|
68
69
|
homepage: http://www.rubyforge.org/projects/sysutils
|
69
70
|
licenses:
|
70
71
|
- Artistic 2.0
|
@@ -76,20 +77,21 @@ require_paths:
|
|
76
77
|
- lib/linux
|
77
78
|
required_ruby_version: !ruby/object:Gem::Requirement
|
78
79
|
requirements:
|
79
|
-
- -
|
80
|
+
- - ">="
|
80
81
|
- !ruby/object:Gem::Version
|
81
82
|
version: '0'
|
82
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
84
|
requirements:
|
84
|
-
- -
|
85
|
+
- - ">="
|
85
86
|
- !ruby/object:Gem::Version
|
86
87
|
version: '0'
|
87
88
|
requirements: []
|
88
89
|
rubyforge_project: sysutils
|
89
|
-
rubygems_version: 2.
|
90
|
+
rubygems_version: 2.4.5
|
90
91
|
signing_key:
|
91
92
|
specification_version: 4
|
92
93
|
summary: An interface for providing process table information
|
93
94
|
test_files:
|
94
95
|
- test/test_sys_proctable_all.rb
|
95
96
|
- test/test_sys_proctable_linux.rb
|
97
|
+
- test/test_sys_top.rb
|