xref: /freebsd/tools/test/stress2/misc/tmpfs12.sh (revision dd41de95a84d979615a2ef11df6850622bf6184e)
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# umount -f test scenario
30
31# Problems seen:
32# panic: cache_enter: Doomed vnode used as src
33#     http://people.freebsd.org/~pho/stress/log/kostik676.txt
34# panic: Bad link elm 0xfffff800b384e828 next->prev != elm
35#     http://people.freebsd.org/~pho/stress/log/kostik677.txt
36# panic: unrhdr has 1 allocations
37#     http://people.freebsd.org/~pho/stress/log/kostik678.txt
38# Fixed in r268605 - r268617 and r268766.
39
40[ $((`sysctl -n hw.usermem` / 1024 / 1024 / 1024)) -lt 6 ] && exit 0
41[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
42
43. ../default.cfg
44
45N=3
46
47export runRUNTIME=15m
48export LOAD=80
49export symlinkLOAD=80
50export rwLOAD=80
51export TESTPROGS="
52testcases/lockf2/lockf2
53testcases/symlink/symlink
54testcases/openat/openat
55testcases/rw/rw
56testcases/fts/fts
57testcases/link/link
58testcases/lockf/lockf
59testcases/creat/creat
60testcases/mkdir/mkdir
61testcases/rename/rename
62testcases/mkfifo/mkfifo
63"
64
65for i in `jot $N 1`; do
66	eval mp$i=${mntpoint}$i
67done
68
69for i in `jot $N 1`; do
70	eval mp=\$mp$i
71	[ -d $mp ] || mkdir -p $mp
72	mount | grep $mp | grep -q tmpfs && umount -f $mp
73	mount  -o size=2g -t tmpfs tmpfs $mp
74	chmod 777 $mp
75	export RUNDIR=$mp/stressX
76	export CTRLDIR=$mp/stressX.control
77	su $testuser -c 'cd ..; ./testcases/run/run $TESTPROGS' > \
78	    /dev/null 2>&1 &
79done
80daemon sh -c '(cd ../testcases/swap; ./swap -t 5m -i 20 -h -l 100)' > \
81    /dev/null 2>&1
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