mirror of
https://github.com/torarnv/sparsebundlefs.git
synced 2026-02-26 18:35:50 +01:00
Share test code between test suites
This commit is contained in:
@@ -1,16 +1,9 @@
|
||||
#!/usr/bin/env testrunner.sh
|
||||
|
||||
source "$(dirname "$0")/testhelpers.sh"
|
||||
|
||||
function setup() {
|
||||
test ! -z "$TEST_BUNDLE"
|
||||
mount_dir=$(mktemp -d)
|
||||
sparsebundlefs -s -f -D $TEST_BUNDLE $mount_dir &
|
||||
pid=$!
|
||||
for i in {0..50}; do
|
||||
kill -0 $pid >/dev/null 2>&1
|
||||
# FIXME: Find actual mount callback in fuse?
|
||||
grep -q "bundle has" $test_output_file && break || sleep 0.1
|
||||
done
|
||||
dmg_file=$mount_dir/sparsebundle.dmg
|
||||
mount_sparsebundle
|
||||
}
|
||||
|
||||
function test_dmg_exists_after_mounting() {
|
||||
|
||||
@@ -1,16 +1,9 @@
|
||||
#!/usr/bin/env testrunner.sh
|
||||
|
||||
source "$(dirname "$0")/testhelpers.sh"
|
||||
|
||||
function setup() {
|
||||
test ! -z "$TEST_BUNDLE"
|
||||
mount_dir=$(mktemp -d)
|
||||
sparsebundlefs -s -f -D -o allow_other $TEST_BUNDLE $mount_dir &
|
||||
pid=$!
|
||||
for i in {0..50}; do
|
||||
kill -0 $pid >/dev/null 2>&1
|
||||
# FIXME: Find actual mount callback in fuse?
|
||||
grep -q "bundle has" $test_output_file && break || sleep 0.1
|
||||
done
|
||||
dmg_file=$mount_dir/sparsebundle.dmg
|
||||
mount_sparsebundle -o allow_other
|
||||
}
|
||||
|
||||
function test_dmg_has_correct_permissions() {
|
||||
|
||||
13
tests/testhelpers.sh
Normal file
13
tests/testhelpers.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
function mount_sparsebundle() {
|
||||
test ! -z "$TEST_BUNDLE"
|
||||
mount_dir=$(mktemp -d)
|
||||
sparsebundlefs -s -f -D $* $TEST_BUNDLE $mount_dir &
|
||||
pid=$!
|
||||
for i in {0..50}; do
|
||||
kill -0 $pid >/dev/null 2>&1
|
||||
# FIXME: Find actual mount callback in fuse?
|
||||
grep -q "bundle has" $test_output_file && break || sleep 0.1
|
||||
done
|
||||
dmg_file=$mount_dir/sparsebundle.dmg
|
||||
}
|
||||
Reference in New Issue
Block a user