File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
graalpython/com.oracle.graal.python.test/src/tests Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -101,12 +101,28 @@ class _dl_phdr_info(ctypes.Structure):
101
101
_RTLD_NOLOAD = ctypes .DEFAULT_MODE
102
102
103
103
libc_name = find_library ("c" )
104
- LIBC = None if libc_name is None else ctypes .CDLL (libc_name , mode = _RTLD_NOLOAD )
104
+ LIBC = None
105
+ if libc_name is not None :
106
+ try :
107
+ LIBC = ctypes .CDLL (libc_name , mode = _RTLD_NOLOAD )
108
+ except OSError :
109
+ # we most certainly don't have permission to load a native library
110
+ # so, this test is irrelevant in this case.
111
+ pass
105
112
CNT = 0
106
-
113
+ DLPI_LIST = []
107
114
108
115
def _callback (info , size , data ):
109
116
global CNT
117
+ global DLPI_LIST
118
+ # Get the path of the current library
119
+ filepath = info .contents .dlpi_name
120
+ if filepath :
121
+ filepath = filepath .decode ("utf-8" )
122
+
123
+ DLPI_LIST .append (filepath )
124
+ # Store the library controller if it is supported and selected
125
+ # self._make_controller_from_path(filepath)
110
126
CNT += 1
111
127
return 0
112
128
@@ -125,4 +141,5 @@ def test_libc_callbacks():
125
141
data = ctypes .c_char_p (b"" )
126
142
LIBC .dl_iterate_phdr (c_match_library_callback , data )
127
143
144
+ assert len (DLPI_LIST ) > 0 , "no library was found!"
128
145
assert CNT > 0 , "no callbacks have been called"
You can’t perform that action at this time.
0 commit comments