Whamcloud - gitweb
tests: clean up $DEBUGFS_EXE usage in scripts
[tools/e2fsprogs.git] / tests / r_inline_xattr / script
1 if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then
2         echo "$test_name: $test_description: skipped (no debugfs/resize2fs)"
3         return 0
4 fi
5
6 IMAGE=$test_dir/image.gz
7 FSCK_OPT=-yf
8 OUT=$test_name.log
9 EXP=$test_dir/expect
10
11 gunzip < $IMAGE > $TMPFILE
12
13 echo "resize2fs test" > $OUT
14
15 # Look at existing inline extended attribute
16 echo "debugfs -R ''stat file'' test.img 2>&1 | grep ''^Inode\|in inode body\|user.name (''" >> $OUT
17 $DEBUGFS -R "stat file" $TMPFILE 2>&1 | grep "^Inode\|in inode body\|user.name (" >> $OUT
18 status=$?
19 echo Exit status is $status >> $OUT
20
21 # resize it
22 echo "resize2fs test.img 5M" >> $OUT
23 $RESIZE2FS $TMPFILE 5M 2>&1 >> $OUT.new 2>&1
24 status=$?
25 echo Exit status is $status >> $OUT.new
26 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
27
28 # Look at inline extended attribute in resized fs
29 echo "debugfs -R ''stat file'' test.img 2>&1 | grep ''^Inode\|in inode body\|user.name (''" >> $OUT
30 $DEBUGFS -R "stat file" $TMPFILE 2>&1 | grep "^Inode\|in inode body\|user.name (" >> $OUT
31 status=$?
32 echo Exit status is $status >> $OUT
33
34 rm $TMPFILE $OUT.new
35
36 #
37 # Do the verification
38 #
39
40 cmp -s $OUT $EXP
41 status=$?
42
43 if [ "$status" = 0 ] ; then
44         echo "$test_name: $test_description: ok"
45         touch $test_name.ok
46 else
47         echo "$test_name: $test_description: failed"
48         diff $DIFF_OPTS $EXP $OUT > $test_name.failed
49 fi
50
51 unset IMAGE FSCK_OPT OUT EXP