home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pyos2bin.zip / Lib / test / test_dl.py < prev    next >
Text File  |  1997-04-09  |  529b  |  32 lines

  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_support import verbose
  8.  
  9. sharedlibs = [
  10.     ('/usr/lib/libc.so', 'getpid'),
  11.     ]
  12.  
  13. for s, func in sharedlibs:
  14.     try:
  15.     if verbose:
  16.         print 'trying to open:', s,
  17.     l = dl.open(s)
  18.     except dl.error:
  19.     if verbose:
  20.         print 'failed'
  21.     pass
  22.     else:
  23.     if verbose:
  24.         print 'succeeded...',
  25.     l.call(func)
  26.     l.close()
  27.     if verbose:
  28.         print 'worked!'
  29.     break
  30. else:
  31.     print 'Could not open any shared libraries'
  32.