source: trunk/essentials/dev-lang/python/Lib/test/test_dl.py@ 3951

Last change on this file since 3951 was 3225, checked in by bird, 19 years ago

Python 2.5

File size: 784 bytes
Line 
1#! /usr/bin/env python
2"""Test dlmodule.c
3 Roger E. Masse revised strategy by Barry Warsaw
4"""
5
6import dl
7from test.test_support import verbose,TestSkipped
8
9sharedlibs = [
10 ('/usr/lib/libc.so', 'getpid'),
11 ('/lib/libc.so.6', 'getpid'),
12 ('/usr/bin/cygwin1.dll', 'getpid'),
13 ('/usr/lib/libc.dylib', 'getpid'),
14 ]
15
16for 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
33else:
34 raise TestSkipped, 'Could not open any shared libraries'
Note: See TracBrowser for help on using the repository browser.