xref: /freebsd/tools/test/stress2/misc/unionfs17.sh (revision e1e636193db45630c7881246d25902e57c43d24e)
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# unionfs(8) test
10# Variation of unionfs7.sh, but with tmpfs
11
12# "mkdir: rmdir(d17) Directory not empty" seen.
13
14[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
15. ../default.cfg
16
17mp1=/mnt$mdstart
18mp2=/mnt$((mdstart + 1))
19mkdir -p $mp1 $mp2
20set -e
21for i in $mp1 $mp2; do
22	mount | grep -q "on $i " && umount -f $i
23done
24
25mount -o size=4g -t tmpfs dummy $mp1
26mount -o size=4g -t tmpfs dummy $mp2
27
28mount -t unionfs -o noatime $mp1 $mp2
29set +e
30export 'INODES=100000'
31
32export CTRLDIR=$mp2/stressX.control
33export INCARNATIONS=10
34export LOAD=80
35export RUNDIR=$mp2/stressX
36export runRUNTIME=5m
37export rwLOAD=80
38export symlinkLOAD=80
39
40export TESTPROGS="
41testcases/lockf2/lockf2
42testcases/symlink/symlink
43testcases/openat/openat
44testcases/rw/rw
45testcases/fts/fts
46testcases/link/link
47testcases/lockf/lockf
48testcases/creat/creat
49testcases/mkdir/mkdir
50testcases/rename/rename
51testcases/mkfifo/mkfifo
52testcases/dirnprename/dirnprename
53testcases/dirrename/dirrename
54testcases/swap/swap
55"
56
57cp -r ../../stress2 $mp2
58export TESTPROGS=`echo $TESTPROGS | sed 's/\n/ /g'`
59
60set +e
61chmod 777 $mp2
62su $testuser -c \
63	"(cd $mp2/stress2; ./testcases/run/run $TESTPROGS)"
64
65while mount | grep -Eq "on $mp2 .*unionfs"; do
66	umount $mp2 && break
67	sleep 5
68done
69umount $mp2
70n=`find $mp1/stressX | wc -l`
71[ $n -eq 1 ] && s=0 || { find $mp1/stressX -ls | head -12; s=1; }
72umount $mp1
73exit $s
74