Clarify portability and main program.
[python/dscho.git] / Lib / test / test_dl.py
blobe7902cc5e06533b8bbd6bd9def645c9f99e1f805
1 #! /usr/bin/env python
2 """Test dlmodule.c
3 Roger E. Masse revised strategy by Barry Warsaw
4 """
6 import dl
7 from test_support import verbose
9 sharedlibs = [
10 ('/usr/lib/libc.so', 'getpid'),
13 for s, func in sharedlibs:
14 try:
15 if verbose:
16 print 'trying to open:', s,
17 l = dl.open(s)
18 except dl.error:
19 if verbose:
20 print 'failed'
21 pass
22 else:
23 if verbose:
24 print 'succeeded...',
25 l.call(func)
26 l.close()
27 if verbose:
28 print 'worked!'
29 break
30 else:
31 print 'Could not open any shared libraries'