0001 #! /usr/bin/env python 0002 """Test dlmodule.c 0003 Roger E. Masse revised strategy by Barry Warsaw 0004 """ 0005 0006 import dl 0007 from test.test_support import verbose,TestSkipped 0008 0009 sharedlibs = [ 0010 ('/usr/lib/libc.so', 'getpid'), 0011 ('/lib/libc.so.6', 'getpid'), 0012 ('/usr/bin/cygwin1.dll', 'getpid'), 0013 ] 0014 0015 for s, func in sharedlibs: 0016 try: 0017 if verbose: 0018 print 'trying to open:', s, 0019 l = dl.open(s) 0020 except dl.error, err: 0021 if verbose: 0022 print 'failed', repr(str(err)) 0023 pass 0024 else: 0025 if verbose: 0026 print 'succeeded...', 0027 l.call(func) 0028 l.close() 0029 if verbose: 0030 print 'worked!' 0031 break 0032 else: 0033 raise TestSkipped, 'Could not open any shared libraries' 0034
Generated by PyXR 0.9.4