xref: /freebsd/tools/test/stress2/misc/tmpfs13.sh (revision 177034c44ed18d99e6cc85dfddd2bb04b41d38ac)
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`
43usermem=`sysctl -n hw.usermem`
44[ `swapinfo | wc -l` -eq 1 ] && usermem=$((usermem/100*80))
45size=$((usermem / 1024 / 1024 / 2))
46
47export runRUNTIME=15m
48export RUNDIR=$mp1/stressX
49export CTRLDIR=$mp1/stressX.control
50export LOAD=80
51export symlinkLOAD=80
52export rwLOAD=80
53export TESTPROGS="
54testcases/lockf2/lockf2
55testcases/symlink/symlink
56testcases/openat/openat
57testcases/rw/rw
58testcases/fts/fts
59testcases/link/link
60testcases/lockf/lockf
61testcases/creat/creat
62testcases/mkdir/mkdir
63testcases/rename/rename
64testcases/mkfifo/mkfifo
65"
66
67for i in `jot $N 1`; do
68	eval mp$i=${mntpoint}$i
69done
70
71for i in `jot $N 1`; do
72	eval mp=\$mp$i
73	[ -d $mp ] || mkdir -p $mp
74	mount | grep $mp | grep -q tmpfs && umount -f $mp
75	mount  -o size=${size}m -t tmpfs tmpfs $mp
76	chmod 777 $mp
77	export RUNDIR=$mp/stressX
78	export CTRLDIR=$mp/stressX.control
79	su $testuser -c 'cd ..; ./testcases/run/run $TESTPROGS' > \
80	    /dev/null 2>&1 &
81done
82
83sleep 60
84
85for i in `jot $N 1`; do
86	eval mp=\$mp$i
87	while mount | grep "$mp " | grep -q tmpfs; do
88		umount -f $mp || sleep 1
89	done
90done
91../tools/killall.sh
92while pgrep -q swap; do
93	pkill -9 swap
94done
95wait
96