#!/bin/sh # # Copyright (c) 2024 Peter Holm # # SPDX-License-Identifier: BSD-2-Clause # # A SEEK_HOLE / SEEK_DATA test scenario, variation of tmpfs24.sh # A regression test for "40c1672e886b - main - swap_pager: fix # seek_data with invalid first page" [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 . ../default.cfg prog=$(basename "$0" .sh) exp=/tmp/$prog.exp here=`pwd` log=/tmp/$prog.log cc -o /tmp/lsholes -Wall -Wextra -O2 $here/../tools/lsholes.c | exit 1 cat > $exp < $log 2>&1 || s1=1 cmp -s $exp $log || { s2=2; sdiff $exp $log; } $here/../testcases/swap/swap -t 2m -i 20 -h > /dev/null & sleep 10 cp $file $copy while pkill swap; do :; done wait cmp $file $copy || { echo "copy error"; s3=4; } umount $mntpoint rm -f /tmp/lsholes $exp $log exit $((s1 + s2 + s3))