summaryrefslogtreecommitdiff
path: root/tests/generic/718
blob: f53d1840d0be05488989a210262bd5f6ab7c7540 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2022 Oracle.  All Rights Reserved.
#
# FS QA Test No. 718
#
# Make sure swapext honors RLIMIT_FSIZE.

. ./common/preamble
_begin_fstest auto quick fiexchange swapext

# Override the default cleanup function.
_cleanup()
{
	cd /
	rm -r -f $tmp.* $dir
}

# Import common functions.
. ./common/filter
. ./common/reflink

# real QA test starts here
_require_xfs_io_command swapext '-v exchrange'
_require_test

dir=$TEST_DIR/test-$seq
mkdir -p $dir
blksz=65536
nrblks=64

# Create some 4M files to test swapext
_pwrite_byte 0x58 0 $((blksz * nrblks)) $dir/a >> $seqres.full
_pwrite_byte 0x59 0 $((blksz * nrblks)) $dir/b >> $seqres.full
sync
md5sum $dir/a $dir/b | _filter_test_dir

# Set FSIZE to twice the blocksize (IOWs, 128k)
ulimit -f $(( (blksz * 2) / 512))
ulimit -a >> $seqres.full

# Now try to swapext
$XFS_IO_PROG -c "swapext $dir/b" $dir/a
md5sum $dir/a $dir/b | _filter_test_dir

# success, all done
status=0
exit