xref: /freebsd/tools/test/stress2/misc/nullfs27.sh (revision 5956d97f4b3204318ceb6aa9c77bd0bc6ea87a41)
1#!/bin/sh
2
3#
4# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
5#
6# Copyright (c) 2019 Dell EMC Isilon
7#
8# Redistribution and use in source and binary forms, with or without
9# modification, are permitted provided that the following conditions
10# are met:
11# 1. Redistributions of source code must retain the above copyright
12#    notice, this list of conditions and the following disclaimer.
13# 2. Redistributions in binary form must reproduce the above copyright
14#    notice, this list of conditions and the following disclaimer in the
15#    documentation and/or other materials provided with the distribution.
16#
17# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27# SUCH DAMAGE.
28#
29
30[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
31
32# Run all the rename(2) test scenarios with nullfs.
33# Used in connection with WiP work on nullfs.
34
35. ../default.cfg
36
37set -e
38mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint
39mdconfig -l | grep -q md$mdstart &&  mdconfig -d -u $mdstart
40
41mdconfig -a -t swap -s 2g -u $mdstart || exit 1
42
43newfs $newfs_flags md$mdstart > /dev/null
44mount /dev/md$mdstart $mntpoint
45chmod 777 $mntpoint
46
47mp2=${mntpoint}2
48[ -d $mp2 ] || mkdir -p $mp2
49mount | grep -wq $mp2 && umount $mp2
50mount -t nullfs $mntpoint $mp2
51chmod 777 $mp2
52set +e
53
54export LOAD=80
55export MAXSWAPPCT=80
56export RUNDIR=$mp2/stressX
57export runRUNTIME=10m
58export rwLOAD=80
59export TESTPROGS='
60testcases/lockf2/lockf2
61testcases/symlink/symlink
62testcases/openat/openat
63testcases/socket/socket
64testcases/rw/rw
65testcases/mmap/mmap
66testcases/fts/fts
67testcases/link/link
68testcases/lockf/lockf
69testcases/creat/creat
70testcases/mkdir/mkdir
71testcases/rename/rename
72testcases/swap/swap
73testcases/mkfifo/mkfifo
74testcases/dirnprename/dirnprename
75testcases/dirrename/dirrename
76'
77
78su $testuser -c 'cd ..; ./testcases/run/run $TESTPROGS'
79
80while mount | grep $mp2 | grep -q nullfs; do
81	umount $mp2 || sleep 1
82done
83n=0
84while mount | grep $mntpoint | grep -q /dev/md; do
85	umount $mntpoint || sleep 1
86	n=$((n + 1))
87	[ $n -gt 30 ] && { echo FAIL; status=2; }
88done
89mdconfig -d -u $mdstart
90exit $status
91