Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / lib / python2.4 / test / test_dl.py
CommitLineData
86530b38
AT
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 ]
14
15for s, func in sharedlibs:
16 try:
17 if verbose:
18 print 'trying to open:', s,
19 l = dl.open(s)
20 except dl.error, err:
21 if verbose:
22 print 'failed', repr(str(err))
23 pass
24 else:
25 if verbose:
26 print 'succeeded...',
27 l.call(func)
28 l.close()
29 if verbose:
30 print 'worked!'
31 break
32else:
33 raise TestSkipped, 'Could not open any shared libraries'