summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorRoger E. Masse <rmasse@newcnri.cnri.reston.va.us>1996-12-13 20:32:26 (GMT)
committerRoger E. Masse <rmasse@newcnri.cnri.reston.va.us>1996-12-13 20:32:26 (GMT)
commit7eee08d04fb74305a309f73538bdb485577c7539 (patch)
tree11f336e0c3a9bbbc24bdd63bdca2a0c7f8575863 /Lib/test
parent2cc8163e30aa5e966ab439a872371ca25a9845b2 (diff)
downloadcpython-7eee08d04fb74305a309f73538bdb485577c7539.zip
cpython-7eee08d04fb74305a309f73538bdb485577c7539.tar.gz
cpython-7eee08d04fb74305a309f73538bdb485577c7539.tar.bz2
Test for the dl module. This only works for SunOS and Solaris.
I've attempted to make a test that silently exits if either module dl is not present, we're not on a Sun OS, or a standard shared library ('/usr/lib/libresolv.so') is not found... Otherwise, It does a simple test of dlmodule on that library. I *think* this would be ok to add to testall.py but I'll wait till I hear some feedback on the liberalness of this approach.
Diffstat (limited to 'Lib/test')
-rwxr-xr-xLib/test/test_dl.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/Lib/test/test_dl.py b/Lib/test/test_dl.py
new file mode 100755
index 0000000..b8cb0c04
--- /dev/null
+++ b/Lib/test/test_dl.py
@@ -0,0 +1,32 @@
+#! /usr/bin/env python
+"""Test dlmodule.c
+ Roger E. Masse
+"""
+filename = '/usr/lib/libresolv.so'
+try:
+ import dl
+except ImportError:
+ # No test if no library
+ raise SystemExit
+
+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
+
+# 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
+
+l = dl.open(filename)
+a = l.call('gethostent')
+l.close()