Files
sparsebundlefs-mirror/tests/10_basic.sh
Tor Arne Vestbø 7d81b50bb8 Clarify access, ownership, and permissions for mounted sparsebundle
We now reflect the user who mounted the sparsebundle as the owner of
the resulting .dmg file, and try to reflect the state of allow_other
and allow_root through the file permission bits.

These are just informative. The real access control happens in FUSE
based on the allow_other/allow_root options (unless user also passes
the default_permissions option, in which case the permission bits
will also be checked).

Fixes issue #15
2018-09-10 15:22:03 +02:00

37 lines
813 B
Bash

function setup() {
mount_dir=$(mktemp -d)
$SPARSEBUNDLEFS -s -f -D $TEST_BUNDLE $mount_dir &
for i in {0..50}; do
# FIXME: Find actual mount callback in fuse?
grep -q "bundle has" $test_output_file && break || sleep 0.1
done
pid=$!
dmg_file=$mount_dir/sparsebundle.dmg
}
function test_dmg_exists_after_mounting() {
ls -al $mount_dir
test -f $dmg_file
}
function test_dmg_has_expected_size() {
size=$(ls -dn $dmg_file | awk '{print $5; exit}')
test $size -eq 1099511627776
}
function test_dmg_has_correct_owner() {
owner=$(ls -l $dmg_file | awk '{print $3; exit}')
test $owner = $(whoami)
}
function test_dmg_has_correct_permissions() {
permissions=$(ls -l $dmg_file | awk '{print $1; exit}')
test $permissions = "-r--------"
}
function teardown() {
umount $mount_dir
rm -Rf $mount_dir
}