equal
deleted
inserted
replaced
|
1 #! /usr/bin/env python |
|
2 """Test dlmodule.c |
|
3 Roger E. Masse revised strategy by Barry Warsaw |
|
4 """ |
|
5 |
|
6 import dl |
|
7 from test.test_support import verbose,TestSkipped |
|
8 |
|
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'), |
|
14 ] |
|
15 |
|
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' |