Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
2362b589
Commit
2362b589
authored
Dec 16, 1996
by
Roger E. Masse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revised strategy for testing recomended by bwarsaw
parent
14ed5fb1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
26 deletions
+28
-26
Lib/test/test_dl.py
Lib/test/test_dl.py
+28
-26
No files found.
Lib/test/test_dl.py
View file @
2362b589
#! /usr/bin/env python
"""Test dlmodule.c
Roger E. Masse
Roger E. Masse
revised strategy by Barry Warsaw
"""
filename
=
'/usr/lib/libresolv.so'
try
:
import
dl
except
ImportError
:
# No test if no library
raise
SystemExit
verbose
=
0
if
__name__
==
'__main__'
:
verbose
=
1
try
:
import
os
n
=
os
.
popen
(
'/bin/uname'
,
'r'
)
if
n
.
readlines
()[
0
][:
-
1
]
!=
'SunOS'
:
raise
SystemExit
l
=
dl
.
open
(
'/usr/lib/libresolv.so'
)
except
:
# No test if not SunOS (or Solaris)
raise
SystemExit
import
dl
# Try to open a shared library that should be available
# on SunOS and Solaris in a default place
try
:
open
(
filename
,
'r'
)
except
IOError
:
# No test if I can't even open the test file with builtin open
raise
SystemExit
sharedlibs
=
[
# SunOS/Solaris
(
'/usr/lib/libresolv.so'
,
'gethostent'
),
]
l
=
dl
.
open
(
filename
)
a
=
l
.
call
(
'gethostent'
)
l
.
close
()
for
s
,
func
in
sharedlibs
:
try
:
if
verbose
:
print
'trying to open:'
,
s
,
l
=
dl
.
open
(
s
)
except
dl
.
error
:
if
verbose
:
print
'failed'
pass
else
:
if
verbose
:
print
'succeeded...'
,
l
.
call
(
func
)
l
.
close
()
if
verbose
:
print
'worked!'
break
else
:
print
'Could not open any shared libraries'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment