1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2024-12-25 06:56:30 +00:00

test: cli: add xattr tests

Signed-off-by: Aleksa Sarai <asarai@suse.de>
This commit is contained in:
Aleksa Sarai 2017-01-14 18:01:36 +11:00
parent 9cdd9152b3
commit 071977cef6
No known key found for this signature in database
GPG key ID: 9E18AA267DDB8DB4

33
test/cli/0003.sh Normal file
View file

@ -0,0 +1,33 @@
#!/bin/bash
set -e
name=$(basename $0)
root="$(dirname $(dirname $(dirname $0)))"
gomtree=$(readlink -f ${root}/gomtree)
t=$(mktemp -d /tmp/go-mtree.XXXXXX)
setfattr -n user.has_xattrs -v "" "${t}" || exit 0
echo "[${name}] Running in ${t}"
mkdir "${t}/dir"
touch "${t}/dir/file"
setfattr -n user.mtree.testing -v "apples and=bananas" "${t}/dir/file"
$gomtree -c -k "sha256digest,xattrs" -p ${t}/dir > ${t}/${name}.mtree
setfattr -n user.mtree.testing -v "bananas and lemons" "${t}/dir/file"
! $gomtree -p ${t}/dir -f ${t}/${name}.mtree
setfattr -x user.mtree.testing "${t}/dir/file"
! $gomtree -p ${t}/dir -f ${t}/${name}.mtree
setfattr -n user.mtree.testing -v "apples and=bananas" "${t}/dir/file"
setfattr -n user.mtree.another -v "another a=b" "${t}/dir/file"
! $gomtree -p ${t}/dir -f ${t}/${name}.mtree
setfattr -n user.mtree.testing -v "apples and=bananas" "${t}/dir/file"
setfattr -x user.mtree.another "${t}/dir/file"
$gomtree -p ${t}/dir -f ${t}/${name}.mtree
rm -fr ${t}