On 23.01.2018 17:07, David Sterba wrote: > On Tue, Dec 05, 2017 at 12:04:49PM +0200, Nikolay Borisov wrote: >>>> --- /dev/null >>>> +++ b/tests/fsck-tests/029-superblock-recovery/test.sh >>>> @@ -0,0 +1,64 @@ >>>> +#!/bin/bash >>>> +# Test that any superblock is correctly detected >>>> +# and fixed by btrfs rescue >>>> + >>>> +source "$TOP/tests/common" >>>> + >>>> +check_prereq btrfs >>>> +check_prereq mkfs.btrfs >>>> +check_prereq btrfs-select-super >>>> + >>>> +setup_root_helper >>>> + >>>> +rm -f dev1 >>>> +run_check truncate -s 260G dev1 >>>> +loop=$(run_check_stdout $SUDO_HELPER losetup --find --show dev1) >>> >>> We have function to do it already. >>> prepare_test_dev will use loopback device as fallback if $TEST_DEV is >>> not specified. >>> Tt can handle size well, and it also uses sparse file so no need to >>> worry about disk usage. >> >> Then the test suite is not very consistent, since I copied this loopback >> handling from some other test. > > From which one? Some tests have special needs and may set up the loop > device on their own. The rest should use the helpers in tests/common and > I don't see anything that would not be provided by them.
Looking back at the code it seems it could have been from 021-image-multi-devices. Anyway, I haven't resubmitted the sequence since I was waiting for feedback. Qu already mentioned this could be refactored. > > The consistency in the testsuite is being improved as we find and > identify the patterns worth wrapping into helpers so you may see some > code duplication. > -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html