xref: /freebsd/tools/test/stress2/misc/tmpfs13.sh (revision 53bb5613a8a15363718b6e6de8d965bf9a2c5469)
1#!/bin/sh
2
3#
4# Copyright (c) 2014 EMC Corp.
5# All rights reserved.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions
9# are met:
10# 1. Redistributions of source code must retain the above copyright
11#    notice, this list of conditions and the following disclaimer.
12# 2. Redistributions in binary form must reproduce the above copyright
13#    notice, this list of conditions and the following disclaimer in the
14#    documentation and/or other materials provided with the distribution.
15#
16# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26# SUCH DAMAGE.
27#
28
29[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
30
31# umount -f test scenario
32
33# "panic: deadlkres: possible deadlock detected..." seen.
34# http://people.freebsd.org/~pho/stress/log/tmpfs13.txt
35# Fixed by r269457.
36
37# "panic: vm_domainset_iter_first: Invalid domain 2" seen.
38# Fixed by r339075
39
40. ../default.cfg
41
42N=`sysctl -n hw.ncpu`
43[ $N -gt 32 ] && N=32  # Arbitrary cap
44usermem=`sysctl -n hw.usermem`
45[ `swapinfo | wc -l` -eq 1 ] && usermem=$((usermem/100*80))
46size=$((usermem / 1024 / 1024 / 2))
47
48export runRUNTIME=15m
49export RUNDIR=$mp1/stressX
50export CTRLDIR=$mp1/stressX.control
51export LOAD=80
52export symlinkLOAD=80
53export rwLOAD=80
54export TESTPROGS="
55testcases/lockf2/lockf2
56testcases/symlink/symlink
57testcases/openat/openat
58testcases/rw/rw
59testcases/fts/fts
60testcases/link/link
61testcases/lockf/lockf
62testcases/creat/creat
63testcases/mkdir/mkdir
64testcases/rename/rename
65testcases/mkfifo/mkfifo
66"
67
68for i in `jot $N 1`; do
69	eval mp$i=${mntpoint}$i
70done
71
72for i in `jot $N 1`; do
73	eval mp=\$mp$i
74	[ -d $mp ] || mkdir -p $mp
75	mount | grep $mp | grep -q tmpfs && umount -f $mp
76	mount  -o size=${size}m -t tmpfs tmpfs $mp
77	chmod 777 $mp
78	export RUNDIR=$mp/stressX
79	export CTRLDIR=$mp/stressX.control
80	su $testuser -c 'cd ..; ./testcases/run/run $TESTPROGS' > \
81	    /dev/null 2>&1 &
82done
83
84sleep 60
85
86for i in `jot $N 1`; do
87	eval mp=\$mp$i
88	while mount | grep "$mp " | grep -q tmpfs; do
89		umount -f $mp || sleep 1
90	done
91done
92../tools/killall.sh
93while pgrep -q swap; do
94	pkill -9 swap
95done
96wait
97