tests/avocado: Remove the remainders of the virtiofs_submounts test

The virtiofs_submounts test has been removed in commit 5da7701e2a
("virtiofsd: Remove test"), so we don't need this files anymore.

Message-ID: <20240718173125.489901-1-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Thomas Huth 2024-07-18 19:31:25 +02:00
parent 3b067b701d
commit 322a2e33f4
4 changed files with 0 additions and 341 deletions

View File

@ -1,46 +0,0 @@
#!/bin/bash
function print_usage()
{
if [ -n "$2" ]; then
echo "Error: $2"
echo
fi
echo "Usage: $1 <scratch dir>"
}
scratch_dir=$1
if [ -z "$scratch_dir" ]; then
print_usage "$0" 'Scratch dir not given' >&2
exit 1
fi
cd "$scratch_dir/share" || exit 1
mps=(mnt*)
mp_i=0
for mp in "${mps[@]}"; do
mp_i=$((mp_i + 1))
printf "Unmounting %i/%i...\r" "$mp_i" "${#mps[@]}"
sudo umount -R "$mp"
rm -rf "$mp"
done
echo
rm some-file
cd ..
rmdir share
imgs=(fs*.img)
img_i=0
for img in "${imgs[@]}"; do
img_i=$((img_i + 1))
printf "Detaching and deleting %i/%i...\r" "$img_i" "${#imgs[@]}"
dev=$(losetup -j "$img" | sed -e 's/:.*//')
sudo losetup -d "$dev"
rm -f "$img"
done
echo
echo 'Done.'

View File

@ -1,30 +0,0 @@
#!/bin/bash
function print_usage()
{
if [ -n "$2" ]; then
echo "Error: $2"
echo
fi
echo "Usage: $1 <scratch dir>"
}
scratch_dir=$1
if [ -z "$scratch_dir" ]; then
print_usage "$0" 'Scratch dir not given' >&2
exit 1
fi
cd "$scratch_dir/share" || exit 1
mps=(mnt*)
mp_i=0
for mp in "${mps[@]}"; do
mp_i=$((mp_i + 1))
printf "Unmounting %i/%i...\r" "$mp_i" "${#mps[@]}"
sudo umount -R "$mp"
done
echo
echo 'Done.'

View File

@ -1,138 +0,0 @@
#!/bin/bash
function print_usage()
{
if [ -n "$2" ]; then
echo "Error: $2"
echo
fi
echo "Usage: $1 <shared dir>"
echo '(The shared directory is the "share" directory in the scratch' \
'directory)'
}
shared_dir=$1
if [ -z "$shared_dir" ]; then
print_usage "$0" 'Shared dir not given' >&2
exit 1
fi
cd "$shared_dir"
# FIXME: This should not be necessary, but it is. In order for all
# submounts to be proper mount points, we need to visit them.
# (Before we visit them, they will not be auto-mounted, and so just
# appear as normal directories, with the catch that their st_ino will
# be the st_ino of the filesystem they host, while the st_dev will
# still be the st_dev of the parent.)
# `find` does not work, because it will refuse to touch the mount
# points as long as they are not mounted; their st_dev being shared
# with the parent and st_ino just being the root node's inode ID
# will practically ensure that this node exists elsewhere on the
# filesystem, and `find` is required to recognize loops and not to
# follow them.
# Thus, we have to manually visit all nodes first.
mnt_i=0
function recursively_visit()
{
pushd "$1" >/dev/null
for entry in *; do
if [[ "$entry" == mnt* ]]; then
mnt_i=$((mnt_i + 1))
printf "Triggering auto-mount $mnt_i...\r"
fi
if [ -d "$entry" ]; then
recursively_visit "$entry"
fi
done
popd >/dev/null
}
recursively_visit .
echo
if [ -n "$(find -name not-mounted)" ]; then
echo "Error: not-mounted files visible on mount points:" >&2
find -name not-mounted >&2
exit 1
fi
if [ ! -f some-file -o "$(cat some-file)" != 'root' ]; then
echo "Error: Bad file in the share root" >&2
exit 1
fi
shopt -s nullglob
function check_submounts()
{
local base_path=$1
for mp in mnt*; do
printf "Checking submount %i...\r" "$((${#devs[@]} + 1))"
mp_i=$(echo "$mp" | sed -e 's/mnt//')
dev=$(stat -c '%D' "$mp")
if [ -n "${devs[mp_i]}" ]; then
echo "Error: $mp encountered twice" >&2
exit 1
fi
devs[mp_i]=$dev
pushd "$mp" >/dev/null
path="$base_path$mp"
while true; do
expected_content="$(printf '%s\n%s\n' "$mp_i" "$path")"
if [ ! -f some-file ]; then
echo "Error: $PWD/some-file does not exist" >&2
exit 1
fi
if [ "$(cat some-file)" != "$expected_content" ]; then
echo "Error: Bad content in $PWD/some-file:" >&2
echo '--- found ---'
cat some-file
echo '--- expected ---'
echo "$expected_content"
exit 1
fi
if [ "$(stat -c '%D' some-file)" != "$dev" ]; then
echo "Error: $PWD/some-file has the wrong device ID" >&2
exit 1
fi
if [ -d sub ]; then
if [ "$(stat -c '%D' sub)" != "$dev" ]; then
echo "Error: $PWD/some-file has the wrong device ID" >&2
exit 1
fi
cd sub
path="$path/sub"
else
if [ -n "$(echo mnt*)" ]; then
check_submounts "$path/"
fi
break
fi
done
popd >/dev/null
done
}
root_dev=$(stat -c '%D' some-file)
devs=()
check_submounts ''
echo
reused_devs=$(echo "$root_dev ${devs[@]}" | tr ' ' '\n' | sort | uniq -d)
if [ -n "$reused_devs" ]; then
echo "Error: Reused device IDs: $reused_devs" >&2
exit 1
fi
echo "Test passed for ${#devs[@]} submounts."

View File

@ -1,127 +0,0 @@
#!/bin/bash
mount_count=128
function print_usage()
{
if [ -n "$2" ]; then
echo "Error: $2"
echo
fi
echo "Usage: $1 <scratch dir> [seed]"
echo "(If no seed is given, it will be randomly generated.)"
}
scratch_dir=$1
if [ -z "$scratch_dir" ]; then
print_usage "$0" 'No scratch dir given' >&2
exit 1
fi
if [ ! -d "$scratch_dir" ]; then
print_usage "$0" "$scratch_dir is not a directory" >&2
exit 1
fi
seed=$2
if [ -z "$seed" ]; then
seed=$RANDOM
fi
RANDOM=$seed
echo "Seed: $seed"
set -e
shopt -s nullglob
cd "$scratch_dir"
if [ -d share ]; then
echo 'Error: This directory seems to be in use already' >&2
exit 1
fi
for ((i = 0; i < $mount_count; i++)); do
printf "Setting up fs %i/%i...\r" "$((i + 1))" "$mount_count"
rm -f fs$i.img
truncate -s 512M fs$i.img
mkfs.xfs -q fs$i.img
devs[i]=$(sudo losetup -f --show fs$i.img)
done
echo
top_level_mounts=$((RANDOM % mount_count + 1))
mkdir -p share
echo 'root' > share/some-file
for ((i = 0; i < $top_level_mounts; i++)); do
printf "Mounting fs %i/%i...\r" "$((i + 1))" "$mount_count"
mkdir -p share/mnt$i
touch share/mnt$i/not-mounted
sudo mount "${devs[i]}" share/mnt$i
sudo chown "$(id -u):$(id -g)" share/mnt$i
pushd share/mnt$i >/dev/null
path=mnt$i
nesting=$((RANDOM % 4))
for ((j = 0; j < $nesting; j++)); do
cat > some-file <<EOF
$i
$path
EOF
mkdir sub
cd sub
path="$path/sub"
done
cat > some-file <<EOF
$i
$path
EOF
popd >/dev/null
done
for ((; i < $mount_count; i++)); do
printf "Mounting fs %i/%i...\r" "$((i + 1))" "$mount_count"
mp_i=$((i % top_level_mounts))
pushd share/mnt$mp_i >/dev/null
path=mnt$mp_i
while true; do
sub_mp="$(echo mnt*)"
if cd sub 2>/dev/null; then
path="$path/sub"
elif [ -n "$sub_mp" ] && cd "$sub_mp" 2>/dev/null; then
path="$path/$sub_mp"
else
break
fi
done
mkdir mnt$i
touch mnt$i/not-mounted
sudo mount "${devs[i]}" mnt$i
sudo chown "$(id -u):$(id -g)" mnt$i
cd mnt$i
path="$path/mnt$i"
nesting=$((RANDOM % 4))
for ((j = 0; j < $nesting; j++)); do
cat > some-file <<EOF
$i
$path
EOF
mkdir sub
cd sub
path="$path/sub"
done
cat > some-file <<EOF
$i
$path
EOF
popd >/dev/null
done
echo
echo 'Done.'