Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Apr 2003 21:10:26 -0500
From:      David Leimbach <leimy2k@mac.com>
To:        freebsd-current@freebsd.org, freebsd-standards@freebsd.org
Subject:   test-strerror regression test
Message-ID:  <6AE199CE-739E-11D7-98DE-0003937E39E0@mac.com>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6AE199CE-739E-11D7-98DE-0003937E39E0>