From 071977cef680627ed52a54aa065cb5495a0d0dd1 Mon Sep 17 00:00:00 2001 From: Aleksa Sarai Date: Sat, 14 Jan 2017 18:01:36 +1100 Subject: [PATCH] test: cli: add xattr tests Signed-off-by: Aleksa Sarai --- test/cli/0003.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/cli/0003.sh diff --git a/test/cli/0003.sh b/test/cli/0003.sh new file mode 100644 index 0000000..c9c5708 --- /dev/null +++ b/test/cli/0003.sh @@ -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}