xref: /freebsd/tools/test/stress2/misc/marcus8.sh (revision ee3960cba1068e12fb032a68c46d74841d9edab3)
1#!/bin/sh
2
3#
4# Copyright (c) 2025 Peter Holm <pho@FreeBSD.org>
5#
6# SPDX-License-Identifier: BSD-2-Clause
7#
8
9[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
10
11# Run with marcus.cfg on a 5g swap backed MD with UFS non SU fs.
12# Check for non empty file system after test.
13
14. ../default.cfg
15
16set -u
17mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint
18mdconfig -l | grep -q md$mdstart &&  mdconfig -d -u $mdstart
19mdconfig -a -t swap -s 4g -u $mdstart
20newfs_flags=""	# With SU this test runs out of disk space
21newfs $newfs_flags md$mdstart > /dev/null
22tunefs -n disable md$mdstart	# Remove the default SU flag
23mount /dev/md$mdstart $mntpoint
24chmod 777 $mntpoint
25
26export runRUNTIME=5m
27export CTRLDIR=$mntpoint/stressX.control
28export RUNDIR=$mntpoint/stressX
29
30su $testuser -c 'cd ..; ./run.sh marcus.cfg'
31
32nb=`find $RUNDIR | wc -l`
33[ $nb -gt 1 ] && { find $RUNDIR -ls | head -12; s=1; } || s=0
34n=0
35while mount | grep $mntpoint | grep -q /dev/md; do
36	umount $mntpoint || sleep 1
37	[ $((n += 1)) -gt 300 ] && { echo FAIL; exit 1; }
38done
39checkfs /dev/md$mdstart; s2=$?
40mdconfig -d -u $mdstart
41exit $((s + s2))
42