Files for 2.1b1 distribution.
[python/dscho.git] / Lib / test / test_dl.py
blob390dbd8afa7b90228e4df5d3af3d3868e1489a6f
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,TestSkipped
9 sharedlibs = [
10 ('/usr/lib/libc.so', 'getpid'),
11 ('/lib/libc.so.6', 'getpid'),
12 ('/usr/bin/cygwin1.dll', 'getpid'),
15 for s, func in sharedlibs:
16 try:
17 if verbose:
18 print 'trying to open:', s,
19 l = dl.open(s)
20 except dl.error, err:
21 if verbose:
22 print 'failed', repr(str(err))
23 pass
24 else:
25 if verbose:
26 print 'succeeded...',
27 l.call(func)
28 l.close()
29 if verbose:
30 print 'worked!'
31 break
32 else:
33 raise TestSkipped, 'Could not open any shared libraries'