From owner-svn-src-stable@FreeBSD.ORG Tue Jan 20 21:42:44 2015 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5765EDFD; Tue, 20 Jan 2015 21:42:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 38999FB7; Tue, 20 Jan 2015 21:42:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0KLgiqP050304; Tue, 20 Jan 2015 21:42:44 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0KLgf3r050291; Tue, 20 Jan 2015 21:42:41 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201501202142.t0KLgf3r050291@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 20 Jan 2015 21:42:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r277441 - in stable/10: etc/mtree lib/libc lib/libc/tests lib/libc/tests/gen tools/regression/lib/libc/gen X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jan 2015 21:42:44 -0000 Author: ngie Date: Tue Jan 20 21:42:40 2015 New Revision: 277441 URL: https://svnweb.freebsd.org/changeset/base/277441 Log: MFC r274075,r274581,r274582,r274595: r274075 (by ngie): Add reachover Makefiles for contrib/netbsd-tests/lib/libc; this adds approximately 500 new testcases Various TODOs have been sprinkled around the Makefiles for items that even need to be ported (missing features), testcases have issues with building/linking, or issues at runtime. A variant of this code has been tested extensively on amd64 and i386 10-STABLE/11-CURRENT for several months without issue. It builds on other architectures, but the code will remain off until I have prove it works on virtual hardware or real hardware on other architectures In collaboration with: pho, Casey Peel Sponsored by: EMC / Isilon Storage Division r274581 (by ngie): Convert tools/regression/lib/libc/gen/test-arc4random into an ATF testcase and rename as lib/libc/gen/arc4random_test Sponsored by: EMC / Isilon Storage Division r274582 (by ngie): Remove test-arc4random from this Makefile so others can continue to use this as-is for the time being r274595 (by ngie): Convert tools/regression/lib/libc/stdio/test-fpclassify into an ATF testcase and Rename as lib/libc/stdio/fpclassify2_test Sponsored by: EMC / Isilon Storage Division Added: stable/10/lib/libc/Makefile.amd64 - copied unchanged from r274075, head/lib/libc/Makefile.amd64 stable/10/lib/libc/Makefile.i386 - copied unchanged from r274075, head/lib/libc/Makefile.i386 stable/10/lib/libc/tests/ - copied from r274075, head/lib/libc/tests/ stable/10/lib/libc/tests/gen/arc4random_test.c - copied unchanged from r274581, head/lib/libc/tests/gen/arc4random_test.c stable/10/lib/libc/tests/gen/fpclassify2_test.c - copied unchanged from r274595, head/lib/libc/tests/gen/fpclassify2_test.c Deleted: stable/10/tools/regression/lib/libc/gen/test-arc4random.c stable/10/tools/regression/lib/libc/gen/test-fpclassify.c Modified: stable/10/etc/mtree/BSD.tests.dist stable/10/lib/libc/Makefile stable/10/lib/libc/tests/Makefile stable/10/lib/libc/tests/gen/Makefile stable/10/tools/regression/lib/libc/gen/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/mtree/BSD.tests.dist ============================================================================== --- stable/10/etc/mtree/BSD.tests.dist Tue Jan 20 21:15:33 2015 (r277440) +++ stable/10/etc/mtree/BSD.tests.dist Tue Jan 20 21:42:40 2015 (r277441) @@ -87,6 +87,56 @@ test-programs .. .. + libc + c063 + .. + db + .. + gen + execve + .. + posix_spawn + .. + .. + hash + data + .. + .. + inet + .. + locale + .. + net + getaddrinfo + data + .. + .. + .. + regex + data + .. + .. + ssp + .. + stdio + .. + stdlib + .. + string + .. + sys + .. + time + .. + tls + dso + .. + .. + termios + .. + ttyio + .. + .. libcrypt .. libmp Modified: stable/10/lib/libc/Makefile ============================================================================== --- stable/10/lib/libc/Makefile Tue Jan 20 21:15:33 2015 (r277440) +++ stable/10/lib/libc/Makefile Tue Jan 20 21:42:40 2015 (r277441) @@ -160,6 +160,8 @@ libkern.${LIBC_ARCH}:: ${KMSRCS} CFLAGS+=-DSYSCALL_COMPAT .endif +.include + .include # Disable warnings in contributed sources. Copied: stable/10/lib/libc/Makefile.amd64 (from r274075, head/lib/libc/Makefile.amd64) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libc/Makefile.amd64 Tue Jan 20 21:42:40 2015 (r277441, copy of r274075, head/lib/libc/Makefile.amd64) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + Copied: stable/10/lib/libc/Makefile.i386 (from r274075, head/lib/libc/Makefile.i386) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libc/Makefile.i386 Tue Jan 20 21:42:40 2015 (r277441, copy of r274075, head/lib/libc/Makefile.i386) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + Modified: stable/10/lib/libc/tests/Makefile ============================================================================== --- head/lib/libc/tests/Makefile Tue Nov 4 00:56:25 2014 (r274075) +++ stable/10/lib/libc/tests/Makefile Tue Jan 20 21:42:40 2015 (r277441) @@ -1,6 +1,6 @@ # $FreeBSD$ -.include +.include TESTSDIR= ${TESTSBASE}/lib/libc Modified: stable/10/lib/libc/tests/gen/Makefile ============================================================================== --- head/lib/libc/tests/gen/Makefile Tue Nov 4 00:56:25 2014 (r274075) +++ stable/10/lib/libc/tests/gen/Makefile Tue Jan 20 21:42:40 2015 (r277441) @@ -4,6 +4,9 @@ TESTSDIR= ${TESTSBASE}/lib/libc/gen +ATF_TESTS_C= arc4random_test +ATF_TESTS_C+= fpclassify2_test + # TODO: t_closefrom, t_cpuset, t_fmtcheck, t_randomid, t_sleep # TODO: t_siginfo (fixes require further inspection) # TODO: t_sethostname_test (consistently screws up the hostname) Copied: stable/10/lib/libc/tests/gen/arc4random_test.c (from r274581, head/lib/libc/tests/gen/arc4random_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libc/tests/gen/arc4random_test.c Tue Jan 20 21:42:40 2015 (r277441, copy of r274581, head/lib/libc/tests/gen/arc4random_test.c) @@ -0,0 +1,92 @@ +/*- + * Copyright (c) 2011 David Schultz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * BUFSIZE is the number of bytes of rc4 output to compare. The probability + * that this test fails spuriously is 2**(-BUFSIZE * 8). + */ +#define BUFSIZE 8 + +/* + * Test whether arc4random_buf() returns the same sequence of bytes in both + * parent and child processes. (Hint: It shouldn't.) + */ +ATF_TC_WITHOUT_HEAD(test_arc4random); +ATF_TC_BODY(test_arc4random, tc) +{ + struct shared_page { + char parentbuf[BUFSIZE]; + char childbuf[BUFSIZE]; + } *page; + pid_t pid; + char c; + + printf("1..1\n"); + + page = mmap(NULL, sizeof(struct shared_page), PROT_READ | PROT_WRITE, + MAP_ANON | MAP_SHARED, -1, 0); + if (page == MAP_FAILED) { + printf("fail 1 - mmap\n"); + exit(1); + } + + arc4random_buf(&c, 1); + + pid = fork(); + ATF_REQUIRE(0 <= pid); + if (pid == 0) { + /* child */ + arc4random_buf(page->childbuf, BUFSIZE); + exit(0); + } else { + /* parent */ + int status; + arc4random_buf(page->parentbuf, BUFSIZE); + wait(&status); + } + ATF_CHECK_MSG(memcmp(page->parentbuf, page->childbuf, BUFSIZE) != 0, + "sequences are the same"); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, test_arc4random); + + return (atf_no_error()); +} Copied: stable/10/lib/libc/tests/gen/fpclassify2_test.c (from r274595, head/lib/libc/tests/gen/fpclassify2_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libc/tests/gen/fpclassify2_test.c Tue Jan 20 21:42:40 2015 (r277441, copy of r274595, head/lib/libc/tests/gen/fpclassify2_test.c) @@ -0,0 +1,72 @@ +/*- + * Copyright (c) 2003 Mike Barcroft + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include + +ATF_TC_WITHOUT_HEAD(test_fpclassify); +ATF_TC_BODY(test_fpclassify, tc) +{ + + ATF_CHECK(fpclassify((float)0) == FP_ZERO); + ATF_CHECK(fpclassify((float)-0.0) == FP_ZERO); + ATF_CHECK(fpclassify((float)1) == FP_NORMAL); + ATF_CHECK(fpclassify((float)1000) == FP_NORMAL); + ATF_CHECK(fpclassify(HUGE_VALF) == FP_INFINITE); + ATF_CHECK(fpclassify((float)HUGE_VAL) == FP_INFINITE); + ATF_CHECK(fpclassify((float)HUGE_VALL) == FP_INFINITE); + ATF_CHECK(fpclassify(NAN) == FP_NAN); + + ATF_CHECK(fpclassify((double)0) == FP_ZERO); + ATF_CHECK(fpclassify((double)-0) == FP_ZERO); + ATF_CHECK(fpclassify((double)1) == FP_NORMAL); + ATF_CHECK(fpclassify((double)1000) == FP_NORMAL); + ATF_CHECK(fpclassify(HUGE_VAL) == FP_INFINITE); + ATF_CHECK(fpclassify((double)HUGE_VALF) == FP_INFINITE); + ATF_CHECK(fpclassify((double)HUGE_VALL) == FP_INFINITE); + ATF_CHECK(fpclassify((double)NAN) == FP_NAN); + + ATF_CHECK(fpclassify((long double)0) == FP_ZERO); + ATF_CHECK(fpclassify((long double)-0.0) == FP_ZERO); + ATF_CHECK(fpclassify((long double)1) == FP_NORMAL); + ATF_CHECK(fpclassify((long double)1000) == FP_NORMAL); + ATF_CHECK(fpclassify(HUGE_VALL) == FP_INFINITE); + ATF_CHECK(fpclassify((long double)HUGE_VALF) == FP_INFINITE); + ATF_CHECK(fpclassify((long double)HUGE_VAL) == FP_INFINITE); + ATF_CHECK(fpclassify((long double)NAN) == FP_NAN); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, test_fpclassify); + + return (atf_no_error()); +} Modified: stable/10/tools/regression/lib/libc/gen/Makefile ============================================================================== --- stable/10/tools/regression/lib/libc/gen/Makefile Tue Jan 20 21:15:33 2015 (r277440) +++ stable/10/tools/regression/lib/libc/gen/Makefile Tue Jan 20 21:42:40 2015 (r277441) @@ -1,7 +1,7 @@ # $FreeBSD$ -TESTS= test-arc4random test-fmtcheck test-fmtmsg test-fnmatch \ - test-fpclassify test-ftw test-popen test-posix_spawn test-wordexp +TESTS= test-fmtcheck test-fmtmsg test-fnmatch \ + test-ftw test-popen test-posix_spawn test-wordexp .PHONY: tests tests: ${TESTS}