Staging
v0.5.1
https://github.com/python/cpython
Revision e9ac7201fd09eef09d6d9a4bae6454ee8856ef78 authored by Jack Jansen on 23 May 2003, 22:34:39 UTC, committed by Jack Jansen on 23 May 2003, 22:34:39 UTC
1 parent e47b01f
Raw File
Tip revision: e9ac7201fd09eef09d6d9a4bae6454ee8856ef78 authored by Jack Jansen on 23 May 2003, 22:34:39 UTC
Backport of 1.48: on Mac OS X don't use -R for runtime_library_dirs, use
Tip revision: e9ac720
test_dl.py
#! /usr/bin/env python
"""Test dlmodule.c
   Roger E. Masse  revised strategy by Barry Warsaw
"""

import dl
from test_support import verbose,TestSkipped

sharedlibs = [
    ('/usr/lib/libc.so', 'getpid'),
    ('/lib/libc.so.6', 'getpid'),
    ('/usr/bin/cygwin1.dll', 'getpid'),
    ]

for s, func in sharedlibs:
    try:
        if verbose:
            print 'trying to open:', s,
        l = dl.open(s)
    except dl.error, err:
        if verbose:
            print 'failed', repr(str(err))
        pass
    else:
        if verbose:
            print 'succeeded...',
        l.call(func)
        l.close()
        if verbose:
            print 'worked!'
        break
else:
    raise TestSkipped, 'Could not open any shared libraries'
back to top