2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2021 SUSE Linux Products GmbH. All Rights Reserved.
7 # Test if btrfs will crash when using compress-force mount option against
11 _begin_fstest auto quick compress dangerous
13 # Import common functions.
16 # real QA test starts here
18 # Modify as appropriate.
22 pagesize=$(get_page_size)
24 # Read the content from urandom to a known safe location
25 $XFS_IO_PROG -f -c "pwrite -i /dev/urandom 0 $pagesize" "$tmp.good" > /dev/null
27 # Make sure we didn't get short write
28 if [ $(_get_filesize "$tmp.good") != "$pagesize" ]; then
29 _fail "Got a short read from /dev/urandom"
36 echo "=== Testing compress-force=$compression ==="
37 _scratch_mkfs -s "$pagesize">> $seqres.full
38 _scratch_mount -o compress-force="$compression"
39 cp "$tmp.good" "$SCRATCH_MNT/$compression"
41 # When unpatched, compress-force=lzo would crash at data writeback
44 # Make sure the content matches
45 if [ "$(_md5_checksum $tmp.good)" != \
46 "$(_md5_checksum $SCRATCH_MNT/$compression)" ]; then
47 echo "Content of '$SCRATCH_MNT/file' mismatch with known good copy"