test-strerror regression test

David Leimbach leimy2k at mac.com
Sun Apr 20 19:10:30 PDT 2003


In /usr/src/tools/regression/lib/libc/string there is a test
"test-strerror.c" which attempts to verify a correct value for
strerror(0);

This is probably a bogus value for strerror even though the posix 
standard
does say it returns a string for any int.  Unless the locales for the 
area are
all predefined somewhere we probably don't need this regression test
as it tests for the validity of the strings.

In fact this test fails due to it not asserting the correct string.

errno = 0;
sret = strerror(0);
assert(strcmp(sret, "Unknown Error: 0") == 0);
assert(errno == EINVAL);


I don't think this code has been tested in a long time...  The string
should be "Undefined error: 0" and why would 0 errno be EINVAL?

If we are going to have a test suite it should at least be correct and
documented don't you think?

Dave



More information about the freebsd-standards mailing list