"Fossies" - the Fresh Open Source Software Archive

Member "btrfs-progs-v5.4/tests/cli-tests/007-check-force/test.sh" (3 Dec 2019, 858 Bytes) of package /linux/misc/btrfs-progs-v5.4.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "test.sh": v5.3_vs_v5.4.

    1 #!/bin/bash
    2 #
    3 # test 'btrfs check --force' on a mounted filesystem
    4 
    5 source "$TEST_TOP/common"
    6 
    7 check_prereq mkfs.btrfs
    8 check_prereq btrfs
    9 
   10 setup_root_helper
   11 
   12 # we need to use a real block device, because the check opens the device in
   13 # exclusive mode, that unfortunately behaves differently for direct file
   14 # access and for the real /dev/loop0 device
   15 setup_loopdevs 1
   16 prepare_loopdevs
   17 TEST_DEV=${loopdevs[1]}
   18 
   19 run_check_mkfs_test_dev
   20 run_check_mount_test_dev
   21 run_mustfail "checking mounted filesystem without --force" \
   22     $SUDO_HELPER "$TOP/btrfs" check "$TEST_DEV"
   23 run_check $SUDO_HELPER "$TOP/btrfs" check --force "$TEST_DEV"
   24 run_check $SUDO_HELPER "$TOP/btrfs" check --force --repair "$TEST_DEV"
   25 run_check_umount_test_dev
   26 run_check $SUDO_HELPER "$TOP/btrfs" check "$TEST_DEV"
   27 run_check $SUDO_HELPER "$TOP/btrfs" check --force "$TEST_DEV"
   28 
   29 cleanup_loopdevs