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