Home | History | Annotate | Download | only in d_xattr_sorting
      1 if ! test -x $DEBUGFS_EXE; then
      2 	echo "$test_name: $test_description: skipped (no debugfs)"
      3 	return 0
      4 fi
      5 
      6 OUT=$test_name.log
      7 EXP=$test_dir/expect
      8 VERIFY_FSCK_OPT=-yf
      9 
     10 TEST_DATA=$test_name.tmp
     11 VERIFY_DATA=$test_name.ver.tmp
     12 
     13 echo "debugfs sort extended attributes" > $OUT.new
     14 
     15 dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
     16 
     17 echo "mke2fs -Fq -b 1024 test.img 512" >> $OUT.new
     18 
     19 $MKE2FS -Fq -b 1024 $TMPFILE 512 > /dev/null 2>&1
     20 status=$?
     21 echo Exit status is $status >> $OUT.new
     22 
     23 B=$(mktemp ${TMPDIR:-/tmp}/b.XXXXXX)
     24 
     25 perl -e 'print "x" x 256;' > $B
     26 
     27 echo "ea_set -f /tmp/b / security.SMEG64" >> $OUT.new
     28 $DEBUGFS -w -R "ea_set -f $B / security.SMEG64" $TMPFILE >> $OUT.new 2>&1
     29 status=$?
     30 echo Exit status is $status >> $OUT.new
     31 
     32 echo "ea_set -f /tmp/b / security.imb" >> $OUT.new
     33 $DEBUGFS -w -R "ea_set -f $B / security.imb" $TMPFILE >> $OUT.new 2>&1
     34 status=$?
     35 echo Exit status is $status >> $OUT.new
     36 
     37 echo "ea_set / user.moo cow" >> $OUT.new
     38 $DEBUGFS -w -R "ea_set / user.moo cow" $TMPFILE >> $OUT.new 2>&1
     39 status=$?
     40 echo Exit status is $status >> $OUT.new
     41 
     42 rm -f $B
     43 unset B
     44 
     45 echo "ea_list /" >> $OUT.new
     46 $DEBUGFS -w -R "ea_list /" $TMPFILE >> $OUT.new 2>&1
     47 status=$?
     48 echo Exit status is $status >> $OUT.new
     49 
     50 echo "ea_get / security.imb" >> $OUT.new
     51 $DEBUGFS -w -R "ea_get / security.imb" $TMPFILE >> $OUT.new 2>&1
     52 status=$?
     53 echo Exit status is $status >> $OUT.new
     54 
     55 echo "ea_get / security.SMEG64" >> $OUT.new
     56 $DEBUGFS -w -R "ea_get / security.SMEG64" $TMPFILE >> $OUT.new 2>&1
     57 status=$?
     58 echo Exit status is $status >> $OUT.new
     59 
     60 echo "ea_get / nosuchea" >> $OUT.new
     61 $DEBUGFS -w -R "ea_get / nosuchea" $TMPFILE >> $OUT.new 2>&1
     62 status=$?
     63 echo Exit status is $status >> $OUT.new
     64 
     65 echo e2fsck $VERIFY_FSCK_OPT -N test_filesys >> $OUT.new
     66 $FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
     67 status=$?
     68 echo Exit status is $status >> $OUT.new
     69 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
     70 
     71 #
     72 # Do the verification
     73 #
     74 
     75 rm -f $TMPFILE $OUT.new
     76 cmp -s $OUT $EXP
     77 status=$?
     78 
     79 if [ "$status" = 0 ] ; then
     80 	echo "$test_name: $test_description: ok"
     81 	touch $test_name.ok
     82 else
     83 	echo "$test_name: $test_description: failed"
     84 	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
     85 fi
     86 
     87 unset VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA
     88