1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2024-11-25 17:45:39 +00:00
go-mtree/test/cli/0003.sh
Vincent Batts 235566d9e0
cli.test: passthrough and use TMPDIR
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-01-20 11:30:54 -05:00

33 lines
995 B
Bash

#!/bin/bash
set -e
name=$(basename $0)
root="$(dirname $(dirname $(dirname $0)))"
gomtree=$(readlink -f ${root}/gomtree)
t=$(mktemp -t -d go-mtree.XXXXXX)
setfattr -n user.has.xattrs -v "true" "${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}