From owner-svn-src-user@freebsd.org Mon Jan 16 11:00:15 2017 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A299CB0780 for ; Mon, 16 Jan 2017 11:00:15 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 543941A34; Mon, 16 Jan 2017 11:00:15 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0GB0EiD097867; Mon, 16 Jan 2017 11:00:14 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0GB0EN5097866; Mon, 16 Jan 2017 11:00:14 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201701161100.v0GB0EN5097866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Mon, 16 Jan 2017 11:00:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r312280 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jan 2017 11:00:15 -0000 Author: pho Date: Mon Jan 16 11:00:14 2017 New Revision: 312280 URL: https://svnweb.freebsd.org/changeset/base/312280 Log: Added timeout for NFS problems seen (not on FreeBSD HEAD). Cleanup script and code while here Sponsored by: Dell EMC Isilon Modified: user/pho/stress2/misc/readdir.sh Modified: user/pho/stress2/misc/readdir.sh ============================================================================== --- user/pho/stress2/misc/readdir.sh Mon Jan 16 09:16:11 2017 (r312279) +++ user/pho/stress2/misc/readdir.sh Mon Jan 16 11:00:14 2017 (r312280) @@ -41,7 +41,7 @@ here=`pwd` cd /tmp sed '1,/^EOF/d' < $here/$0 > readdir.c -mycc -o readdir -Wall -Wextra readdir.c +mycc -o readdir -Wall -Wextra readdir.c || exit 1 rm -f readdir.c mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint @@ -65,7 +65,8 @@ umount $mntpoint if ping -c 2 `echo $nfs_export | sed 's/:.*//'` > /dev/null 2>&1; then echo "Testing nfs" - mount -t nfs -o nfsv3,tcp,nolockd $nfs_export $mntpoint + mount -t nfs -o nfsv3,tcp,nolockd,retrycnt=3,soft,timeout=1 \ + $nfs_export $mntpoint /tmp/readdir $mntpoint umount $mntpoint fi @@ -99,6 +100,9 @@ rm -f /tmp/readdir exit 0 EOF #include +#include +#include + #include #include #include @@ -106,9 +110,10 @@ EOF #include #include #include -#include +#include #include -#include + +#define RUNTIME 120 /* copy from /usr/src/lib/libc/gen/gen-private.h */ struct _telldir; /* see telldir.h */ @@ -139,7 +144,7 @@ hand(int i __unused) { /* handler */ _exit(1); } -int +static void test(char *path) { @@ -147,7 +152,7 @@ test(char *path) int i; signal(SIGSEGV, hand); - + alarm(300); for (i = 0; i < 2000; i++) { if ((dirp = opendir(path)) == NULL) break; @@ -157,15 +162,16 @@ test(char *path) closedir(dirp); } - exit(0); + _exit(0); } int main(int argc __unused, char **argv) { - int i; + time_t start; - for (i = 0; i < 1000; i++) { + start = time(NULL); + while (time(NULL) - start < RUNTIME) { if (fork() == 0) test(argv[1]); wait(NULL); From owner-svn-src-user@freebsd.org Mon Jan 16 11:03:23 2017 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68CFCCB0A43 for ; Mon, 16 Jan 2017 11:03:23 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 402E81F9F; Mon, 16 Jan 2017 11:03:23 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0GB3MSf001618; Mon, 16 Jan 2017 11:03:22 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0GB3M3F001616; Mon, 16 Jan 2017 11:03:22 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201701161103.v0GB3M3F001616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Mon, 16 Jan 2017 11:03:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r312281 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jan 2017 11:03:23 -0000 Author: pho Date: Mon Jan 16 11:03:22 2017 New Revision: 312281 URL: https://svnweb.freebsd.org/changeset/base/312281 Log: Added some new tests. Sponsored by: Dell EMC Isilon Added: user/pho/stress2/misc/posix_openpt.sh (contents, props changed) user/pho/stress2/misc/pty.sh (contents, props changed) Added: user/pho/stress2/misc/posix_openpt.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/posix_openpt.sh Mon Jan 16 11:03:22 2017 (r312281) @@ -0,0 +1,81 @@ +#!/bin/sh + +# +# Copyright (c) 2016 EMC Corp. +# 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$ +# + +# "panic: Assertion ttyinq_getsize(&tp->t_inq) == 0 failed" seen. +# https://people.freebsd.org/~pho/stress/log/posix_openpt.txt +# Test scenario by brde@ + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg + +here=`pwd` +cd /tmp +sed '1,/^EOF/d' < $here/$0 > posix_openpt.c +mycc -o posix_openpt -Wall -Wextra -O2 posix_openpt.c || exit 1 +rm -f posix_openpt.c + +kldstat -v | grep -q pty || { kldload pty || exit 1; } + +for i in `jot 10`; do + /tmp/posix_openpt & +done + +stty -f /dev/ptmx 300 2>/dev/null +for i in /dev/pts/*; do + stty -f $i 300 2>/dev/null +done +wait +rm -f /tmp/posix_openpt + +exit +EOF +#include +#include +#include +#include + +int +main(void) +{ + int masterfd, slavefd; + char *slave; + + if ((masterfd = posix_openpt(O_RDWR | O_NOCTTY)) == -1) + err(1, "posix_openpt"); + if ((slave = ptsname (masterfd)) == NULL) + err(1, "ptsname"); + if ((slavefd = open(slave, O_RDWR|O_NOCTTY)) == -1) + err(1, "open(%s)", slave); + + sleep(arc4random() % 60 + 1); + + return (0); +} Added: user/pho/stress2/misc/pty.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/pty.sh Mon Jan 16 11:03:22 2017 (r312281) @@ -0,0 +1,164 @@ +#!/bin/sh + +# +# Copyright (c) 2016 EMC Corp. +# 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$ +# + +# pty(4) test scenario. + +# "panic: make_dev_credv: bad si_name (error=17, si_name=ptysn)" seen. +# https://people.freebsd.org/~pho/stress/log/pty.txt + +# /dev/pty[l-sL-S][0-9a-v] Pseudo-terminal master devices. +# /dev/tty[l-sL-S][0-9a-v] Pseudo-terminal slave devices. + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg + +kldstat -v | grep -q pty || { kldload pty || exit 1; } + +here=`pwd` +cd /tmp +sed '1,/^EOF/d' < $here/$0 > pty.c +mycc -o pty -Wall -Wextra -O2 pty.c || exit 1 +rm -f pty.c + +su $testuser -c /tmp/pty + +rm -f /tmp/pty +exit +EOF +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#define PARALLEL 4 +#define RUNTIME 300 + +char path[80]; + +void +churn(char *path) +{ + + FTS *fts; + FTSENT *p; + time_t start; + int fd, ftsoptions; + char *args[2]; + + ftsoptions = FTS_PHYSICAL; + args[0] = path; + args[1] = 0; + + setproctitle("churn"); + start = time(NULL); + while (time(NULL) - start < RUNTIME) { + if ((fts = fts_open(args, ftsoptions, NULL)) == NULL) + err(1, "fts_open"); + + while ((p = fts_read(fts)) != NULL) { + if (p->fts_info == FTS_D || + p->fts_info == FTS_DP) + continue; + if ((fd = open(p->fts_path, O_RDWR)) == -1) + if ((fd = open(p->fts_path, O_WRONLY)) == -1) + if ((fd = open(p->fts_path, O_RDONLY)) == -1) + continue; + usleep(arc4random() % 1000); + close(fd); + + } + + if (errno != 0 && errno != ENOENT) + err(1, "fts_read"); + if (fts_close(fts) == -1) + err(1, "fts_close()"); + } + + _exit(0); +} + +void +pty(void) +{ + int fd[512], i, j, n; + char c1, c2; + + + n = 0; + c1 = 'l'; + for (i = 0; i < 16; i++) { + c2 = '0'; + for (j = 0; j < 32; j++) { + snprintf(path, sizeof(path), "/dev/pty%c%c", c1, c2); + fd[n++] = open(path, O_RDWR); + if (c2 == '9') + c2 = 'a'; + else + c2++; + } + if (c1 == 's') + c1 = 'L'; + else + c1++; + } + + for (i = 0; i < n; i++) + if (fd[i] != -1) + close(fd[i]); +} + +int +main(void) +{ + int i; + + time_t start; + + for (i = 0; i < PARALLEL; i++) + if (fork() == 0) + churn("/dev"); + + start = time(NULL); + while (time(NULL) - start < RUNTIME) + pty(); + + for (i = 0; i < PARALLEL; i++) + wait(NULL); + + return (0); +} From owner-svn-src-user@freebsd.org Mon Jan 16 11:04:37 2017 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94AA0CB0A6D for ; Mon, 16 Jan 2017 11:04:37 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 6EB0610B0; Mon, 16 Jan 2017 11:04:37 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0GB4a4c001699; Mon, 16 Jan 2017 11:04:36 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0GB4a8e001698; Mon, 16 Jan 2017 11:04:36 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201701161104.v0GB4a8e001698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Mon, 16 Jan 2017 11:04:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r312282 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jan 2017 11:04:37 -0000 Author: pho Date: Mon Jan 16 11:04:36 2017 New Revision: 312282 URL: https://svnweb.freebsd.org/changeset/base/312282 Log: Added a new test. Sponsored by: Dell EMC Isilon Added: user/pho/stress2/misc/posix_openpt2.sh (contents, props changed) Added: user/pho/stress2/misc/posix_openpt2.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/posix_openpt2.sh Mon Jan 16 11:04:36 2017 (r312282) @@ -0,0 +1,154 @@ +#!/bin/sh + +# +# Copyright (c) 2016 EMC Corp. +# 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$ +# + +# "panic: Assertion !tty_gone(tp) failed at ttydevsw.h:153" seen. +# https://people.freebsd.org/~pho/stress/log/posix_openpt2.txt +# Fixed by r312077 + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg + +here=`pwd` +cd /tmp +sed '1,/^EOF/d' < $here/$0 > posix_openpt2.c +mycc -o posix_openpt2 -Wall -Wextra -O2 posix_openpt2.c -lutil || exit 1 +rm -f posix_openpt2.c + +/tmp/posix_openpt2 & + +while kill -0 $! 2>/dev/null; do + $here/../testcases/swap/swap -t 2m -i 20 +done +wait + +rm -f /tmp/posix_openpt2 +exit 0 +EOF +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define LOOPS 10 +#define PARALLEL 2 +#define RUNTIME 300 + +void +churn(char *path) +{ + FTS *fts; + FTSENT *p; + time_t start; + int fd, ftsoptions; + char *args[2]; + + ftsoptions = FTS_PHYSICAL; + args[0] = path; + args[1] = 0; + + setproctitle("churn"); + start = time(NULL); + while (time(NULL) - start < RUNTIME / LOOPS) { + if ((fts = fts_open(args, ftsoptions, NULL)) == NULL) + err(1, "fts_open"); + + while ((p = fts_read(fts)) != NULL) { + if (p->fts_info == FTS_D || + p->fts_info == FTS_DP) + continue; + if ((fd = open(p->fts_path, O_RDONLY)) > 0) + close(fd); + + } + + if (errno != 0 && errno != ENOENT) + err(1, "fts_read"); + if (fts_close(fts) == -1) + err(1, "fts_close()"); + } + + _exit(0); +} + +void +pty(void) +{ + time_t start; + int masterfd, slavefd; + char *slave; + + start = time(NULL); + while (time(NULL) - start < RUNTIME / LOOPS) { + if ((masterfd = posix_openpt(O_RDWR | O_NOCTTY)) == -1) + err(1, "posix_openpt"); + if ((slave = ptsname (masterfd)) == NULL) + err(1, "ptsname"); + if ((slavefd = open(slave, O_RDWR|O_NOCTTY)) == -1) + err(1, "open(%s)", slave); + usleep(arc4random() % 10000); + close(slavefd); + close(masterfd); + } + _exit(0); +} + +int +main(void) +{ + int i, j; + + for (j = 0; j < LOOPS; j++) { + for (i = 0; i < PARALLEL; i++) { + if (fork() == 0) + pty(); + } + for (i = 0; i < PARALLEL; i++) { + if (fork() == 0) + churn("/dev/pts"); + } + for (i = 0; i < 2 * PARALLEL; i++) + wait(NULL); + } + + return (0); +} From owner-svn-src-user@freebsd.org Mon Jan 16 11:40:55 2017 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C791CB24FD for ; Mon, 16 Jan 2017 11:40:55 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 171661367; Mon, 16 Jan 2017 11:40:55 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0GBesJj016008; Mon, 16 Jan 2017 11:40:54 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0GBescW016005; Mon, 16 Jan 2017 11:40:54 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201701161140.v0GBescW016005@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Mon, 16 Jan 2017 11:40:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r312283 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jan 2017 11:40:55 -0000 Author: pho Date: Mon Jan 16 11:40:53 2017 New Revision: 312283 URL: https://svnweb.freebsd.org/changeset/base/312283 Log: Trim runtime. Cleanup script and code while here. Sponsored by: Dell EMC Isilon Modified: user/pho/stress2/misc/kinfo.sh user/pho/stress2/misc/kinfo2.sh user/pho/stress2/misc/kinfo3.sh Modified: user/pho/stress2/misc/kinfo.sh ============================================================================== --- user/pho/stress2/misc/kinfo.sh Mon Jan 16 11:04:36 2017 (r312282) +++ user/pho/stress2/misc/kinfo.sh Mon Jan 16 11:40:53 2017 (r312283) @@ -41,7 +41,7 @@ mycc -o kinfo -Wall kinfo.c -lutil || ex rm -f kinfo.c mount | grep -q procfs || mount -t procfs procfs /proc -for i in `jot 30`; do +for i in `jot 20`; do for j in `jot 5`; do /tmp/kinfo & done Modified: user/pho/stress2/misc/kinfo2.sh ============================================================================== --- user/pho/stress2/misc/kinfo2.sh Mon Jan 16 11:04:36 2017 (r312282) +++ user/pho/stress2/misc/kinfo2.sh Mon Jan 16 11:40:53 2017 (r312283) @@ -41,7 +41,7 @@ mycc -o kinfo2 -Wall -Wextra kinfo2.c -l rm -f kinfo2.c mount | grep -q procfs || mount -t procfs procfs /proc -for i in `jot 30`; do +for i in `jot 20`; do for j in `jot 5`; do /tmp/kinfo2 & done Modified: user/pho/stress2/misc/kinfo3.sh ============================================================================== --- user/pho/stress2/misc/kinfo3.sh Mon Jan 16 11:04:36 2017 (r312282) +++ user/pho/stress2/misc/kinfo3.sh Mon Jan 16 11:40:53 2017 (r312283) @@ -37,52 +37,58 @@ odir=`pwd` cd /tmp sed '1,/^EOF/d' < $odir/$0 > kinfo3.c -mycc -o kinfo3 -Wall kinfo3.c -lutil -pthread +mycc -o kinfo3 -Wall -Wextra kinfo3.c -lutil -pthread || exit 1 rm -f kinfo3.c +s=0 mount | grep -q procfs || mount -t procfs procfs /proc -for i in `jot 30`; do - for j in `jot 5`; do +start=`date '+%s'` +while [ $((`date '+%s'` - start)) -lt 1200 ]; do + pids="" + for i in `jot 5`; do /tmp/kinfo3 & + pids="$pids $!" done - - for j in `jot 5`; do - wait + for pid in $pids; do + wait $pid + [ $? -ne 0 ] && s=1 done done rm -f /tmp/kinfo3 -exit +exit $s EOF #include -#include -#include -#include +#include #include -#include #include -#include -#include -#include -#include -#include #include + +#include +#include #include #include +#include +#include +#include +#include +#include -char buf[8096]; +static char buf[8096]; static volatile sig_atomic_t more; -void -handler(int i) { +static void +handler(int i __unused) { + more = 0; } -void * -thr(void *arg) +static void * +thr(void *arg __unused) { int fd; + if ((fd = open("/proc/curproc/mem", O_RDONLY)) == -1) err(1, "open(/proc/curproc/mem)"); close(fd); @@ -91,13 +97,11 @@ thr(void *arg) /* Stir /dev/proc */ -int +static int churning(void) { - int i; pid_t r; - int status; pthread_t threads[5]; - + int i, status;; while(more) { r = fork(); @@ -112,7 +116,7 @@ churning(void) { } bzero(buf, sizeof(buf)); - exit(0); + _exit(0); } if (r < 0) { perror("fork"); @@ -120,19 +124,19 @@ churning(void) { } wait(&status); } - exit(0); + _exit(0); } /* Get files for each proc */ -void +static void list(void) { - struct kinfo_file *freep, *kif; + struct kinfo_proc *kipp; struct kinfo_vmentry *freep_vm; + struct kinfo_file *freep, *kif; + size_t len; long i, j; int cnt, name[4]; - struct kinfo_proc *kipp; - size_t len; name[0] = CTL_KERN; name[1] = KERN_PROC; @@ -152,7 +156,7 @@ list(void) return; } - for (i = 0; i < len / sizeof(*kipp); i++) { + for (i = 0; i < (long)(len / sizeof(*kipp)); i++) { /* The test starts here */ freep = kinfo_getfile(kipp[i].ki_pid, &cnt); @@ -170,9 +174,10 @@ list(void) } int -main(int argc, char **argv) +main(void) { pid_t r; + signal(SIGALRM, handler); alarm(30); From owner-svn-src-user@freebsd.org Mon Jan 16 14:31:18 2017 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A37E6CB1932 for ; Mon, 16 Jan 2017 14:31:18 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 7627C197E; Mon, 16 Jan 2017 14:31:18 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0GEVHHD087008; Mon, 16 Jan 2017 14:31:17 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0GEVHje087007; Mon, 16 Jan 2017 14:31:17 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201701161431.v0GEVHje087007@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Mon, 16 Jan 2017 14:31:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r312287 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jan 2017 14:31:18 -0000 Author: pho Date: Mon Jan 16 14:31:17 2017 New Revision: 312287 URL: https://svnweb.freebsd.org/changeset/base/312287 Log: Trim runtime and fix typo in comment. Sponsored by: Dell EMC Isilon Modified: user/pho/stress2/misc/procfs4.sh Modified: user/pho/stress2/misc/procfs4.sh ============================================================================== --- user/pho/stress2/misc/procfs4.sh Mon Jan 16 12:17:35 2017 (r312286) +++ user/pho/stress2/misc/procfs4.sh Mon Jan 16 14:31:17 2017 (r312287) @@ -30,7 +30,7 @@ # Test scenario idea by kib@ -# "panic: double fault" seen due to recurtion +# "panic: double fault" seen due to recursion [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 @@ -67,7 +67,7 @@ EOF #include #define LOOPS 1000 -#define MAXRUN 600 +#define MAXRUN 1200 #define PARALLEL 10 char *files[] = {