getfattr.test 887 B

1234567891011121314151617181920212223242526
  1. #!/bin/bash
  2. [ -f testing.sh ] && . testing.sh
  3. #testing "name" "command" "result" "infile" "stdin"
  4. mkdir attrs
  5. touch attrs/file
  6. setfattr -n user.empty attrs/file
  7. setfattr -n user.data -v hello attrs/file
  8. setfattr -n user.more -v world attrs/file
  9. testing "" "getfattr attrs/file" \
  10. "# file: attrs/file\nuser.data\nuser.empty\nuser.more\n\n" "" ""
  11. testing "-d" "getfattr -d attrs/file" \
  12. "# file: attrs/file\nuser.data=\"hello\"\nuser.empty\nuser.more=\"world\"\n\n" "" ""
  13. testing "-n" "getfattr -n user.empty attrs/file" \
  14. "# file: attrs/file\nuser.empty\n\n" "" ""
  15. testing "-d -n" "getfattr -d -n user.data attrs/file" \
  16. "# file: attrs/file\nuser.data=\"hello\"\n\n" "" ""
  17. testing "--only-values" "getfattr --only-values attrs/file" \
  18. "helloworld" "" ""
  19. testing "--only-values -n" "getfattr --only-values -n user.data attrs/file" \
  20. "hello" "" ""
  21. rm -rf attrs