mirror of
https://github.com/landley/toybox.git
synced 2025-11-07 19:04:58 +00:00
In commit 2c96060, the tests for getfattr and setfattr were updated to
only query specific names and avoid any unexpected extended attributes.
Reintroduce the generic tests by filtering out any attribute in the
`security` namespace.
29 lines
921 B
Bash
29 lines
921 B
Bash
#!/bin/bash
|
|
|
|
[ -f testing.sh ] && . testing.sh
|
|
|
|
#testing "name" "command" "result" "infile" "stdin"
|
|
|
|
function clean()
|
|
{
|
|
# The filesystem may include some extended attributes by default (for
|
|
# instance, security.selinux). Skip them.
|
|
grep -v "security\."
|
|
}
|
|
|
|
mkdir attrs
|
|
touch attrs/file
|
|
setfattr -n user.empty attrs/file
|
|
setfattr -n user.data -v hello attrs/file
|
|
setfattr -n user.delete-me -v hello attrs/file
|
|
|
|
testing "-x" \
|
|
"setfattr -x user.delete-me attrs/file && getfattr attrs/file | clean" \
|
|
"# file: attrs/file\nuser.data\nuser.empty\n\n" "" ""
|
|
testing "-n" "setfattr -n user.new attrs/file && getfattr -d attrs/file | clean" \
|
|
"# file: attrs/file\nuser.data=\"hello\"\nuser.empty\nuser.new\n\n" "" ""
|
|
testing "-n -v" "setfattr -n user.new -v data attrs/file && getfattr -d attrs/file | clean" \
|
|
"# file: attrs/file\nuser.data=\"hello\"\nuser.empty\nuser.new=\"data\"\n\n" "" ""
|
|
|
|
rm -rf attrs
|