summaryrefslogtreecommitdiffstats
path: root/tests/d_xattr_edits
diff options
context:
space:
mode:
Diffstat (limited to 'tests/d_xattr_edits')
-rw-r--r--tests/d_xattr_edits/expect55
-rw-r--r--tests/d_xattr_edits/name1
-rw-r--r--tests/d_xattr_edits/script124
3 files changed, 180 insertions, 0 deletions
diff --git a/tests/d_xattr_edits/expect b/tests/d_xattr_edits/expect
new file mode 100644
index 0000000..6a4d912
--- /dev/null
+++ b/tests/d_xattr_edits/expect
@@ -0,0 +1,55 @@
+debugfs edit extended attributes
+mke2fs -Fq -b 1024 test.img 512
+Exit status is 0
+ea_set / user.joe smith
+Exit status is 0
+ea_set / user.moo FEE_FIE_FOE_FUMMMMMM
+Exit status is 0
+ea_list /
+Extended attributes:
+ user.joe (5) = "smith"
+ user.moo (20) = "FEE_FIE_FOE_FUMMMMMM"
+Exit status is 0
+ea_get / user.moo
+user.moo (20) = "FEE_FIE_FOE_FUMMMMMM"
+
+Exit status is 0
+ea_get / nosuchea
+ea_get: Extended attribute key not found while getting extended attribute
+Exit status is 0
+ea_rm / user.moo
+Exit status is 0
+ea_rm / nosuchea
+Exit status is 0
+ea_list /
+Extended attributes:
+ user.joe (5) = "smith"
+Exit status is 0
+ea_get / user.moo
+ea_get: Extended attribute key not found while getting extended attribute
+Exit status is 0
+ea_rm / user.joe
+Exit status is 0
+ea_list /
+Exit status is 0
+ea_set -f d_xattr_edits.tmp / user.file_based_xattr
+Exit status is 0
+ea_list /
+Extended attributes:
+ user.file_based_xattr (108)
+Exit status is 0
+ea_get / user.file_based_xattr
+user.file_based_xattr (108) = "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567\n"
+
+Exit status is 0
+ea_get -f d_xattr_edits.ver.tmp / user.file_based_xattr
+Exit status is 0
+Compare big attribute
+e2fsck -yf -N test_filesys
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/64 files (0.0% non-contiguous), 37/512 blocks
+Exit status is 0
diff --git a/tests/d_xattr_edits/name b/tests/d_xattr_edits/name
new file mode 100644
index 0000000..c0c428c
--- /dev/null
+++ b/tests/d_xattr_edits/name
@@ -0,0 +1 @@
+edit extended attributes in debugfs
diff --git a/tests/d_xattr_edits/script b/tests/d_xattr_edits/script
new file mode 100644
index 0000000..07906c2
--- /dev/null
+++ b/tests/d_xattr_edits/script
@@ -0,0 +1,124 @@
+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 edit 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
+
+echo "ea_set / user.joe smith" >> $OUT.new
+$DEBUGFS -w -R "ea_set / user.joe smith" $TMPFILE >> $OUT.new 2>&1
+status=$?
+echo Exit status is $status >> $OUT.new
+
+echo "ea_set / user.moo FEE_FIE_FOE_FUMMMMMM" >> $OUT.new
+$DEBUGFS -w -R "ea_set / user.moo FEE_FIE_FOE_FUMMMMMM" $TMPFILE >> $OUT.new 2>&1
+status=$?
+echo Exit status is $status >> $OUT.new
+
+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 / user.moo" >> $OUT.new
+$DEBUGFS -w -R "ea_get / user.moo" $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 "ea_rm / user.moo" >> $OUT.new
+$DEBUGFS -w -R "ea_rm / user.moo" $TMPFILE >> $OUT.new 2>&1
+status=$?
+echo Exit status is $status >> $OUT.new
+
+echo "ea_rm / nosuchea" >> $OUT.new
+$DEBUGFS -w -R "ea_rm / nosuchea" $TMPFILE >> $OUT.new 2>&1
+status=$?
+echo Exit status is $status >> $OUT.new
+
+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 / user.moo" >> $OUT.new
+$DEBUGFS -w -R "ea_get / user.moo" $TMPFILE >> $OUT.new 2>&1
+status=$?
+echo Exit status is $status >> $OUT.new
+
+echo "ea_rm / user.joe" >> $OUT.new
+$DEBUGFS -w -R "ea_rm / user.joe" $TMPFILE >> $OUT.new 2>&1
+status=$?
+echo Exit status is $status >> $OUT.new
+
+echo "ea_list /" >> $OUT.new
+$DEBUGFS -w -R "ea_list /" $TMPFILE >> $OUT.new 2>&1
+status=$?
+echo Exit status is $status >> $OUT.new
+
+echo "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567" > $TEST_DATA
+echo "ea_set -f $TEST_DATA / user.file_based_xattr" >> $OUT.new
+$DEBUGFS -w -R "ea_set -f $TEST_DATA / user.file_based_xattr" $TMPFILE >> $OUT.new 2>&1
+status=$?
+echo Exit status is $status >> $OUT.new
+
+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 / user.file_based_xattr" >> $OUT.new
+$DEBUGFS -w -R "ea_get / user.file_based_xattr" $TMPFILE >> $OUT.new 2>&1
+status=$?
+echo Exit status is $status >> $OUT.new
+
+echo "ea_get -f $VERIFY_DATA / user.file_based_xattr" >> $OUT.new
+$DEBUGFS -w -R "ea_get -f $VERIFY_DATA / user.file_based_xattr" $TMPFILE >> $OUT.new 2>&1
+status=$?
+echo Exit status is $status >> $OUT.new
+
+echo "Compare big attribute" >> $OUT.new
+diff -u $TEST_DATA $VERIFY_DATA >> $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 $TEST_DATA $VERIFY_DATA $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