From 8864cde3495dbfd6b476c1b77a8bde035e1cf000 Mon Sep 17 00:00:00 2001 From: ngie Date: Fri, 10 Feb 2017 01:13:12 +0000 Subject: MFC r305358,r305449,r305451,r306367,r306397,r309474: This also contains a merge of ^/projects/netbsd-tests-update-12@r304035 . This change never hit ^/head because bin/cat's behavior was changed (on ^/head) to match NetBSD. PR: 210607 r305358: Update contrib/netbsd-tests with new content from NetBSD This updates the snapshot from 09/30/2014 to 08/11/2016 This brings in a number of new testcases from upstream, most notably: - bin/cat - lib/libc - lib/msun - lib/libthr - usr.bin/sort lib/libc/tests/stdio/open_memstream_test.c was moved to lib/libc/tests/stdio/open_memstream2_test.c to accomodate the new open_memstream test from NetBSD. Tested on: amd64 (VMware fusion VM; various bare metal platforms); i386 (VMware fusion VM); make tinderbox r305449: Install h_db to unbreak some of the lib/libc/db testcases after r305358 r305451: Fix lib/libc/rpc test assumptions added in r305358 - Require root in the tcp/udp subtests (it's needed on FreeBSD when registering services). - Skip the tests if service registration fails. r306367 (by br): Allow up to 6 arguments only on MIPS. r306397 (by br): Use right piece of code for FreeBSD. r309474: Don't build :strvis_locale if VIS_NOLOCALE is undefined The copy of contrib/libc-vis on ^/stable/10 doesn't contain all of the features in the ^/stable/11 // ^/head version, including VIS_NOLOCALE. The risk is lower in conditionally running the test instead of backporting the newer version of libc-vis --- contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c') diff --git a/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c b/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c index 4b21860..f1100bf 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_setrlimit.c,v 1.4 2012/06/12 23:56:19 christos Exp $ */ +/* $NetBSD: t_setrlimit.c,v 1.5 2016/07/13 09:53:16 njoly Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_setrlimit.c,v 1.4 2012/06/12 23:56:19 christos Exp $"); +__RCSID("$NetBSD: t_setrlimit.c,v 1.5 2016/07/13 09:53:16 njoly Exp $"); #include #include @@ -515,6 +515,25 @@ ATF_TC_BODY(setrlimit_perm, tc) } } +ATF_TC(setrlimit_stack); +ATF_TC_HEAD(setrlimit_stack, tc) +{ + atf_tc_set_md_var(tc, "descr", "Test setrlimit(2), RLIMIT_STACK"); + atf_tc_set_md_var(tc, "require.user", "unprivileged"); +} + +ATF_TC_BODY(setrlimit_stack, tc) +{ + struct rlimit res; + + /* Ensure soft limit is not bigger than hard limit */ + res.rlim_cur = res.rlim_max = 4192256; + ATF_REQUIRE(setrlimit(RLIMIT_STACK, &res) == 0); + ATF_REQUIRE(getrlimit(RLIMIT_STACK, &res) == 0); + ATF_CHECK(res.rlim_cur <= res.rlim_max); + +} + ATF_TP_ADD_TCS(tp) { @@ -530,6 +549,7 @@ ATF_TP_ADD_TCS(tp) #ifdef __NetBSD__ ATF_TP_ADD_TC(tp, setrlimit_nthr); #endif + ATF_TP_ADD_TC(tp, setrlimit_stack); return atf_no_error(); } -- cgit v1.1 From 9e0c92b812b404c1d5124f2e2d81cb448ec22b07 Mon Sep 17 00:00:00 2001 From: ngie Date: Fri, 10 Feb 2017 02:57:37 +0000 Subject: MFC r309373: r309373 (by bdrewery): Fix setrlimit_test:setrlimit_memlock when the system has exceeded vm.max_wired. This uses the same fix as r294894 did for the mlock test. The code from that commit is moved into a common object file which PROGS supports building first. --- contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c') diff --git a/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c b/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c index f1100bf..31db878 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c @@ -50,6 +50,11 @@ __RCSID("$NetBSD: t_setrlimit.c,v 1.5 2016/07/13 09:53:16 njoly Exp $"); #include #include +#ifdef __FreeBSD__ +void set_vm_max_wired(int); +void restore_vm_max_wired(void); +#endif + static void sighandler(int); static const char path[] = "setrlimit"; @@ -238,10 +243,18 @@ sighandler(int signo) _exit(EXIT_SUCCESS); } +#ifdef __FreeBSD__ +ATF_TC_WITH_CLEANUP(setrlimit_memlock); +#else ATF_TC(setrlimit_memlock); +#endif ATF_TC_HEAD(setrlimit_memlock, tc) { atf_tc_set_md_var(tc, "descr", "Test setrlimit(2), RLIMIT_MEMLOCK"); +#ifdef __FreeBSD__ + atf_tc_set_md_var(tc, "require.config", "allow_sysctl_side_effects"); + atf_tc_set_md_var(tc, "require.user", "root"); +#endif } ATF_TC_BODY(setrlimit_memlock, tc) @@ -252,6 +265,11 @@ ATF_TC_BODY(setrlimit_memlock, tc) pid_t pid; int sta; +#ifdef __FreeBSD__ + /* Set max_wired really really high to avoid EAGAIN */ + set_vm_max_wired(INT_MAX); +#endif + page = sysconf(_SC_PAGESIZE); ATF_REQUIRE(page >= 0); @@ -295,6 +313,14 @@ ATF_TC_BODY(setrlimit_memlock, tc) atf_tc_fail("RLIMIT_MEMLOCK not enforced"); } +#ifdef __FreeBSD__ +ATF_TC_CLEANUP(setrlimit_memlock, tc) +{ + + restore_vm_max_wired(); +} +#endif + ATF_TC(setrlimit_nofile_1); ATF_TC_HEAD(setrlimit_nofile_1, tc) { -- cgit v1.1