Roger E. Masse | 7eee08d | 1996-12-13 20:32:26 +0000 | [diff] [blame^] | 1 | #! /usr/bin/env python |
| 2 | """Test dlmodule.c |
| 3 | Roger E. Masse |
| 4 | """ |
| 5 | filename = '/usr/lib/libresolv.so' |
| 6 | try: |
| 7 | import dl |
| 8 | except ImportError: |
| 9 | # No test if no library |
| 10 | raise SystemExit |
| 11 | |
| 12 | try: |
| 13 | import os |
| 14 | n = os.popen('/bin/uname','r') |
| 15 | if n.readlines()[0][:-1] != 'SunOS': |
| 16 | raise SystemExit |
| 17 | l = dl.open('/usr/lib/libresolv.so') |
| 18 | except: |
| 19 | # No test if not SunOS (or Solaris) |
| 20 | raise SystemExit |
| 21 | |
| 22 | # Try to open a shared library that should be available |
| 23 | # on SunOS and Solaris in a default place |
| 24 | try: |
| 25 | open(filename,'r') |
| 26 | except IOError: |
| 27 | # No test if I can't even open the test file with builtin open |
| 28 | raise SystemExit |
| 29 | |
| 30 | l = dl.open(filename) |
| 31 | a = l.call('gethostent') |
| 32 | l.close() |