1996-12-16 16:20:33 -04:00
|
|
|
#! /usr/bin/env python
|
|
|
|
"""Test the errno module
|
|
|
|
Roger E. Masse
|
|
|
|
"""
|
1996-12-16 16:40:20 -04:00
|
|
|
|
|
|
|
import errno
|
2002-07-23 16:04:11 -03:00
|
|
|
from test.test_support import verbose
|
1996-12-16 16:20:33 -04:00
|
|
|
|
|
|
|
errors = ['E2BIG', 'EACCES', 'EADDRINUSE', 'EADDRNOTAVAIL', 'EADV',
|
1998-03-26 15:42:58 -04:00
|
|
|
'EAFNOSUPPORT', 'EAGAIN', 'EALREADY', 'EBADE', 'EBADF',
|
|
|
|
'EBADFD', 'EBADMSG', 'EBADR', 'EBADRQC', 'EBADSLT',
|
|
|
|
'EBFONT', 'EBUSY', 'ECHILD', 'ECHRNG', 'ECOMM',
|
|
|
|
'ECONNABORTED', 'ECONNREFUSED', 'ECONNRESET',
|
|
|
|
'EDEADLK', 'EDEADLOCK', 'EDESTADDRREQ', 'EDOM',
|
|
|
|
'EDQUOT', 'EEXIST', 'EFAULT', 'EFBIG', 'EHOSTDOWN',
|
|
|
|
'EHOSTUNREACH', 'EIDRM', 'EILSEQ', 'EINPROGRESS',
|
|
|
|
'EINTR', 'EINVAL', 'EIO', 'EISCONN', 'EISDIR',
|
|
|
|
'EL2HLT', 'EL2NSYNC', 'EL3HLT', 'EL3RST', 'ELIBACC',
|
|
|
|
'ELIBBAD', 'ELIBEXEC', 'ELIBMAX', 'ELIBSCN', 'ELNRNG',
|
|
|
|
'ELOOP', 'EMFILE', 'EMLINK', 'EMSGSIZE', 'EMULTIHOP',
|
|
|
|
'ENAMETOOLONG', 'ENETDOWN', 'ENETRESET', 'ENETUNREACH',
|
|
|
|
'ENFILE', 'ENOANO', 'ENOBUFS', 'ENOCSI', 'ENODATA',
|
|
|
|
'ENODEV', 'ENOENT', 'ENOEXEC', 'ENOLCK', 'ENOLINK',
|
|
|
|
'ENOMEM', 'ENOMSG', 'ENONET', 'ENOPKG', 'ENOPROTOOPT',
|
|
|
|
'ENOSPC', 'ENOSR', 'ENOSTR', 'ENOSYS', 'ENOTBLK',
|
|
|
|
'ENOTCONN', 'ENOTDIR', 'ENOTEMPTY', 'ENOTOBACCO', 'ENOTSOCK',
|
|
|
|
'ENOTTY', 'ENOTUNIQ', 'ENXIO', 'EOPNOTSUPP',
|
|
|
|
'EOVERFLOW', 'EPERM', 'EPFNOSUPPORT', 'EPIPE',
|
|
|
|
'EPROTO', 'EPROTONOSUPPORT', 'EPROTOTYPE',
|
|
|
|
'ERANGE', 'EREMCHG', 'EREMOTE', 'ERESTART',
|
|
|
|
'EROFS', 'ESHUTDOWN', 'ESOCKTNOSUPPORT', 'ESPIPE',
|
|
|
|
'ESRCH', 'ESRMNT', 'ESTALE', 'ESTRPIPE', 'ETIME',
|
|
|
|
'ETIMEDOUT', 'ETOOMANYREFS', 'ETXTBSY', 'EUNATCH',
|
|
|
|
'EUSERS', 'EWOULDBLOCK', 'EXDEV', 'EXFULL']
|
1996-12-16 16:20:33 -04:00
|
|
|
|
|
|
|
#
|
1996-12-20 18:36:52 -04:00
|
|
|
# This is is a wee bit bogus since the module only conditionally adds
|
1996-12-16 16:20:33 -04:00
|
|
|
# errno constants if they have been defined by errno.h However, this
|
|
|
|
# test seems to work on SGI, Sparc & intel Solaris, and linux.
|
|
|
|
#
|
|
|
|
for error in errors:
|
1997-04-09 18:02:17 -03:00
|
|
|
try:
|
1998-03-26 15:42:58 -04:00
|
|
|
a = getattr(errno, error)
|
1997-04-09 18:02:17 -03:00
|
|
|
except AttributeError:
|
1998-03-26 15:42:58 -04:00
|
|
|
if verbose:
|
|
|
|
print '%s: not found' % error
|
1997-04-09 18:02:17 -03:00
|
|
|
else:
|
1998-03-26 15:42:58 -04:00
|
|
|
if verbose:
|
|
|
|
print '%s: %d' % (error, a)
|