From bd471f67cc6eff4abf47f027edbace707065bc6b Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Sun, 17 Jul 2016 10:42:31 -0700 Subject: Add getfattr(1) and setfattr(1). Plus basic tests. --- tests/getfattr.test | 21 +++++++++++++++++++++ tests/setfattr.test | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100755 tests/getfattr.test create mode 100755 tests/setfattr.test (limited to 'tests') diff --git a/tests/getfattr.test b/tests/getfattr.test new file mode 100755 index 00000000..cb0f9475 --- /dev/null +++ b/tests/getfattr.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 + +testing "" "getfattr attrs/file" \ + "# file: attrs/file\nuser.data\nuser.empty\n\n" "" "" +testing "-d" "getfattr -d attrs/file" \ + "# file: attrs/file\nuser.data=\"hello\"\nuser.empty\n\n" "" "" +testing "-n" "getfattr -n user.empty attrs/file" \ + "# file: attrs/file\nuser.empty\n\n" "" "" +testing "-d -n" "getfattr -d -n user.data attrs/file" \ + "# file: attrs/file\nuser.data=\"hello\"\n\n" "" "" + +rm -rf attrs 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 -- cgit v1.2.3