1996-12-13 20:32:26 +00:00
|
|
|
#! /usr/bin/env python
|
|
|
|
"""Test dlmodule.c
|
1996-12-16 20:25:44 +00:00
|
|
|
Roger E. Masse revised strategy by Barry Warsaw
|
1996-12-13 20:32:26 +00:00
|
|
|
"""
|
|
|
|
|
1996-12-16 20:25:44 +00:00
|
|
|
import dl
|
2002-07-23 19:04:11 +00:00
|
|
|
from test.test_support import verbose,TestSkipped
|
1996-12-13 20:32:26 +00:00
|
|
|
|
1996-12-16 20:25:44 +00:00
|
|
|
sharedlibs = [
|
1997-04-09 20:57:52 +00:00
|
|
|
('/usr/lib/libc.so', 'getpid'),
|
1999-02-23 17:58:48 +00:00
|
|
|
('/lib/libc.so.6', 'getpid'),
|
2001-02-27 20:54:23 +00:00
|
|
|
('/usr/bin/cygwin1.dll', 'getpid'),
|
2006-04-21 10:40:58 +00:00
|
|
|
('/usr/lib/libc.dylib', 'getpid'),
|
1996-12-16 20:25:44 +00:00
|
|
|
]
|
1996-12-13 20:32:26 +00:00
|
|
|
|
1996-12-16 20:25:44 +00:00
|
|
|
for s, func in sharedlibs:
|
|
|
|
try:
|
1998-03-26 19:42:58 +00:00
|
|
|
if verbose:
|
2007-02-09 05:37:30 +00:00
|
|
|
print('trying to open:', s, end=' ')
|
1998-03-26 19:42:58 +00:00
|
|
|
l = dl.open(s)
|
2007-01-10 16:19:56 +00:00
|
|
|
except dl.error as err:
|
1998-03-26 19:42:58 +00:00
|
|
|
if verbose:
|
2007-02-09 05:37:30 +00:00
|
|
|
print('failed', repr(str(err)))
|
1998-03-26 19:42:58 +00:00
|
|
|
pass
|
1996-12-16 20:25:44 +00:00
|
|
|
else:
|
1998-03-26 19:42:58 +00:00
|
|
|
if verbose:
|
2007-02-09 05:37:30 +00:00
|
|
|
print('succeeded...', end=' ')
|
1998-03-26 19:42:58 +00:00
|
|
|
l.call(func)
|
|
|
|
l.close()
|
|
|
|
if verbose:
|
2007-02-09 05:37:30 +00:00
|
|
|
print('worked!')
|
1998-03-26 19:42:58 +00:00
|
|
|
break
|
1996-12-16 20:25:44 +00:00
|
|
|
else:
|
2007-08-29 23:37:32 +00:00
|
|
|
raise TestSkipped('Could not open any shared libraries')
|