aboutsummaryrefslogtreecommitdiff
path: root/tools/test/stress2/misc/tmpfs27.sh
blob: 5479dcd9188a10058a1b2d783b80c3a25c27b388 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh

#
# Copyright (c) 2024 Peter Holm <pho@FreeBSD.org>
#
# SPDX-License-Identifier: BSD-2-Clause
#

# umount FS with memory mapped file. tmpfs version.

# "panic: object with writable mappings does not have a reference" seen:
# https://people.freebsd.org/~pho/stress/log/log0518.txt

[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1

. ../default.cfg

set -eu
prog=$(basename "$0" .sh)
here=`pwd`
mp1=$mntpoint

mount -t tmpfs dummy $mp1

export RUNDIR=$mp1/stressX
export runRUNTIME=2m
export LOAD=70
export mmapLOAD=100
export TESTPROGS="testcases/mmap/mmap testcases/swap/swap"
set +e

(cd ..; ./testcases/run/run $TESTPROGS > /dev/null 2>&1) & rpid=$!
sleep 5

start=`date +%s`
while [ $((`date +%s` - start)) -lt 120 ]; do
	umount -f $mp1 &&
	    mount -t tmpfs dummy $mp1
	mount | grep -q "on $mp1 " || break
	pgrep -q mmap || break
done
pkill run swap mmap
while pgrep -q swap; do pkill swap; done
wait $rpid

while mount | grep -q "on $mp1 "; do
	umount $mp1
done
exit 0