Date: Fri, 2 Jan 2015 19:03:43 +1100 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Garrett Cooper <ngie@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r276521 - head/contrib/netbsd-tests/lib/libm Message-ID: <20150102185046.K943@besplex.bde.org> In-Reply-To: <201501020057.t020vf4d063191@svn.freebsd.org> References: <201501020057.t020vf4d063191@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 2 Jan 2015, Garrett Cooper wrote: > Log: > Reset errno in :scalbnf_val and :scalbnl_val before running the tests so the > tested errno isn't stale It is a bug to even test errno. No function in libm accesses errno. > This was needed in order for the test to pass on amd64 with stable/10 > > MFC after: 3 days > > Modified: > head/contrib/netbsd-tests/lib/libm/t_scalbn.c > > Modified: head/contrib/netbsd-tests/lib/libm/t_scalbn.c > ============================================================================== > --- head/contrib/netbsd-tests/lib/libm/t_scalbn.c Thu Jan 1 23:21:46 2015 (r276520) > +++ head/contrib/netbsd-tests/lib/libm/t_scalbn.c Fri Jan 2 00:57:40 2015 (r276521) > @@ -225,6 +225,9 @@ ATF_TC_BODY(scalbnf_val, tc) > double rv; > > for (i = 0; i < tcnt; i++) { > +#ifdef __FreeBSD__ > + errno = 0; > +#endif This is not FreeBSD-specific. A correct test might test errno under the condition (math_errhandling & MATH_ERRNO), but that would be a lot of work to test a fundamentally broken implementataion. > rv = scalbnf(tests[i].inval, tests[i].exp); > ATF_CHECK_EQ_MSG(errno, tests[i].error, > "test %zu: errno %d instead of %d", i, errno, The tests might set errno elsewhere, but scalbnf() obviously doesn't in FreeBSD (and shouldn't unless MATH_ERRNO), so the ATF_CHECK_EQ_MSG() test can have no effect. It is surprising that it doesn't sometimes fail if errno is always 0. If it always succeeds, then tests[i].error must be dead data (always 0) and the ATF_CHECK_EQ_MSG() test dead code (always pass). Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150102185046.K943>