Replaced my dumb way of calculating seconds to midnight with Tim Peters' much more...
[python.git] / Lib / test / test_dl.py
blobb70a4cfee24b5440f0ff887ea6da7e746e6a60d7
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.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'),
13 ('/usr/lib/libc.dylib', 'getpid'),
16 for s, func in sharedlibs:
17 try:
18 if verbose:
19 print 'trying to open:', s,
20 l = dl.open(s)
21 except dl.error, err:
22 if verbose:
23 print 'failed', repr(str(err))
24 pass
25 else:
26 if verbose:
27 print 'succeeded...',
28 l.call(func)
29 l.close()
30 if verbose:
31 print 'worked!'
32 break
33 else:
34 raise TestSkipped, 'Could not open any shared libraries'