source: python/trunk/Lib/test/test_dl.py

Last change on this file was 391, checked in by dmik, 11 years ago

python: Merge vendor 2.7.6 to trunk.

  • Property svn:eol-style set to native
File size: 978 bytes
Line 
1#! /usr/bin/env python
2"""Test dlmodule.c
3 Roger E. Masse revised strategy by Barry Warsaw
4"""
5import unittest
6from test.test_support import verbose, import_module
7dl = import_module('dl', deprecated=True)
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
16def test_main():
17 for s, func in sharedlibs:
18 try:
19 if verbose:
20 print 'trying to open:', s,
21 l = dl.open(s)
22 except dl.error, err:
23 if verbose:
24 print 'failed', repr(str(err))
25 pass
26 else:
27 if verbose:
28 print 'succeeded...',
29 l.call(func)
30 l.close()
31 if verbose:
32 print 'worked!'
33 break
34 else:
35 raise unittest.SkipTest, 'Could not open any shared libraries'
36
37
38if __name__ == '__main__':
39 test_main()
Note: See TracBrowser for help on using the repository browser.