From owner-freebsd-current@FreeBSD.ORG Mon Apr 21 04:51:26 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C383937B401; Mon, 21 Apr 2003 04:51:26 -0700 (PDT) Received: from smtpout.mac.com (smtpout.mac.com [17.250.248.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0B15743FE9; Mon, 21 Apr 2003 04:51:26 -0700 (PDT) (envelope-from leimy2k@mac.com) Received: from asmtp01.mac.com (asmtp01-qfe3 [10.13.10.65]) by smtpout.mac.com (Xserve/MantshX 2.0) with ESMTP id h3LBpPdP001086; Mon, 21 Apr 2003 04:51:25 -0700 (PDT) Received: from mac.com ([66.156.160.96]) by asmtp01.mac.com (Netscape Messaging Server 4.15) with ESMTP id HDOZLP00.U32; Mon, 21 Apr 2003 04:51:25 -0700 Date: Mon, 21 Apr 2003 06:51:24 -0500 Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v552) To: Tim Robbins From: David Leimbach In-Reply-To: <20030421173354.A41423@dilbert.robbins.dropbear.id.au> Message-Id: <938EF288-73EF-11D7-98DE-0003937E39E0@mac.com> Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.552) cc: freebsd-current@FreeBSD.ORG cc: freebsd-standards@FreeBSD.ORG Subject: Re: test-strerror regression test X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Apr 2003 11:51:27 -0000 On Monday, April 21, 2003, at 02:33 AM, Tim Robbins wrote: > On Sun, Apr 20, 2003 at 09:10:26PM -0500, David Leimbach wrote: > >> 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? > > The regression tests are regression tests, and not conformance tests > for any > particular standard. FreeBSD prints "Unknown error: x", not "No error" > like MSVC, and not "Error x" like Solaris. FreeBSD 4.8-RELEASE and > 5.0-CURRENT > pass the tests. > I guess my point was I didn't know how to make these "conform" when I looked at the POSIX standard for SUS. All it said about strerror is that any int should work and return a string per the locale that is currently set. > $ uname -srm > FreeBSD 5.0-CURRENT i386 > $ make > cc -O -pipe -mcpu=pentiumpro test-strerror.c -o test-strerror > cc -O -pipe -mcpu=pentiumpro test-wcschr.c -o test-wcschr > cc -O -pipe -mcpu=pentiumpro test-wcscmp.c -o test-wcscmp > cc -O -pipe -mcpu=pentiumpro test-wcslen.c -o test-wcslen > cc -O -pipe -mcpu=pentiumpro test-wmemchr.c -o test-wmemchr > cc -O -pipe -mcpu=pentiumpro test-wmemset.c -o test-wmemset > for p in test-strerror test-wcschr test-wcscmp test-wcslen > test-wmemchr test-wmemset; do > /home/tim/p4/wchar/src/tools/regression/lib/libc/string/$p; done > PASS strerror() Failed for me due to failing assertions. > PASS strerror_r() > PASS wcschr() > PASS wcscmp() > PASS wcslen() > PASS wmemchr() > PASS wmemset() > > > Tim