btrfs: test incremental send after removing a directory and all its files
[xfstests-dev.git] / tests / btrfs / 051
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2014 Filipe Manana.  All Rights Reserved.
4 #
5 # FS QA Test No. btrfs/051
6 #
7 # Regression test for btrfs send where long paths (exceeding 230 characters)
8 # made send produce paths with random characters from a memory buffer returned
9 # by kmalloc, as send forgot to populate the new buffer with the path string.
10 #
11 # This issue is fixed by the following linux kernel btrfs patch:
12 #
13 #   Btrfs: send, fix corrupted path strings for long paths
14 #
15 seq=`basename $0`
16 seqres=$RESULT_DIR/$seq
17 echo "QA output created by $seq"
18
19 tmp=/tmp/$$
20 status=1        # failure is the default!
21 trap "_cleanup; exit \$status" 0 1 2 3 15
22
23 _cleanup()
24 {
25     rm -fr $send_files_dir
26     rm -fr $tmp
27 }
28
29 # get standard environment, filters and checks
30 . ./common/rc
31 . ./common/filter
32
33 # real QA test starts here
34 _supported_fs btrfs
35 _require_test
36 _require_scratch
37 _require_fssum
38
39 send_files_dir=$TEST_DIR/btrfs-test-$seq
40
41 rm -f $seqres.full
42 rm -fr $send_files_dir
43 mkdir $send_files_dir
44
45 _scratch_mkfs >/dev/null 2>&1
46 _scratch_mount
47
48 TEST_PATH="$SCRATCH_MNT/fdmanana/.config/google-chrome-mysetup/Default/Pepper_Data/Shockwave_Flash/WritableRoot/#SharedObjects/JSHJ4ZKN/s.wsj.net/[[IMPORT]]/players.edgesuite.net/flash/plugins/osmf/advanced-streaming-plugin/v2.7/osmf1.6/Ak#"
49
50 mkdir -p $TEST_PATH
51 echo "hello world" > $TEST_PATH/amaiAdvancedStreamingPlugin.txt
52
53 _run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap1
54 run_check $FSSUM_PROG -A -f -w $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
55 _run_btrfs_util_prog send -f $send_files_dir/1.snap $SCRATCH_MNT/mysnap1
56
57 _scratch_unmount
58 _check_scratch_fs
59
60 _scratch_mkfs >/dev/null 2>&1
61 _scratch_mount
62
63 _run_btrfs_util_prog receive -f $send_files_dir/1.snap $SCRATCH_MNT
64 run_check $FSSUM_PROG -r $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
65
66 status=0
67 exit