tddium-sys-proctable 0.9.2-x86-darwin-10
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +294 -0
- data/MANIFEST +30 -0
- data/README +119 -0
- data/Rakefile +158 -0
- data/benchmarks/bench_ps.rb +21 -0
- data/doc/top.txt +47 -0
- data/examples/example_ps.rb +20 -0
- data/ext/darwin/extconf.rb +4 -0
- data/ext/darwin/sys/proctable.c +256 -0
- data/lib/sys/top.rb +32 -0
- data/sys-proctable.gemspec +42 -0
- data/test/test_sys_proctable_all.rb +85 -0
- data/test/test_sys_proctable_darwin.rb +213 -0
- metadata +99 -0
@@ -0,0 +1,213 @@
|
|
1
|
+
########################################################################
|
2
|
+
# test_sys_proctable_darwin.rb
|
3
|
+
#
|
4
|
+
# Test suite for the Darwin version of the sys-proctable library. You
|
5
|
+
# should run these tests via the 'rake test' task.
|
6
|
+
########################################################################
|
7
|
+
require 'rubygems'
|
8
|
+
gem 'test-unit'
|
9
|
+
|
10
|
+
require 'sys/proctable'
|
11
|
+
require 'test/test_sys_proctable_all'
|
12
|
+
include Sys
|
13
|
+
|
14
|
+
class TC_ProcTable_Darwin < Test::Unit::TestCase
|
15
|
+
def self.startup
|
16
|
+
@@fields = %w/
|
17
|
+
pid ppid pgid ruid rgid comm state pctcpu oncpu tnum
|
18
|
+
tdev wmesg rtime priority usrpri nice cmdline starttime
|
19
|
+
maxrss ixrss idrss isrss minflt majflt nswap inblock oublock
|
20
|
+
msgsnd msgrcv nsignals nvcsw nivcsw utime stime
|
21
|
+
/
|
22
|
+
end
|
23
|
+
|
24
|
+
def setup
|
25
|
+
@ptable = ProcTable.ps.last
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_fields
|
29
|
+
assert_respond_to(ProcTable, :fields)
|
30
|
+
assert_kind_of(Array, ProcTable.fields)
|
31
|
+
assert_equal(@@fields, ProcTable.fields)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_pid
|
35
|
+
assert_respond_to(@ptable, :pid)
|
36
|
+
assert_kind_of(Fixnum, @ptable.pid)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_ppid
|
40
|
+
assert_respond_to(@ptable, :ppid)
|
41
|
+
assert_kind_of(Fixnum, @ptable.ppid)
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_pgid
|
45
|
+
assert_respond_to(@ptable, :pgid)
|
46
|
+
assert_kind_of(Fixnum, @ptable.pgid)
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_ruid
|
50
|
+
assert_respond_to(@ptable, :ruid)
|
51
|
+
assert_kind_of(Fixnum, @ptable.ruid)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_rgid
|
55
|
+
assert_respond_to(@ptable, :rgid)
|
56
|
+
assert_kind_of(Fixnum, @ptable.rgid)
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_comm
|
60
|
+
assert_respond_to(@ptable, :comm)
|
61
|
+
assert_kind_of(String, @ptable.comm)
|
62
|
+
assert_true(@ptable.comm.length > 0)
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_state
|
66
|
+
assert_respond_to(@ptable, :state)
|
67
|
+
assert_kind_of(String, @ptable.state)
|
68
|
+
assert_true(%w/idle run sleep stop zombie unknown/.include?(@ptable.state))
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_pctcpu
|
72
|
+
assert_respond_to(@ptable, :pctcpu)
|
73
|
+
assert_kind_of(Float, @ptable.pctcpu)
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_oncpu
|
77
|
+
assert_respond_to(@ptable, :oncpu)
|
78
|
+
omit("oncpu always nil for now")
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_tnum
|
82
|
+
assert_respond_to(@ptable, :tnum)
|
83
|
+
#assert_kind_of(Fixnum, @ptable.tnum)
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_tdev
|
87
|
+
assert_respond_to(@ptable, :tdev)
|
88
|
+
#assert_kind_of(String, @ptable.tdev)
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_wmesg
|
92
|
+
assert_respond_to(@ptable, :wmesg)
|
93
|
+
assert_kind_of(String, @ptable.wmesg)
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_rtime
|
97
|
+
assert_respond_to(@ptable, :rtime)
|
98
|
+
assert_kind_of(Fixnum, @ptable.rtime)
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_priority
|
102
|
+
assert_respond_to(@ptable, :priority)
|
103
|
+
assert_kind_of(Fixnum, @ptable.priority)
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_usrpri
|
107
|
+
assert_respond_to(@ptable, :usrpri)
|
108
|
+
assert_kind_of(Fixnum, @ptable.usrpri)
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_nice
|
112
|
+
assert_respond_to(@ptable, :nice)
|
113
|
+
assert_kind_of(Fixnum, @ptable.nice)
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_cmdline
|
117
|
+
assert_respond_to(@ptable, :cmdline)
|
118
|
+
assert_kind_of(String, @ptable.cmdline)
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_starttime
|
122
|
+
assert_respond_to(@ptable, :starttime)
|
123
|
+
assert_kind_of(Time, @ptable.starttime)
|
124
|
+
end
|
125
|
+
|
126
|
+
def test_maxrss
|
127
|
+
assert_respond_to(@ptable, :maxrss)
|
128
|
+
assert_true([NilClass, Fixnum].include?(@ptable.maxrss.class))
|
129
|
+
end
|
130
|
+
|
131
|
+
def test_ixrss
|
132
|
+
assert_respond_to(@ptable, :ixrss)
|
133
|
+
assert_true([NilClass, Fixnum].include?(@ptable.ixrss.class))
|
134
|
+
end
|
135
|
+
|
136
|
+
def test_idrss
|
137
|
+
assert_respond_to(@ptable, :idrss)
|
138
|
+
assert_true([NilClass, Fixnum].include?(@ptable.idrss.class))
|
139
|
+
end
|
140
|
+
|
141
|
+
def test_isrss
|
142
|
+
assert_respond_to(@ptable, :isrss)
|
143
|
+
assert_true([NilClass, Fixnum].include?(@ptable.isrss.class))
|
144
|
+
end
|
145
|
+
|
146
|
+
def test_minflt
|
147
|
+
assert_respond_to(@ptable, :minflt)
|
148
|
+
assert_true([NilClass, Fixnum].include?(@ptable.minflt.class))
|
149
|
+
end
|
150
|
+
|
151
|
+
def test_majflt
|
152
|
+
assert_respond_to(@ptable, :majflt)
|
153
|
+
assert_true([NilClass, Fixnum].include?(@ptable.majflt.class))
|
154
|
+
end
|
155
|
+
|
156
|
+
def test_nswap
|
157
|
+
assert_respond_to(@ptable, :nswap)
|
158
|
+
assert_true([NilClass, Fixnum].include?(@ptable.nswap.class))
|
159
|
+
end
|
160
|
+
|
161
|
+
def test_inblock
|
162
|
+
assert_respond_to(@ptable, :inblock)
|
163
|
+
assert_true([NilClass, Fixnum].include?(@ptable.inblock.class))
|
164
|
+
end
|
165
|
+
|
166
|
+
def test_oublock
|
167
|
+
assert_respond_to(@ptable, :oublock)
|
168
|
+
assert_true([NilClass, Fixnum].include?(@ptable.oublock.class))
|
169
|
+
end
|
170
|
+
|
171
|
+
def test_msgsnd
|
172
|
+
assert_respond_to(@ptable, :msgsnd)
|
173
|
+
assert_true([NilClass, Fixnum].include?(@ptable.msgsnd.class))
|
174
|
+
end
|
175
|
+
|
176
|
+
def test_msgrcv
|
177
|
+
assert_respond_to(@ptable, :msgrcv)
|
178
|
+
assert_true([NilClass, Fixnum].include?(@ptable.msgrcv.class))
|
179
|
+
end
|
180
|
+
|
181
|
+
def test_nsignals
|
182
|
+
assert_respond_to(@ptable, :nsignals)
|
183
|
+
assert_true([NilClass, Fixnum].include?(@ptable.nsignals.class))
|
184
|
+
end
|
185
|
+
|
186
|
+
def test_nvcsw
|
187
|
+
assert_respond_to(@ptable, :nvcsw)
|
188
|
+
assert_true([NilClass, Fixnum].include?(@ptable.nvcsw.class))
|
189
|
+
end
|
190
|
+
|
191
|
+
def test_nivcsw
|
192
|
+
assert_respond_to(@ptable, :nivcsw)
|
193
|
+
assert_true([NilClass, Fixnum].include?(@ptable.nivcsw.class))
|
194
|
+
end
|
195
|
+
|
196
|
+
def test_utime
|
197
|
+
assert_respond_to(@ptable, :utime)
|
198
|
+
assert_true([NilClass, Fixnum].include?(@ptable.utime.class))
|
199
|
+
end
|
200
|
+
|
201
|
+
def test_stime
|
202
|
+
assert_respond_to(@ptable, :stime)
|
203
|
+
assert_true([NilClass, Fixnum].include?(@ptable.stime.class))
|
204
|
+
end
|
205
|
+
|
206
|
+
def teardown
|
207
|
+
@ptable = nil
|
208
|
+
end
|
209
|
+
|
210
|
+
def self.shutdown
|
211
|
+
@@fields = nil
|
212
|
+
end
|
213
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tddium-sys-proctable
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 63
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 9
|
9
|
+
- 2
|
10
|
+
version: 0.9.2
|
11
|
+
platform: x86-darwin-10
|
12
|
+
authors:
|
13
|
+
- Daniel J. Berger
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-03-18 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: test-unit
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 15
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 1
|
33
|
+
- 2
|
34
|
+
version: 2.1.2
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id001
|
37
|
+
description: " Testing a separate publish to see if I can get the mac install to work with bundler.\n\n The sys-proctable library provides an interface for gathering information\n about processes on your system, i.e. the process table. Most major\n platforms are supported and, while different platforms may return\n different information, the external interface is identical across\n platforms.\n"
|
38
|
+
email: info@tddium.com
|
39
|
+
executables: []
|
40
|
+
|
41
|
+
extensions:
|
42
|
+
- ext/darwin/extconf.rb
|
43
|
+
extra_rdoc_files:
|
44
|
+
- CHANGES
|
45
|
+
- README
|
46
|
+
- MANIFEST
|
47
|
+
- doc/top.txt
|
48
|
+
- ext/darwin/sys/proctable.c
|
49
|
+
files:
|
50
|
+
- benchmarks/bench_ps.rb
|
51
|
+
- examples/example_ps.rb
|
52
|
+
- lib/sys/top.rb
|
53
|
+
- CHANGES
|
54
|
+
- MANIFEST
|
55
|
+
- Rakefile
|
56
|
+
- README
|
57
|
+
- sys-proctable.gemspec
|
58
|
+
- test/test_sys_proctable_all.rb
|
59
|
+
- doc/top.txt
|
60
|
+
- ext/darwin/sys/proctable.c
|
61
|
+
- test/test_sys_proctable_darwin.rb
|
62
|
+
- ext/darwin/extconf.rb
|
63
|
+
has_rdoc: true
|
64
|
+
homepage: http://www.rubyforge.org/projects/sysutils
|
65
|
+
licenses:
|
66
|
+
- Artistic 2.0
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
hash: 3
|
78
|
+
segments:
|
79
|
+
- 0
|
80
|
+
version: "0"
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
hash: 3
|
87
|
+
segments:
|
88
|
+
- 0
|
89
|
+
version: "0"
|
90
|
+
requirements: []
|
91
|
+
|
92
|
+
rubyforge_project: sysutils
|
93
|
+
rubygems_version: 1.5.2
|
94
|
+
signing_key:
|
95
|
+
specification_version: 3
|
96
|
+
summary: An interface for providing process table information
|
97
|
+
test_files:
|
98
|
+
- test/test_sys_proctable_all.rb
|
99
|
+
- test/test_sys_proctable_darwin.rb
|