From owner-freebsd-standards@FreeBSD.ORG Mon Apr 21 00:34:05 2003 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D619737B401; Mon, 21 Apr 2003 00:34:05 -0700 (PDT) Received: from smtp02.syd.iprimus.net.au (smtp02.syd.iprimus.net.au [210.50.76.52]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4842743FA3; Mon, 21 Apr 2003 00:34:05 -0700 (PDT) (envelope-from tim@robbins.dropbear.id.au) Received: from dilbert.robbins.dropbear.id.au (210.50.80.82) by smtp02.syd.iprimus.net.au (7.0.012) id 3E8A1600003AB4C5; Mon, 21 Apr 2003 17:34:03 +1000 Received: by dilbert.robbins.dropbear.id.au (Postfix, from userid 1000) id 066B1B4CD; Mon, 21 Apr 2003 17:33:54 +1000 (EST) Date: Mon, 21 Apr 2003 17:33:54 +1000 From: Tim Robbins To: David Leimbach Message-ID: <20030421173354.A41423@dilbert.robbins.dropbear.id.au> References: <6AE199CE-739E-11D7-98DE-0003937E39E0@mac.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <6AE199CE-739E-11D7-98DE-0003937E39E0@mac.com>; from leimy2k@mac.com on Sun, Apr 20, 2003 at 09:10:26PM -0500 cc: freebsd-current@freebsd.org cc: freebsd-standards@freebsd.org Subject: Re: test-strerror regression test X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Apr 2003 07:34:06 -0000 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. $ 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() PASS strerror_r() PASS wcschr() PASS wcscmp() PASS wcslen() PASS wmemchr() PASS wmemset() Tim