Skip to content

Commit a4ad1d7

Browse files
committed
Pass mount dir and DMG file out of mount_sparsebundle
1 parent 4db576a commit a4ad1d7

3 files changed

Lines changed: 7 additions & 9 deletions

File tree

tests/20_mount.tst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
source "$(dirname "$0")/testhelpers.sh"
44

55
function setup() {
6-
mount_sparsebundle
6+
read -r mount_dir dmg_file < <(mount_sparsebundle)
77
}
88

99
function test_dmg_has_correct_number_of_blocks() {
@@ -18,6 +18,5 @@ function test_dmg_contents_is_same_as_testdata() {
1818
}
1919

2020
function teardown() {
21-
umount $mount_dir
22-
rm -Rf $mount_dir
21+
umount $mount_dir && rm -Rf $mount_dir
2322
}

tests/30_noreadbuf.tst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
source "$(dirname "$0")/testhelpers.sh"
44

55
function setup() {
6-
mount_sparsebundle -o noreadbuf
6+
read -r mount_dir dmg_file < <(mount_sparsebundle -o noreadbuf)
77
}
88

99
function test_dmg_has_correct_number_of_blocks() {
@@ -18,6 +18,5 @@ function test_dmg_contents_is_same_as_testdata() {
1818
}
1919

2020
function teardown() {
21-
umount $mount_dir
22-
rm -Rf $mount_dir
21+
umount $mount_dir && rm -Rf $mount_dir
2322
}

tests/testhelpers.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

22
function mount_sparsebundle() {
33
test ! -z "$TEST_BUNDLE"
4-
mount_dir=$(mktemp -d)
5-
dmg_file="$mount_dir/sparsebundle.dmg"
4+
local mount_dir=$(mktemp -d)
5+
local dmg_file="$mount_dir/sparsebundle.dmg"
66
sparsebundlefs -s -f -D $* $TEST_BUNDLE $mount_dir &
7-
pid=$!
7+
local pid=$!
88
for i in {0..50}; do
99
kill -0 $pid >/dev/null 2>&1
1010
test -f $dmg_file && break || sleep 0.1

0 commit comments

Comments
 (0)