blob: 57cacadef2ba7beb1b427af7aeef60277c715e8f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
require_relative '../../spec_helper'
describe "Process::Constants" do
platform_is :darwin, :netbsd, :freebsd do
it "are all present on BSD-like systems" do
%i[
WNOHANG
WUNTRACED
PRIO_PROCESS
PRIO_PGRP
PRIO_USER
RLIM_INFINITY
RLIMIT_CPU
RLIMIT_FSIZE
RLIMIT_DATA
RLIMIT_STACK
RLIMIT_CORE
RLIMIT_RSS
RLIMIT_MEMLOCK
RLIMIT_NPROC
RLIMIT_NOFILE
].each do |const|
Process.const_defined?(const).should be_true
Process.const_get(const).should be_an_instance_of(Integer)
end
end
end
platform_is :darwin do
it "are all present on Darwin" do
%i[
RLIM_SAVED_MAX
RLIM_SAVED_CUR
RLIMIT_AS
].each do |const|
Process.const_defined?(const).should be_true
Process.const_get(const).should be_an_instance_of(Integer)
end
end
end
platform_is :linux do
it "are all present on Linux" do
%i[
WNOHANG
WUNTRACED
PRIO_PROCESS
PRIO_PGRP
PRIO_USER
RLIMIT_CPU
RLIMIT_FSIZE
RLIMIT_DATA
RLIMIT_STACK
RLIMIT_CORE
RLIMIT_RSS
RLIMIT_NPROC
RLIMIT_NOFILE
RLIMIT_MEMLOCK
RLIMIT_AS
RLIM_INFINITY
RLIM_SAVED_MAX
RLIM_SAVED_CUR
].each do |const|
Process.const_defined?(const).should be_true
Process.const_get(const).should be_an_instance_of(Integer)
end
end
end
platform_is :netbsd, :freebsd do
it "are all present on NetBSD and FreeBSD" do
%i[
RLIMIT_SBSIZE
RLIMIT_AS
].each do |const|
Process.const_defined?(const).should be_true
Process.const_get(const).should be_an_instance_of(Integer)
end
end
end
platform_is :freebsd do
it "are all present on FreeBSD" do
%i[
RLIMIT_NPTS
].each do |const|
Process.const_defined?(const).should be_true
Process.const_get(const).should be_an_instance_of(Integer)
end
end
end
platform_is :windows do
it "does not define RLIMIT constants" do
%i[
RLIMIT_CPU
RLIMIT_FSIZE
RLIMIT_DATA
RLIMIT_STACK
RLIMIT_CORE
RLIMIT_RSS
RLIMIT_NPROC
RLIMIT_NOFILE
RLIMIT_MEMLOCK
RLIMIT_AS
RLIM_INFINITY
RLIM_SAVED_MAX
RLIM_SAVED_CUR
].each do |const|
Process.const_defined?(const).should be_false
end
end
end
end
|