xref: /freebsd/tools/test/stress2/misc/tmpfs27.sh (revision 2e2699c48a7e6b7cbf13611a601a6cd264a80ec5)
1#!/bin/sh
2
3#
4# Copyright (c) 2024 Peter Holm <pho@FreeBSD.org>
5#
6# SPDX-License-Identifier: BSD-2-Clause
7#
8
9# umount FS with memory mapped file. tmpfs version.
10
11# "panic: object with writable mappings does not have a reference" seen:
12# https://people.freebsd.org/~pho/stress/log/log0518.txt
13
14[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
15
16. ../default.cfg
17
18set -eu
19prog=$(basename "$0" .sh)
20here=`pwd`
21mp1=$mntpoint
22
23mount -t tmpfs dummy $mp1
24
25export RUNDIR=$mp1/stressX
26export runRUNTIME=2m
27export LOAD=70
28export mmapLOAD=100
29export TESTPROGS="testcases/mmap/mmap testcases/swap/swap"
30set +e
31
32(cd ..; ./testcases/run/run $TESTPROGS > /dev/null 2>&1) & rpid=$!
33sleep 5
34
35start=`date +%s`
36while [ $((`date +%s` - start)) -lt 120 ]; do
37	umount -f $mp1 &&
38	    mount -t tmpfs dummy $mp1
39	mount | grep -q "on $mp1 " || break
40	pgrep -q mmap || break
41done
42pkill run swap mmap
43while pgrep -q swap; do pkill swap; done
44wait $rpid
45
46while mount | grep -q "on $mp1 "; do
47	umount $mp1
48done
49exit 0
50