mirror of
https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
synced 2024-12-12 03:13:52 +08:00
c5d9d3ce5f
Don't call sed multiple times on the output, and avoid the use of temporary files, or if possible. It would be convenient to use "sed -i" to only update the output file once, but this is not portable to all platforms. [ Fixed a few test regression failures --tytso ] Signed-off-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
88 lines
2.2 KiB
Plaintext
88 lines
2.2 KiB
Plaintext
if ! test -x $DEBUGFS_EXE; then
|
|
echo "$test_name: $test_description: skipped (no debugfs)"
|
|
return 0
|
|
fi
|
|
|
|
OUT=$test_name.log
|
|
EXP=$test_dir/expect
|
|
VERIFY_FSCK_OPT=-yf
|
|
|
|
TEST_DATA=$test_name.tmp
|
|
VERIFY_DATA=$test_name.ver.tmp
|
|
|
|
echo "debugfs sort extended attributes" > $OUT.new
|
|
|
|
dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
|
|
|
|
echo "mke2fs -Fq -b 1024 test.img 512" >> $OUT.new
|
|
|
|
$MKE2FS -Fq -b 1024 $TMPFILE 512 > /dev/null 2>&1
|
|
status=$?
|
|
echo Exit status is $status >> $OUT.new
|
|
|
|
B=$(mktemp ${TMPDIR:-/tmp}/b.XXXXXX)
|
|
|
|
perl -e 'print "x" x 256;' > $B
|
|
|
|
echo "ea_set -f /tmp/b / security.SMEG64" >> $OUT.new
|
|
$DEBUGFS -w -R "ea_set -f $B / security.SMEG64" $TMPFILE >> $OUT.new 2>&1
|
|
status=$?
|
|
echo Exit status is $status >> $OUT.new
|
|
|
|
echo "ea_set -f /tmp/b / security.imb" >> $OUT.new
|
|
$DEBUGFS -w -R "ea_set -f $B / security.imb" $TMPFILE >> $OUT.new 2>&1
|
|
status=$?
|
|
echo Exit status is $status >> $OUT.new
|
|
|
|
echo "ea_set / user.moo cow" >> $OUT.new
|
|
$DEBUGFS -w -R "ea_set / user.moo cow" $TMPFILE >> $OUT.new 2>&1
|
|
status=$?
|
|
echo Exit status is $status >> $OUT.new
|
|
|
|
rm -f $B
|
|
unset B
|
|
|
|
echo "ea_list /" >> $OUT.new
|
|
$DEBUGFS -w -R "ea_list /" $TMPFILE >> $OUT.new 2>&1
|
|
status=$?
|
|
echo Exit status is $status >> $OUT.new
|
|
|
|
echo "ea_get / security.imb" >> $OUT.new
|
|
$DEBUGFS -w -R "ea_get / security.imb" $TMPFILE >> $OUT.new 2>&1
|
|
status=$?
|
|
echo Exit status is $status >> $OUT.new
|
|
|
|
echo "ea_get / security.SMEG64" >> $OUT.new
|
|
$DEBUGFS -w -R "ea_get / security.SMEG64" $TMPFILE >> $OUT.new 2>&1
|
|
status=$?
|
|
echo Exit status is $status >> $OUT.new
|
|
|
|
echo "ea_get / nosuchea" >> $OUT.new
|
|
$DEBUGFS -w -R "ea_get / nosuchea" $TMPFILE >> $OUT.new 2>&1
|
|
status=$?
|
|
echo Exit status is $status >> $OUT.new
|
|
|
|
echo e2fsck $VERIFY_FSCK_OPT -N test_filesys >> $OUT.new
|
|
$FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
|
|
status=$?
|
|
echo Exit status is $status >> $OUT.new
|
|
sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
|
|
|
|
#
|
|
# Do the verification
|
|
#
|
|
|
|
rm -f $TMPFILE $OUT.new
|
|
cmp -s $OUT $EXP
|
|
status=$?
|
|
|
|
if [ "$status" = 0 ] ; then
|
|
echo "$test_name: $test_description: ok"
|
|
touch $test_name.ok
|
|
else
|
|
echo "$test_name: $test_description: failed"
|
|
diff $DIFF_OPTS $EXP $OUT > $test_name.failed
|
|
fi
|
|
|
|
unset VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA
|