3 # Common routines for all tests
8 echo "$*" | tee -a $RESULT
14 echo "############### $@" >> $RESULT 2>&1
15 "$@" >> $RESULT 2>&1 || _fail "failed: $@"
20 if ! [ -f $top/$1 ]; then
21 _fail "Failed prerequisities: $1";
28 echo "testing image $(basename $image)" >> $RESULT
29 $top/btrfs check $image >> $RESULT 2>&1
30 [ $? -eq 0 ] && _fail "btrfs check should have detected corruption"
32 run_check $top/btrfs check --repair $image
33 run_check $top/btrfs check $image
39 for i in $(find $dir -iname '*.img')
41 echo "extracting image $(basename $i)" >> $RESULT
42 $top/btrfs-image -r $i $i.restored || \
43 _fail "failed to extract image $i"
45 check_image $i.restored
51 # some tests need to mount the recovered image and do verifications call
52 # 'setup_root_helper' and then check for have_root_helper == 1 if the test
53 # needs to fail otherwise; using sudo by default for now
57 export have_root_helper
60 if [ $UID != 0 ]; then
61 sudo="sudo --non-interactive"