aboutsummaryrefslogtreecommitdiff
path: root/tests/getfattr.test
blob: ae33d766c37d85ada02a5025a585fdb33a900311 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/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.more -v world attrs/file

testing "" "getfattr attrs/file" \
    "# file: attrs/file\nuser.data\nuser.empty\nuser.more\n\n" "" ""
testing "-d" "getfattr -d attrs/file" \
    "# file: attrs/file\nuser.data=\"hello\"\nuser.empty\nuser.more=\"world\"\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" "" ""
testing "--only-values" "getfattr --only-values attrs/file" \
    "helloworld" "" ""
testing "--only-values -n" "getfattr --only-values -n user.data attrs/file" \
    "hello" "" ""

rm -rf attrs