blob: fed9da4f852a7e6b238611575d5d605b1a5ba12a (
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
|
require 'test_base'
module DL
class TestHandle < TestBase
def test_handle_close
handle = DL::Handle.new(LIBC_SO)
assert_equal 0, handle.close
end
def test_handle_close_twice
handle = DL::Handle.new(LIBC_SO)
handle.close
assert_raises(DL::DLError) do
handle.close
end
end
def test_dlopen_returns_handle
assert_instance_of DL::Handle, dlopen(LIBC_SO)
end
def test_dlopen_safe
assert_raises(SecurityError) do
Thread.new do
$SAFE = 2
dlopen(LIBC_SO)
end.join
end
end
def test_initialize_safe
assert_raises(SecurityError) do
Thread.new do
$SAFE = 2
DL::Handle.new(LIBC_SO)
end.join
end
end
end
end
|