aboutsummaryrefslogtreecommitdiff
path: root/tests/setfattr.test
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2016-07-17 10:42:31 -0700
committerRob Landley <rob@landley.net>2016-07-18 14:14:22 -0500
commitbd471f67cc6eff4abf47f027edbace707065bc6b (patch)
tree2c7e2c3edcca3a588b650d33c115d9335c09b163 /tests/setfattr.test
parent48ea55969907286d1a125fcd655be9d8307a3449 (diff)
downloadtoybox-bd471f67cc6eff4abf47f027edbace707065bc6b.tar.gz
Add getfattr(1) and setfattr(1).
Plus basic tests.
Diffstat (limited to 'tests/setfattr.test')
-rwxr-xr-xtests/setfattr.test21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/setfattr.test b/tests/setfattr.test
new file mode 100755
index 00000000..6a044ea2
--- /dev/null
+++ b/tests/setfattr.test
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+[ -f testing.sh ] && . testing.sh
+
+#testing "name" "command" "result" "infile" "stdin"
+
+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" \
+ "# file: attrs/file\nuser.data\nuser.empty\n\n" "" ""
+testing "-n" "setfattr -n user.new attrs/file && getfattr -d attrs/file" \
+ "# 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" \
+ "# file: attrs/file\nuser.data=\"hello\"\nuser.empty\nuser.new=\"data\"\n\n" "" ""
+
+rm -rf attrs