1996-12-14 04:32:26 +08:00
|
|
|
#! /usr/bin/env python
|
|
|
|
"""Test dlmodule.c
|
1996-12-17 04:25:44 +08:00
|
|
|
Roger E. Masse revised strategy by Barry Warsaw
|
1996-12-14 04:32:26 +08:00
|
|
|
"""
|
|
|
|
|
1996-12-17 04:25:44 +08:00
|
|
|
import dl
|
2000-08-04 21:34:43 +08:00
|
|
|
from test_support import verbose,TestSkipped
|
1996-12-14 04:32:26 +08:00
|
|
|
|
1996-12-17 04:25:44 +08:00
|
|
|
sharedlibs = [
|
1997-04-10 04:57:52 +08:00
|
|
|
('/usr/lib/libc.so', 'getpid'),
|
1999-02-24 01:58:48 +08:00
|
|
|
('/lib/libc.so.6', 'getpid'),
|
1996-12-17 04:25:44 +08:00
|
|
|
]
|
1996-12-14 04:32:26 +08:00
|
|
|
|
1996-12-17 04:25:44 +08:00
|
|
|
for s, func in sharedlibs:
|
|
|
|
try:
|
1998-03-27 03:42:58 +08:00
|
|
|
if verbose:
|
|
|
|
print 'trying to open:', s,
|
|
|
|
l = dl.open(s)
|
1999-02-24 01:58:48 +08:00
|
|
|
except dl.error, err:
|
1998-03-27 03:42:58 +08:00
|
|
|
if verbose:
|
1999-02-24 01:58:48 +08:00
|
|
|
print 'failed', repr(str(err))
|
1998-03-27 03:42:58 +08:00
|
|
|
pass
|
1996-12-17 04:25:44 +08:00
|
|
|
else:
|
1998-03-27 03:42:58 +08:00
|
|
|
if verbose:
|
|
|
|
print 'succeeded...',
|
|
|
|
l.call(func)
|
|
|
|
l.close()
|
|
|
|
if verbose:
|
|
|
|
print 'worked!'
|
|
|
|
break
|
1996-12-17 04:25:44 +08:00
|
|
|
else:
|
2000-08-04 21:34:43 +08:00
|
|
|
raise TestSkipped, 'Could not open any shared libraries'
|