1996-12-13 16:32:26 -04:00
|
|
|
#! /usr/bin/env python
|
|
|
|
"""Test dlmodule.c
|
1996-12-16 16:25:44 -04:00
|
|
|
Roger E. Masse revised strategy by Barry Warsaw
|
1996-12-13 16:32:26 -04:00
|
|
|
"""
|
|
|
|
|
1996-12-16 16:25:44 -04:00
|
|
|
import dl
|
1996-12-20 18:36:52 -04:00
|
|
|
from test_support import verbose
|
1996-12-13 16:32:26 -04:00
|
|
|
|
1996-12-16 16:25:44 -04:00
|
|
|
sharedlibs = [
|
1997-04-09 17:57:52 -03:00
|
|
|
('/usr/lib/libc.so', 'getpid'),
|
1996-12-16 16:25:44 -04:00
|
|
|
]
|
1996-12-13 16:32:26 -04:00
|
|
|
|
1996-12-16 16:25:44 -04:00
|
|
|
for s, func in sharedlibs:
|
|
|
|
try:
|
1998-03-26 15:42:58 -04:00
|
|
|
if verbose:
|
|
|
|
print 'trying to open:', s,
|
|
|
|
l = dl.open(s)
|
1996-12-16 16:25:44 -04:00
|
|
|
except dl.error:
|
1998-03-26 15:42:58 -04:00
|
|
|
if verbose:
|
|
|
|
print 'failed'
|
|
|
|
pass
|
1996-12-16 16:25:44 -04:00
|
|
|
else:
|
1998-03-26 15:42:58 -04:00
|
|
|
if verbose:
|
|
|
|
print 'succeeded...',
|
|
|
|
l.call(func)
|
|
|
|
l.close()
|
|
|
|
if verbose:
|
|
|
|
print 'worked!'
|
|
|
|
break
|
1996-12-16 16:25:44 -04:00
|
|
|
else:
|
|
|
|
print 'Could not open any shared libraries'
|