fstests: filter redundant output by getfattr

When getfattr dumps values of all extended attributes (-d option),
it doesn't print empty extended attributes. e.g: user.name. But from
attr-2.4.48 this behavior is changed,  new getfattr prints
user.name="".

The {=""} will break the golden image, so filter the redundant =""
at the end if it has.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
Zorro Lang
2018-08-23 10:41:24 +08:00
committed by Eryu Guan
parent 84fdfc5d8a
commit 794f4594fb
24 changed files with 55 additions and 41 deletions
+3 -3
View File
@@ -58,7 +58,7 @@ testf() {
echo "Testing ${key} ($(hexbytes "${key}")) -> ${value}" >> $seqres.full
actual_value="$($GETFATTR_PROG --absolute-names --only-values -n "user.${key}" "${testfile}")"
actual_value="$(_getfattr --absolute-names --only-values -n "user.${key}" "${testfile}")"
if [ "${actual_value}" != "${value}" ]; then
echo "Key ${key} has value ${actual_value}, expected ${value}."
fi
@@ -127,7 +127,7 @@ setf "zerojoin_moo\xe2\x80\x8ccow.txt" "zero width joiners"
setf "combmark_\xe1\x80\x9c\xe1\x80\xad\xe1\x80\xaf.txt" "combining marks"
setf "combmark_\xe1\x80\x9c\xe1\x80\xaf\xe1\x80\xad.txt" "combining marks"
$GETFATTR_PROG --absolute-names -d "${testfile}" >> $seqres.full
_getfattr --absolute-names -d "${testfile}" >> $seqres.full
echo "Test files"
testf "french_caf\xc3\xa9.txt" "NFC"
@@ -175,7 +175,7 @@ testf "combmark_\xe1\x80\x9c\xe1\x80\xad\xe1\x80\xaf.txt" "combining marks"
testf "combmark_\xe1\x80\x9c\xe1\x80\xaf\xe1\x80\xad.txt" "combining marks"
echo "Uniqueness of keys?"
crazy_keys="$($GETFATTR_PROG --absolute-names -d "${testfile}" | egrep -c '(french_|chinese_|greek_|arabic_|urk)')"
crazy_keys="$(_getfattr --absolute-names -d "${testfile}" | egrep -c '(french_|chinese_|greek_|arabic_|urk)')"
expected_keys=11
test "${crazy_keys}" -ne "${expected_keys}" && echo "Expected ${expected_keys} keys, saw ${crazy_keys}."