proc-wait3 1.8.1 → 1.9.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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/{CHANGES.rdoc → CHANGES.md} +29 -23
- data/Gemfile +7 -0
- data/{MANIFEST.rdoc → MANIFEST.md} +4 -3
- data/{README.rdoc → README.md} +25 -21
- data/Rakefile +15 -15
- data/ext/proc/wait3.c +2 -2
- data/proc-wait3.gemspec +4 -7
- data/spec/proc_wait3_spec.rb +234 -0
- metadata +26 -36
- metadata.gz.sig +0 -0
- data/test/test_proc_wait3.rb +0 -227
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 833ae8756453e432d042610abec187891cd8c53c9c03f942a247cc0f6488979b
|
|
4
|
+
data.tar.gz: 873ae57b81c82f55f9a34e975ae53eb71319d8c65fde352bfef7bd62f9000cb4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2798ca928c06bd913b04665f7adcd02ac73f2d6d742e30c7d08e15a56c7a284e9cd2cc3b2cb9d8c923fa82d1297fbe30488de848504ffef0cd3dd9a776a6146a
|
|
7
|
+
data.tar.gz: 28976b3335794b2cf0bd0002dafa58c5d3b8eec326d52bd085c34afebc79f3fff838b3c2da12779089d008b037dd7b7ae56b2b2c0f0299e95eb34bb163ff88af
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data.tar.gz.sig
CHANGED
|
Binary file
|
data/{CHANGES.rdoc → CHANGES.md}
RENAMED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
## 1.9.0 - 7-Jan-2021
|
|
2
|
+
* Switched from test-unit to rspec.
|
|
3
|
+
* Skip some tests on Darwin because of EINTR errors.
|
|
4
|
+
* Switched from rdoc to markdown since github isn't rendering rdoc properly.
|
|
5
|
+
* Added a Gemfile.
|
|
6
|
+
|
|
7
|
+
## 1.8.1 - 8-Apr-2020
|
|
2
8
|
* Added a LICENSE file to the distribution as required by the Apache-2.0 license.
|
|
3
9
|
* Add an explicit .rdoc extension to the README, CHANGES and MANIFEST files.
|
|
4
10
|
|
|
5
|
-
|
|
11
|
+
## 1.8.0 - 20-Feb-2019
|
|
6
12
|
* Changed license to Apache-2.0.
|
|
7
13
|
* Now requires Ruby 2.2 or later.
|
|
8
14
|
* Now checks for <bsd/string.h> header and include's it if found. This was
|
|
@@ -13,21 +19,21 @@
|
|
|
13
19
|
* Removed some old macro checks/definitions that were no longer relevant.
|
|
14
20
|
* Added a proc-wait3.rb file for convenience.
|
|
15
21
|
|
|
16
|
-
|
|
22
|
+
## 1.7.3 - 21-Nov-2015
|
|
17
23
|
* Fixed a bug where tv_usec was divided by 1k instead of 1e6. Thanks go to
|
|
18
24
|
Jason Gladish for the spot.
|
|
19
25
|
* This gem is now signed.
|
|
20
26
|
* The gem related tasks in the Rakefile now assume Rubygems 2.x.
|
|
21
27
|
|
|
22
|
-
|
|
28
|
+
## 1.7.2 - 5-Sep-2014
|
|
23
29
|
* Added support for the RUSAGE_THREAD constant on Linux. Thanks go to
|
|
24
30
|
Bruno Michel for the patch.
|
|
25
31
|
|
|
26
|
-
|
|
32
|
+
## 1.7.1 - 24-Apr-2014
|
|
27
33
|
* Explicitly check for and include sys/resource.h because Debian. Thanks
|
|
28
34
|
go to Christos Trochalakis for the spot.
|
|
29
35
|
|
|
30
|
-
|
|
36
|
+
## 1.7.0 - 6-Apr-2014
|
|
31
37
|
* The wait3 and wait4 methods no longer set $? to a custom struct. The builtin
|
|
32
38
|
variable is still set, but if you need the custom Struct::ProcStat information
|
|
33
39
|
then use the $last_status global instead, or just use the return value. This
|
|
@@ -36,12 +42,12 @@
|
|
|
36
42
|
* Some build warning fixes for BSD platforms.
|
|
37
43
|
* Some test updates for BSD and Solaris.
|
|
38
44
|
|
|
39
|
-
|
|
45
|
+
## 1.6.0 - 28-Aug-2011
|
|
40
46
|
* Removed the getrlimit and setrlimit methods. Ruby has supported these methods
|
|
41
47
|
since Ruby 1.8.5, so I think it's time to finally dump them.
|
|
42
48
|
* Fixed two build warnings regarding unused variables and one 32/64 cast warning.
|
|
43
49
|
|
|
44
|
-
|
|
50
|
+
## 1.5.6 - 7-Jan-2010
|
|
45
51
|
* Checks are now made for the si_fd, si_utime, si_status and si_stime siginfo_t
|
|
46
52
|
struct members. This addresses build failures on OS X 10.5 and later where
|
|
47
53
|
those struct members went mysteriously MIA.
|
|
@@ -51,7 +57,7 @@
|
|
|
51
57
|
* Updates to the README.
|
|
52
58
|
* Source code moved to github.
|
|
53
59
|
|
|
54
|
-
|
|
60
|
+
## 1.5.5 - 8-Aug-2009
|
|
55
61
|
* Now compatible with Ruby 1.9.x.
|
|
56
62
|
* License changed to Artistic 2.0.
|
|
57
63
|
* Added test-unit 2.x as a development dependency.
|
|
@@ -62,7 +68,7 @@
|
|
|
62
68
|
* Example files renamed to avoid any confusion with actual test files.
|
|
63
69
|
* Several Rake tasks added to run individual example programs.
|
|
64
70
|
|
|
65
|
-
|
|
71
|
+
## 1.5.4 - 7-Feb-2008
|
|
66
72
|
* ALERT! ALERT! Now auto-patches your mkmf.rb file to add the 'have_const'
|
|
67
73
|
method if it's not already found. This is necessary to determine if certain
|
|
68
74
|
enum values exist on your system. Your original mkmf.rb is backed up first
|
|
@@ -73,7 +79,7 @@
|
|
|
73
79
|
* Fixed the extconf.rb file so that it sets the target directory properly.
|
|
74
80
|
* No source code changes (except for comment updates and a version bump).
|
|
75
81
|
|
|
76
|
-
|
|
82
|
+
## 1.5.3 - 25-Oct-2006
|
|
77
83
|
* Because not all platforms support automatically converting signal names
|
|
78
84
|
into their equivalent numbers, the Process.pause method now accepts names
|
|
79
85
|
or numbers. It will raise an ArgumentError if you try to use a signal name
|
|
@@ -86,7 +92,7 @@
|
|
|
86
92
|
* Internal fixes for platforms that don't support the strlcpy() function.
|
|
87
93
|
* Minor update for the test_pause.rb example program.
|
|
88
94
|
|
|
89
|
-
|
|
95
|
+
## 1.5.2 - 24-Jul-2006
|
|
90
96
|
* Fixed the way I was handling whether or not Ruby already defined the various
|
|
91
97
|
RLIMIT constants within wait3.c.
|
|
92
98
|
* Fixed the way in which certain RLIM constants were being converted. I
|
|
@@ -95,7 +101,7 @@
|
|
|
95
101
|
* Added the WAIT3_VERSION constant.
|
|
96
102
|
* The getrlimit and setrlimit tests are now skipped for Ruby 1.8.5 or later.
|
|
97
103
|
|
|
98
|
-
|
|
104
|
+
## 1.5.1 - 13-Jul-2006
|
|
99
105
|
* Fixed bugs with improper values being set for some of the rlimit constants.
|
|
100
106
|
* Cleaned up a few warnings related to signed-ness for the RLIM_xxx constants.
|
|
101
107
|
* Now only sets the various rlimit constants if they're not already defined
|
|
@@ -103,21 +109,21 @@
|
|
|
103
109
|
* Some internal cleanup.
|
|
104
110
|
* Created a gemspec and added a gem to RubyForge.
|
|
105
111
|
|
|
106
|
-
|
|
112
|
+
## 1.5.0 - 12-Jun-2006
|
|
107
113
|
* Removed the '?' character from the various struct members, since Ruby
|
|
108
114
|
no longer (properly) handles them.
|
|
109
115
|
* Fixed a 64 bit bug related to rb_struct_define.
|
|
110
116
|
* Added some more tests.
|
|
111
117
|
|
|
112
|
-
|
|
118
|
+
## 1.4.3 - 28-Jun-2005
|
|
113
119
|
* Added more #ifdef checks for some of the process flags which, it turns
|
|
114
120
|
out, are not defined in earlier versions of Linux.
|
|
115
121
|
|
|
116
|
-
|
|
122
|
+
## 1.4.2 - 14-Jun-2005
|
|
117
123
|
* Fixed a syntax error that could cause the build to fail.
|
|
118
124
|
* Removed some (but not all) possible warnings from gcc -Wall.
|
|
119
125
|
|
|
120
|
-
|
|
126
|
+
## 1.4.1 - 13-Jun-2005
|
|
121
127
|
* Added support for the Linux 2.6.9+ kernel (by adding more preprocessor
|
|
122
128
|
constant checks, which may help with other platforms as well).
|
|
123
129
|
* Moved project to RubyForge.
|
|
@@ -125,34 +131,34 @@
|
|
|
125
131
|
* Removed the wait3.rd file.
|
|
126
132
|
* Minor fix for the test_waitid.rb sample program.
|
|
127
133
|
|
|
128
|
-
|
|
134
|
+
## 1.4.0 - 16-Feb-2005
|
|
129
135
|
* Added the getrusage method.
|
|
130
136
|
* Added test cases and documentation for getrusage.
|
|
131
137
|
* Renamed a couple test files in the examples directory.
|
|
132
138
|
|
|
133
|
-
|
|
139
|
+
## 1.3.0 - 14-Feb-2005
|
|
134
140
|
* Added the pause and sigsend methods.
|
|
135
141
|
* I had to modify the process type constants to include the "P_", because
|
|
136
142
|
Ruby already has Process::GID and Process::UID defined. That makes this
|
|
137
143
|
release incompatible with previous versions.
|
|
138
144
|
* Updated tests and documentation.
|
|
139
145
|
|
|
140
|
-
|
|
146
|
+
## 1.2.0 - 7-Feb-2005
|
|
141
147
|
* Added the Proc.waitid method (for those platforms that support it).
|
|
142
148
|
* Made the wait3.c file more rdoc friendly.
|
|
143
149
|
* Added a test_waitid.rb file in the examples directory.
|
|
144
150
|
|
|
145
|
-
|
|
151
|
+
## 1.1.1 - 10-Jan-2005
|
|
146
152
|
* Eliminated some (harmless) warnings that cropped up in 1.8.2
|
|
147
153
|
* Moved the "examples" directory to the toplevel directory.
|
|
148
154
|
* Made docs slightly more rdoc friendly
|
|
149
155
|
|
|
150
|
-
|
|
156
|
+
## 1.1.0 - 14-Sep-2004
|
|
151
157
|
* Modified setup and source to handle the possibility that wait3() might
|
|
152
158
|
be defined while wait4() is not (e.g. HPUX).
|
|
153
159
|
* Modified the test scripts in the examples directory to play nice on HPUX
|
|
154
160
|
and Darwin.
|
|
155
161
|
* Added this file (oops).
|
|
156
162
|
|
|
157
|
-
|
|
163
|
+
## 1.0.0 - 13-Sep-2004
|
|
158
164
|
- Initial release
|
data/Gemfile
ADDED
data/{README.rdoc → README.md}
RENAMED
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
## Description
|
|
2
2
|
Adds the wait3, wait4, waitid, pause, sigsend, and getrusage methods to the Process module.
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
## Installation
|
|
5
|
+
`gem install proc-wait3`
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
## Synopsis
|
|
8
|
+
```ruby
|
|
9
|
+
require 'proc/wait3'
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
pid = fork{
|
|
12
|
+
sleep 1
|
|
13
|
+
exit 2
|
|
14
|
+
}
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
puts Time.now.to_s
|
|
17
|
+
Process.wait3
|
|
18
|
+
puts $?.exitstatus # => 2
|
|
19
|
+
```
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
## Tested Platforms
|
|
22
|
+
* Solaris
|
|
23
|
+
* Linux
|
|
24
|
+
* FreeBSD
|
|
25
|
+
* OS X
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
## Warnings
|
|
26
28
|
Linux users who compile with gcc -Wall will notice a few warnings. These
|
|
27
29
|
are harmless (and unavoidable atm).
|
|
28
30
|
|
|
@@ -30,8 +32,11 @@ Linux users may also notice warnings about implicit declarations. These
|
|
|
30
32
|
are also harmless, and can be silenced by installing the libbsd-dev package
|
|
31
33
|
first.
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
On Darwin these methods will likely fail with Errno::EINTR unless you pass
|
|
36
|
+
the WNOHANG flag. I am not sure why, I can only speculate that the child is
|
|
37
|
+
receiving a signal from either the Ruby interpreter or the operating system.
|
|
34
38
|
|
|
39
|
+
## Integration with Ruby's process.c
|
|
35
40
|
I considered simply providing a patch to the core process.c file, but I
|
|
36
41
|
decided against it for two reasons. First, I wanted to get something
|
|
37
42
|
out more quickly rather than waiting for approval from the core developers
|
|
@@ -44,6 +49,5 @@ The overloaded methods are also overkill, and do nothing but save me the
|
|
|
44
49
|
trouble of typing the word "status", since all they're for is comparing or
|
|
45
50
|
operating on the status attribute.
|
|
46
51
|
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
## Additional Documentation
|
|
49
53
|
Please see the doc/wait3.txt file for detailed documentation.
|
data/Rakefile
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
require 'rake'
|
|
2
2
|
require 'rake/clean'
|
|
3
|
-
require '
|
|
3
|
+
require 'rspec/core/rake_task'
|
|
4
4
|
require 'fileutils'
|
|
5
5
|
require 'rbconfig'
|
|
6
6
|
include RbConfig
|
|
7
7
|
|
|
8
8
|
CLEAN.include(
|
|
9
|
-
'**/*.gem',
|
|
10
|
-
'**/*.rbc',
|
|
11
|
-
'**/*.o',
|
|
12
|
-
'**/*.log',
|
|
13
|
-
'**/Makefile',
|
|
14
|
-
'**/conftest.dSYM',
|
|
15
|
-
"**/*.#{CONFIG['DLEXT']}" # C shared object
|
|
9
|
+
'**/*.gem', # Gem files
|
|
10
|
+
'**/*.rbc', # Rubinius
|
|
11
|
+
'**/*.o', # C object file
|
|
12
|
+
'**/*.log', # Ruby extension build log
|
|
13
|
+
'**/Makefile', # C Makefile
|
|
14
|
+
'**/conftest.dSYM', # OS X build directory
|
|
15
|
+
"**/*.#{CONFIG['DLEXT']}", # C shared object
|
|
16
|
+
'**/*.lock' # Bundler
|
|
16
17
|
)
|
|
17
18
|
|
|
19
|
+
|
|
18
20
|
desc "Build the source (but don't install it)"
|
|
19
21
|
task :build => [:clean] do |t|
|
|
20
22
|
Dir.chdir('ext') do
|
|
@@ -30,7 +32,7 @@ namespace :gem do
|
|
|
30
32
|
require 'rubygems/package'
|
|
31
33
|
spec = eval(IO.read('proc-wait3.gemspec'))
|
|
32
34
|
spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
|
|
33
|
-
Gem::Package.build(spec
|
|
35
|
+
Gem::Package.build(spec)
|
|
34
36
|
end
|
|
35
37
|
|
|
36
38
|
desc "Install the proc-wait3 gem"
|
|
@@ -67,11 +69,9 @@ namespace :example do
|
|
|
67
69
|
end
|
|
68
70
|
end
|
|
69
71
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
t.
|
|
73
|
-
t.warning = true
|
|
74
|
-
t.verbose = true
|
|
72
|
+
desc "Run the test suite"
|
|
73
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
|
74
|
+
t.rspec_opts = '-Iext'
|
|
75
75
|
end
|
|
76
76
|
|
|
77
|
-
task :default => :
|
|
77
|
+
task :default => [:build, :spec]
|
data/ext/proc/wait3.c
CHANGED
|
@@ -954,8 +954,8 @@ void Init_wait3()
|
|
|
954
954
|
rb_define_const(rb_mProcess, "RUSAGE_THREAD", INT2FIX(RUSAGE_THREAD));
|
|
955
955
|
#endif
|
|
956
956
|
|
|
957
|
-
/* 1.
|
|
958
|
-
rb_define_const(rb_mProcess, "WAIT3_VERSION", rb_str_freeze(rb_str_new2("1.
|
|
957
|
+
/* 1.9.0: The version of the proc-wait3 library */
|
|
958
|
+
rb_define_const(rb_mProcess, "WAIT3_VERSION", rb_str_freeze(rb_str_new2("1.9.0")));
|
|
959
959
|
|
|
960
960
|
/* Define this last in our Init_wait3 function */
|
|
961
961
|
rb_define_readonly_variable("$last_status", &v_last_status);
|
data/proc-wait3.gemspec
CHANGED
|
@@ -2,27 +2,24 @@ require 'rubygems'
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |spec|
|
|
4
4
|
spec.name = 'proc-wait3'
|
|
5
|
-
spec.version = '1.
|
|
5
|
+
spec.version = '1.9.0'
|
|
6
6
|
spec.author = 'Daniel J. Berger'
|
|
7
7
|
spec.license = 'Apache-2.0'
|
|
8
8
|
spec.email = 'djberg96@gmail.com'
|
|
9
9
|
spec.homepage = 'https://github.com/djberg96/proc-wait3'
|
|
10
10
|
spec.summary = 'Adds wait3, wait4 and other methods to the Process module'
|
|
11
|
-
spec.test_file = '
|
|
11
|
+
spec.test_file = 'spec/proc_wait3_spec.rb'
|
|
12
12
|
spec.extensions = ['ext/extconf.rb']
|
|
13
13
|
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
|
14
14
|
spec.cert_chain = Dir['certs/*']
|
|
15
15
|
|
|
16
|
-
spec.extra_rdoc_files = ['CHANGES.rdoc', 'README.rdoc', 'MANIFEST.rdoc', 'ext/proc/wait3.c']
|
|
17
|
-
|
|
18
|
-
spec.add_development_dependency('test-unit')
|
|
19
16
|
spec.add_development_dependency('rake')
|
|
20
|
-
spec.
|
|
17
|
+
spec.add_development_dependency('rspec', '~> 3.9')
|
|
21
18
|
|
|
22
19
|
spec.metadata = {
|
|
23
20
|
'homepage_uri' => 'https://github.com/djberg96/proc-wait3',
|
|
24
21
|
'bug_tracker_uri' => 'https://github.com/djberg96/proc-wait3/issues',
|
|
25
|
-
'changelog_uri' => 'https://github.com/djberg96/proc-wait3/blob/master/CHANGES',
|
|
22
|
+
'changelog_uri' => 'https://github.com/djberg96/proc-wait3/blob/master/CHANGES.md',
|
|
26
23
|
'documentation_uri' => 'https://github.com/djberg96/proc-wait3/wiki',
|
|
27
24
|
'source_code_uri' => 'https://github.com/djberg96/proc-wait3',
|
|
28
25
|
'wiki_uri' => 'https://github.com/djberg96/proc-wait3/wiki'
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
#######################################################################
|
|
2
|
+
# proc_wait3_spec.rb
|
|
3
|
+
#
|
|
4
|
+
# Test suite for the Ruby proc-wait3 library. You should run these
|
|
5
|
+
# via the 'rake spec' task.
|
|
6
|
+
#######################################################################
|
|
7
|
+
require 'proc/wait3'
|
|
8
|
+
require 'rspec'
|
|
9
|
+
require 'rbconfig'
|
|
10
|
+
|
|
11
|
+
RSpec.describe Process do
|
|
12
|
+
let(:solaris) { RbConfig::CONFIG['host_os'] =~ /sunos|solaris/i }
|
|
13
|
+
let(:darwin) { RbConfig::CONFIG['host_os'] =~ /darwin|osx/i }
|
|
14
|
+
let(:hpux) { RbConfig::CONFIG['host_os'] =~ /hpux/i }
|
|
15
|
+
let(:linux) { RbConfig::CONFIG['host_os'] =~ /linux/i }
|
|
16
|
+
let(:freebsd) { RbConfig::CONFIG['host_os'] =~ /bsd/i }
|
|
17
|
+
|
|
18
|
+
let(:proc_stat_members) {
|
|
19
|
+
%i[
|
|
20
|
+
pid status utime stime maxrss ixrss idrss isrss minflt majflt nswap
|
|
21
|
+
inblock oublock msgsnd msgrcv nsignals nvcsw nivcsw stopped signaled
|
|
22
|
+
exited success coredump exitstatus termsig stopsig
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
before do
|
|
27
|
+
@proc_stat = nil
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
example "version constant is set to expected value" do
|
|
31
|
+
expect(Process::WAIT3_VERSION).to eq('1.9.0')
|
|
32
|
+
expect(Process::WAIT3_VERSION).to be_frozen
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
example "wait3 method is defined" do
|
|
36
|
+
expect(Process).to respond_to(:wait3)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
example "wait3 works as expected" do
|
|
40
|
+
skip 'wait3 test skipped on this platform' if darwin
|
|
41
|
+
fork{ sleep 0.5 }
|
|
42
|
+
expect{ Process.wait3 }.not_to raise_error
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
example "wait3 returns the expected proc status members" do
|
|
46
|
+
skip 'wait3 test skipped on this platform' if darwin
|
|
47
|
+
fork{ sleep 0.5 }
|
|
48
|
+
expect{ @proc_stat = Process.wait3 }.not_to raise_error
|
|
49
|
+
expect( @proc_stat.members).to eq(proc_stat_members)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
example "wait3 with WNOHANG works as expected" do
|
|
53
|
+
fork{ sleep 0.5 }
|
|
54
|
+
expect{ Process.wait3(Process::WNOHANG) }.not_to raise_error
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
example "wait3 sets and returns $last_status to expected values" do
|
|
58
|
+
skip 'wait3 test skipped on this platform' if darwin
|
|
59
|
+
fork{ sleep 0.5 }
|
|
60
|
+
Process.wait3
|
|
61
|
+
expect($last_status).to be_kind_of(Struct::ProcStat)
|
|
62
|
+
expect($last_status).not_to be_nil
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
example "wait3 sets pid and status members of $?" do
|
|
66
|
+
skip 'wait3 test skipped on this platform' if darwin
|
|
67
|
+
fork{ sleep 0.5 }
|
|
68
|
+
Process.wait3
|
|
69
|
+
expect($?).not_to be_nil
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
example "wait3 returns frozen struct" do
|
|
73
|
+
skip 'wait3 test skipped on this platform' if darwin
|
|
74
|
+
fork{ sleep 0.5 }
|
|
75
|
+
struct = Process.wait3
|
|
76
|
+
expect(struct).to be_frozen
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
example "getdtablesize works as expected" do
|
|
80
|
+
skip 'getdtablesize skipped on this platform' unless solaris
|
|
81
|
+
|
|
82
|
+
expect(Process).to respond_to(:getdtablesize)
|
|
83
|
+
expect(Process.getdtablesize).to be_kind_of(Fixnum)
|
|
84
|
+
assert(Process.getdtablesize > 0)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
example "wait4 method is defined" do
|
|
88
|
+
skip 'wait4 test skipped on this platform' if hpux
|
|
89
|
+
expect(Process).to respond_to(:wait4)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
example "wait4 requires at least one argument" do
|
|
93
|
+
skip 'wait4 test skipped on this platform' if hpux
|
|
94
|
+
expect{ Process.wait4 }.to raise_error(ArgumentError)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
example "wait4 works as expected" do
|
|
98
|
+
skip 'wait4 test skipped on this platform' if hpux || darwin
|
|
99
|
+
|
|
100
|
+
pid = fork{ sleep 0.5 }
|
|
101
|
+
expect{ @proc_stat = Process.wait4(pid) }.not_to raise_error
|
|
102
|
+
expect(@proc_stat).to be_kind_of(Struct::ProcStat)
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
example "wait4 sets and returns $last_status to expected values" do
|
|
106
|
+
skip 'wait4 test skipped on this platform' if hpux || darwin
|
|
107
|
+
|
|
108
|
+
pid = fork{ sleep 0.5 }
|
|
109
|
+
Process.wait4(pid)
|
|
110
|
+
expect($last_status).to be_kind_of(Struct::ProcStat)
|
|
111
|
+
expect($last_status).not_to be_nil
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
example "wait4 sets pid and status members of $?" do
|
|
115
|
+
skip 'wait4 test skipped on this platform' if hpux || darwin
|
|
116
|
+
|
|
117
|
+
pid = fork{ sleep 0.5 }
|
|
118
|
+
Process.wait4(pid)
|
|
119
|
+
expect($?).not_to be_nil
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
example "wait4 returns frozen struct" do
|
|
123
|
+
skip 'wait4 test skipped on this platform' if hpux || darwin
|
|
124
|
+
|
|
125
|
+
pid = fork{ sleep 0.5 }
|
|
126
|
+
struct = Process.wait4(pid)
|
|
127
|
+
expect(struct).to be_frozen
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
example "waitid method is defined" do
|
|
131
|
+
skip 'waitid test skipped on this platform' if hpux || darwin || freebsd
|
|
132
|
+
|
|
133
|
+
expect(Process).to respond_to(:waitid)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
example "waitid method works as expected" do
|
|
137
|
+
skip 'waitid test skipped on this platform' if hpux || darwin || freebsd
|
|
138
|
+
|
|
139
|
+
pid = fork{ sleep 0.5 }
|
|
140
|
+
expect{ Process.waitid(Process::P_PID, pid, Process::WEXITED) }.not_to raise_error
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
example "waitid method raises expected errors if wrong argument type is passed" do
|
|
144
|
+
skip 'waitid test skipped on this platform' if hpux || darwin || freebsd
|
|
145
|
+
|
|
146
|
+
pid = fork{ sleep 0.5 }
|
|
147
|
+
expect{ Process.waitid("foo", pid, Process::WEXITED) }.to raise_error(TypeError)
|
|
148
|
+
expect{ Process.waitid(Process::P_PID, pid, "foo") }.to raise_error(TypeError)
|
|
149
|
+
expect{ Process.waitid(Process::P_PID, "foo", Process::WEXITED) }.to raise_error(TypeError)
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
example "waitid method raises expected error if invalid argument is passed" do
|
|
153
|
+
skip 'waitid test skipped on this platform' if hpux || darwin || freebsd
|
|
154
|
+
|
|
155
|
+
fork{ sleep 0.5 }
|
|
156
|
+
expect{ Process.waitid(Process::P_PID, 99999999, Process::WEXITED) }.to raise_error(Errno::ECHILD)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
example "sigsend method is defined" do
|
|
160
|
+
skip 'sigsend test skipped on this platform' unless solaris
|
|
161
|
+
|
|
162
|
+
expect(Process).to respond_to(:sigsend)
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
example "sigsend works as expected" do
|
|
166
|
+
skip 'sigsend test skipped on this platform' unless solaris
|
|
167
|
+
|
|
168
|
+
pid = fork{ sleep 0.5 }
|
|
169
|
+
expect{ Process.sigsend(Process::P_PID, pid, 0) }.not_to raise_error
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
example "getrusage method is defined" do
|
|
173
|
+
expect(Process).to respond_to(:getrusage)
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
example "getrusage works as expected" do
|
|
177
|
+
fork{ sleep 0.5 }
|
|
178
|
+
|
|
179
|
+
expect{ Process.getrusage }.not_to raise_error
|
|
180
|
+
expect{ Process.getrusage(true) }.not_to raise_error
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
example "getrusage can get thread info on Linux" do
|
|
184
|
+
skip 'getrusage only tested on Linux' unless linux
|
|
185
|
+
expect{ Process.getrusage(Process::RUSAGE_THREAD) }.not_to raise_error
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
example "getrusage returns the expected struct" do
|
|
189
|
+
skip 'getrusage only tested on Linux' unless linux
|
|
190
|
+
|
|
191
|
+
fork{ sleep 0.5 }
|
|
192
|
+
expect(Process.getrusage).to be_kind_of(Struct::RUsage)
|
|
193
|
+
expect(Process.getrusage.stime).to be_kind_of(Float)
|
|
194
|
+
expect(Process.getrusage.utime).to be_kind_of(Float)
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
example "pause method is defined" do
|
|
198
|
+
expect(Process).to respond_to(:pause)
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
example "expected constants are defined" do
|
|
202
|
+
skip 'wait constant check skipped on this platform' if darwin || freebsd
|
|
203
|
+
|
|
204
|
+
expect(Process::WCONTINUED).not_to be_nil
|
|
205
|
+
expect(Process::WEXITED).not_to be_nil
|
|
206
|
+
expect(Process::WNOWAIT).not_to be_nil
|
|
207
|
+
expect(Process::WSTOPPED).not_to be_nil
|
|
208
|
+
|
|
209
|
+
skip 'WTRAPPED constant check skipped on this platform' if linux
|
|
210
|
+
expect(Process::WTRAPPED).not_to be_nil
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
example "expected process type flag constants are defined" do
|
|
214
|
+
skip 'process type flag check skipped on this platform' if linux || darwin || freebsd
|
|
215
|
+
|
|
216
|
+
expect(Process::P_ALL).not_to be_nil
|
|
217
|
+
expect(Process::P_CID).not_to be_nil
|
|
218
|
+
expect(Process::P_GID).not_to be_nil
|
|
219
|
+
expect(Process::P_PGID).not_to be_nil
|
|
220
|
+
expect(Process::P_PID).not_to be_nil
|
|
221
|
+
expect(Process::P_SID).not_to be_nil
|
|
222
|
+
expect(Process::P_UID).not_to be_nil
|
|
223
|
+
|
|
224
|
+
skip 'P_MYID constant check skipped on this platform' unless solaris
|
|
225
|
+
expect(Process::P_MYID).not_to be_nil
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
example "solaris-specific process type flags are defined on solaris" do
|
|
229
|
+
skip 'P_TASKID and P_PROJID constant check skipped on this platform' unless solaris
|
|
230
|
+
|
|
231
|
+
expect(Process::P_TASKID).not_to be_nil
|
|
232
|
+
expect(Process::P_PROJID).not_to be_nil
|
|
233
|
+
end
|
|
234
|
+
end
|
metadata
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: proc-wait3
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel J. Berger
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain:
|
|
11
11
|
- |
|
|
@@ -35,10 +35,10 @@ cert_chain:
|
|
|
35
35
|
ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
|
|
36
36
|
WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
|
|
37
37
|
-----END CERTIFICATE-----
|
|
38
|
-
date:
|
|
38
|
+
date: 2021-01-07 00:00:00.000000000 Z
|
|
39
39
|
dependencies:
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
|
-
name:
|
|
41
|
+
name: rake
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
44
|
- - ">="
|
|
@@ -52,19 +52,19 @@ dependencies:
|
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
53
|
version: '0'
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
|
-
name:
|
|
55
|
+
name: rspec
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
57
57
|
requirements:
|
|
58
|
-
- - "
|
|
58
|
+
- - "~>"
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '
|
|
60
|
+
version: '3.9'
|
|
61
61
|
type: :development
|
|
62
62
|
prerelease: false
|
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
|
-
- - "
|
|
65
|
+
- - "~>"
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: '
|
|
67
|
+
version: '3.9'
|
|
68
68
|
description: |2
|
|
69
69
|
The proc-wait3 library adds the wait3, wait4, waitid, pause, sigsend,
|
|
70
70
|
and getrusage methods to the Process module.
|
|
@@ -72,47 +72,37 @@ email: djberg96@gmail.com
|
|
|
72
72
|
executables: []
|
|
73
73
|
extensions:
|
|
74
74
|
- ext/extconf.rb
|
|
75
|
-
extra_rdoc_files:
|
|
76
|
-
- CHANGES.rdoc
|
|
77
|
-
- README.rdoc
|
|
78
|
-
- MANIFEST.rdoc
|
|
79
|
-
- ext/proc/wait3.c
|
|
75
|
+
extra_rdoc_files: []
|
|
80
76
|
files:
|
|
77
|
+
- CHANGES.md
|
|
78
|
+
- Gemfile
|
|
81
79
|
- LICENSE
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
- ext
|
|
85
|
-
- ext/proc
|
|
86
|
-
- ext/proc/wait3.c
|
|
87
|
-
- ext/extconf.rb
|
|
80
|
+
- MANIFEST.md
|
|
81
|
+
- README.md
|
|
88
82
|
- Rakefile
|
|
89
|
-
- certs
|
|
90
83
|
- certs/djberg96_pub.pem
|
|
91
|
-
-
|
|
92
|
-
- examples/example_wait4.rb
|
|
93
|
-
- examples/example_wait3.rb
|
|
84
|
+
- doc/wait3.txt
|
|
94
85
|
- examples/example_getrusage.rb
|
|
95
86
|
- examples/example_pause.rb
|
|
87
|
+
- examples/example_wait3.rb
|
|
88
|
+
- examples/example_wait4.rb
|
|
96
89
|
- examples/example_waitid.rb
|
|
97
|
-
-
|
|
90
|
+
- ext/extconf.rb
|
|
91
|
+
- ext/proc/wait3.c
|
|
98
92
|
- lib/proc-wait3.rb
|
|
99
|
-
- CHANGES.rdoc
|
|
100
|
-
- doc
|
|
101
|
-
- doc/wait3.txt
|
|
102
|
-
- MANIFEST.rdoc
|
|
103
93
|
- proc-wait3.gemspec
|
|
104
|
-
-
|
|
94
|
+
- spec/proc_wait3_spec.rb
|
|
105
95
|
homepage: https://github.com/djberg96/proc-wait3
|
|
106
96
|
licenses:
|
|
107
97
|
- Apache-2.0
|
|
108
98
|
metadata:
|
|
109
99
|
homepage_uri: https://github.com/djberg96/proc-wait3
|
|
110
100
|
bug_tracker_uri: https://github.com/djberg96/proc-wait3/issues
|
|
111
|
-
changelog_uri: https://github.com/djberg96/proc-wait3/blob/master/CHANGES
|
|
101
|
+
changelog_uri: https://github.com/djberg96/proc-wait3/blob/master/CHANGES.md
|
|
112
102
|
documentation_uri: https://github.com/djberg96/proc-wait3/wiki
|
|
113
103
|
source_code_uri: https://github.com/djberg96/proc-wait3
|
|
114
104
|
wiki_uri: https://github.com/djberg96/proc-wait3/wiki
|
|
115
|
-
post_install_message:
|
|
105
|
+
post_install_message:
|
|
116
106
|
rdoc_options: []
|
|
117
107
|
require_paths:
|
|
118
108
|
- lib
|
|
@@ -120,16 +110,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
120
110
|
requirements:
|
|
121
111
|
- - ">="
|
|
122
112
|
- !ruby/object:Gem::Version
|
|
123
|
-
version: '
|
|
113
|
+
version: '0'
|
|
124
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
115
|
requirements:
|
|
126
116
|
- - ">="
|
|
127
117
|
- !ruby/object:Gem::Version
|
|
128
118
|
version: '0'
|
|
129
119
|
requirements: []
|
|
130
|
-
rubygems_version: 3.0.
|
|
131
|
-
signing_key:
|
|
120
|
+
rubygems_version: 3.0.3
|
|
121
|
+
signing_key:
|
|
132
122
|
specification_version: 4
|
|
133
123
|
summary: Adds wait3, wait4 and other methods to the Process module
|
|
134
124
|
test_files:
|
|
135
|
-
-
|
|
125
|
+
- spec/proc_wait3_spec.rb
|
metadata.gz.sig
CHANGED
|
Binary file
|
data/test/test_proc_wait3.rb
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
##################################################################
|
|
2
|
-
# test_proc_wait3.rb
|
|
3
|
-
#
|
|
4
|
-
# Test suite for the Ruby proc-wait3 package. You should run this
|
|
5
|
-
# via the 'test' rake task.
|
|
6
|
-
##################################################################
|
|
7
|
-
require 'proc/wait3'
|
|
8
|
-
require 'test-unit'
|
|
9
|
-
require 'rbconfig'
|
|
10
|
-
|
|
11
|
-
class TC_Proc_Wait3 < Test::Unit::TestCase
|
|
12
|
-
def self.startup
|
|
13
|
-
@@solaris = RbConfig::CONFIG['host_os'] =~ /sunos|solaris/i
|
|
14
|
-
@@darwin = RbConfig::CONFIG['host_os'] =~ /darwin|osx/i
|
|
15
|
-
@@hpux = RbConfig::CONFIG['host_os'] =~ /hpux/i
|
|
16
|
-
@@linux = RbConfig::CONFIG['host_os'] =~ /linux/i
|
|
17
|
-
@@freebsd = RbConfig::CONFIG['host_os'] =~ /bsd/i
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def setup
|
|
21
|
-
@proc_stat = nil
|
|
22
|
-
@proc_stat_members = [
|
|
23
|
-
"pid", "status", "utime", "stime", "maxrss",
|
|
24
|
-
"ixrss", "idrss", "isrss", "minflt", "majflt", "nswap", "inblock",
|
|
25
|
-
"oublock", "msgsnd", "msgrcv", "nsignals", "nvcsw", "nivcsw",
|
|
26
|
-
"stopped", "signaled","exited","success","coredump","exitstatus",
|
|
27
|
-
"termsig", "stopsig"
|
|
28
|
-
]
|
|
29
|
-
|
|
30
|
-
@proc_stat_members = @proc_stat_members.map{ |e| e.to_sym }
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
test "version constant is set to expected value" do
|
|
34
|
-
assert_equal('1.8.1', Process::WAIT3_VERSION)
|
|
35
|
-
assert_true(Process::WAIT3_VERSION.frozen?)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
test "wait3 method is defined" do
|
|
39
|
-
assert_respond_to(Process, :wait3)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
test "wait3 works as expected" do
|
|
43
|
-
fork{ sleep 0.5 }
|
|
44
|
-
assert_nothing_raised{ Process.wait3 }
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
test "wait3 returns the expected proc status membes" do
|
|
48
|
-
fork{ sleep 0.5 }
|
|
49
|
-
assert_nothing_raised{ @proc_stat = Process.wait3 }
|
|
50
|
-
assert_equal(@proc_stat_members, @proc_stat.members)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
test "wait3 with WNOHANG works as expected" do
|
|
54
|
-
fork{ sleep 0.5 }
|
|
55
|
-
assert_nothing_raised{ Process.wait3(Process::WNOHANG) }
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
test "wait3 sets and returns $last_status to expected values" do
|
|
59
|
-
fork{ sleep 0.5 }
|
|
60
|
-
Process.wait3
|
|
61
|
-
assert_kind_of(Struct::ProcStat, $last_status)
|
|
62
|
-
assert_not_nil($last_status)
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
test "wait3 sets pid and status members of $?" do
|
|
66
|
-
fork{ sleep 0.5 }
|
|
67
|
-
Process.wait3
|
|
68
|
-
assert_not_nil($?)
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
test "wait3 returns frozen struct" do
|
|
72
|
-
fork{ sleep 0.5 }
|
|
73
|
-
struct = Process.wait3
|
|
74
|
-
assert_true(struct.frozen?)
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
test "getdtablesize works as expected" do
|
|
78
|
-
omit_unless(@@solaris, 'getdtablesize skipped on this platform')
|
|
79
|
-
|
|
80
|
-
assert_respond_to(Process, :getdtablesize)
|
|
81
|
-
assert_kind_of(Fixnum, Process.getdtablesize)
|
|
82
|
-
assert(Process.getdtablesize > 0)
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
test "wait4 method is defined" do
|
|
86
|
-
omit_if(@@hpux, 'wait4 test skipped on this platform')
|
|
87
|
-
assert_respond_to(Process,:wait4)
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
test "wait4 requires at least one argument" do
|
|
91
|
-
assert_raises(ArgumentError){ Process.wait4 }
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
test "wait4 works as expected" do
|
|
95
|
-
omit_if(@@hpux, 'wait4 test skipped on this platform')
|
|
96
|
-
|
|
97
|
-
pid = fork{ sleep 0.5 }
|
|
98
|
-
assert_nothing_raised{ @proc_stat = Process.wait4(pid) }
|
|
99
|
-
assert_kind_of(Struct::ProcStat, @proc_stat)
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
test "wait4 sets and returns $last_status to expected values" do
|
|
103
|
-
pid = fork{ sleep 0.5 }
|
|
104
|
-
Process.wait4(pid)
|
|
105
|
-
assert_kind_of(Struct::ProcStat, $last_status)
|
|
106
|
-
assert_not_nil($last_status)
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
test "wait4 sets pid and status members of $?" do
|
|
110
|
-
pid = fork{ sleep 0.5 }
|
|
111
|
-
Process.wait4(pid)
|
|
112
|
-
assert_not_nil($?)
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
test "wait4 returns frozen struct" do
|
|
116
|
-
pid = fork{ sleep 0.5 }
|
|
117
|
-
struct = Process.wait4(pid)
|
|
118
|
-
assert_true(struct.frozen?)
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
test "waitid method is defined" do
|
|
122
|
-
omit_if(@@hpux || @@darwin || @@freebsd, 'waitid test skipped on this platform')
|
|
123
|
-
assert_respond_to(Process, :waitid)
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
test "waitid method works as expected" do
|
|
127
|
-
omit_if(@@hpux || @@darwin || @@freebsd, 'waitid test skipped on this platform')
|
|
128
|
-
pid = fork{ sleep 0.5 }
|
|
129
|
-
assert_nothing_raised{ Process.waitid(Process::P_PID, pid, Process::WEXITED) }
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
test "waitid method raises expected errors if wrong argument type is passed" do
|
|
133
|
-
omit_if(@@hpux || @@darwin || @@freebsd, 'waitid test skipped on this platform')
|
|
134
|
-
pid = fork{ sleep 0.5 }
|
|
135
|
-
assert_raises(TypeError){ Process.waitid("foo", pid, Process::WEXITED) }
|
|
136
|
-
assert_raises(TypeError){ Process.waitid(Process::P_PID, pid, "foo") }
|
|
137
|
-
assert_raises(TypeError){ Process.waitid(Process::P_PID, "foo", Process::WEXITED) }
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
test "waitid method raises expected error if invalid argument is passed" do
|
|
141
|
-
omit_if(@@hpux || @@darwin || @@freebsd, 'waitid test skipped on this platform')
|
|
142
|
-
fork{ sleep 0.5 }
|
|
143
|
-
assert_raises(Errno::ECHILD, Errno::EINVAL){ Process.waitid(Process::P_PID, 99999999, Process::WEXITED) }
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
test "sigsend method is defined" do
|
|
147
|
-
omit_unless(@@solaris, 'sigsend test skipped on this platform')
|
|
148
|
-
assert_respond_to(Process, :sigsend)
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
test "sigsend works as expected" do
|
|
152
|
-
omit_unless(@@solaris, 'sigsend test skipped on this platform')
|
|
153
|
-
pid = fork{ sleep 0.5 }
|
|
154
|
-
assert_nothing_raised{ Process.sigsend(Process::P_PID, pid, 0) }
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
test "getrusage method is defined" do
|
|
158
|
-
assert_respond_to(Process, :getrusage)
|
|
159
|
-
end
|
|
160
|
-
|
|
161
|
-
test "getrusage works as expected" do
|
|
162
|
-
fork{ sleep 0.5 }
|
|
163
|
-
assert_nothing_raised{ Process.getrusage }
|
|
164
|
-
assert_nothing_raised{ Process.getrusage(true) }
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
test "getrusage can get thread info on Linux" do
|
|
168
|
-
omit_unless(@@linux)
|
|
169
|
-
assert_nothing_raised{ Process.getrusage(Process::RUSAGE_THREAD) }
|
|
170
|
-
end
|
|
171
|
-
|
|
172
|
-
test "getrusage returns the expected struct" do
|
|
173
|
-
fork{ sleep 0.5 }
|
|
174
|
-
assert_kind_of(Struct::RUsage, Process.getrusage)
|
|
175
|
-
assert_kind_of(Float, Process.getrusage.stime)
|
|
176
|
-
assert_kind_of(Float, Process.getrusage.utime)
|
|
177
|
-
end
|
|
178
|
-
|
|
179
|
-
test "pause method is defined" do
|
|
180
|
-
assert_respond_to(Process, :pause)
|
|
181
|
-
end
|
|
182
|
-
|
|
183
|
-
test "expected constants are defined" do
|
|
184
|
-
omit_if(@@darwin || @@freebsd, 'wait constant check skipped on this platform')
|
|
185
|
-
|
|
186
|
-
assert_not_nil(Process::WCONTINUED)
|
|
187
|
-
assert_not_nil(Process::WEXITED)
|
|
188
|
-
assert_not_nil(Process::WNOWAIT)
|
|
189
|
-
assert_not_nil(Process::WSTOPPED)
|
|
190
|
-
|
|
191
|
-
omit_if(@@linux, 'WTRAPPED constant check skipped on this platform')
|
|
192
|
-
assert_not_nil(Process::WTRAPPED)
|
|
193
|
-
end
|
|
194
|
-
|
|
195
|
-
test "expected process type flag constants are defined" do
|
|
196
|
-
omit_if(@@linux || @@darwin || @@freebsd, 'process type flag check skipped on this platform')
|
|
197
|
-
|
|
198
|
-
assert_not_nil(Process::P_ALL)
|
|
199
|
-
assert_not_nil(Process::P_CID)
|
|
200
|
-
assert_not_nil(Process::P_GID)
|
|
201
|
-
assert_not_nil(Process::P_MYID) unless @@solaris
|
|
202
|
-
assert_not_nil(Process::P_PGID)
|
|
203
|
-
assert_not_nil(Process::P_PID)
|
|
204
|
-
assert_not_nil(Process::P_SID)
|
|
205
|
-
assert_not_nil(Process::P_UID)
|
|
206
|
-
end
|
|
207
|
-
|
|
208
|
-
test "solaris-specific process type flags are defined on solaris" do
|
|
209
|
-
omit_unless(@@solaris, 'P_TASKID and P_PROJID constant check skipped on this platform')
|
|
210
|
-
|
|
211
|
-
assert_not_nil(Process::P_TASKID)
|
|
212
|
-
assert_not_nil(Process::P_PROJID)
|
|
213
|
-
end
|
|
214
|
-
|
|
215
|
-
def teardown
|
|
216
|
-
@proc_stat = nil
|
|
217
|
-
@proc_stat_members = nil
|
|
218
|
-
end
|
|
219
|
-
|
|
220
|
-
def self.shutdown
|
|
221
|
-
@@solaris = nil
|
|
222
|
-
@@darwin = nil
|
|
223
|
-
@@hpux = nil
|
|
224
|
-
@@linux = nil
|
|
225
|
-
@@freebsd = nil
|
|
226
|
-
end
|
|
227
|
-
end
|