repo.or.cz
/
python
/
dscho.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Clarify portability and main program.
[python/dscho.git]
/
Lib
/
test
/
test_dl.py
blob
e7902cc5e06533b8bbd6bd9def645c9f99e1f805
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'