@@ -14,4 +14,38 @@ def test_windows_constant
1414 end
1515 end
1616
17+ def test_dlopen_linker_script_input_linux
18+ omit ( "This is only for Linux" ) unless RUBY_PLATFORM . match? ( "linux" )
19+ if Dir . glob ( "/usr/lib/*/libncurses.so" ) . empty?
20+ omit ( "libncurses.so is needed" )
21+ end
22+ # libncurses.so uses INPUT() on Debian GNU/Linux
23+ # $ cat /usr/lib/x86_64-linux-gnu/libncurses.so
24+ # INPUT(libncurses.so.6 -ltinfo)
25+ handle = Fiddle . dlopen ( "libncurses.so" )
26+ begin
27+ assert_equal ( "libncurses.so" ,
28+ File . basename ( handle . file_name , ".*" ) )
29+ ensure
30+ handle . close
31+ end
32+ end
33+
34+ def test_dlopen_linker_script_group_linux
35+ omit ( "This is only for Linux" ) unless RUBY_PLATFORM . match? ( "linux" )
36+ # libc.so uses GROUP() on Debian GNU/Linux
37+ # $ cat /usr/lib/x86_64-linux-gnu/libc.so
38+ # /* GNU ld script
39+ # Use the shared library, but some functions are only in
40+ # the static library, so try that secondarily. */
41+ # OUTPUT_FORMAT(elf64-x86-64)
42+ # GROUP ( /lib/x86_64-linux-gnu/libc.so.6 /usr/lib/x86_64-linux-gnu/libc_nonshared.a AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
43+ handle = Fiddle . dlopen ( "libc.so" )
44+ begin
45+ assert_equal ( "libc.so" ,
46+ File . basename ( handle . file_name , ".*" ) )
47+ ensure
48+ handle . close
49+ end
50+ end
1751end if defined? ( Fiddle )
0 commit comments