Use a FUSE prerequisite to skip mount tests
When there is no fuse we should skip all mount tests and using a FUSE prerequisite is a good way to do that.
Christian Couder committed
Nov 7, 2014 at 22:41 UTC
7e46d9514544625730c6104c4e368bfbe196c26b
3 files changed
+13
-11
test/t0030-mount.sh
+3
-3
@@ -9,10 +9,10 @@ test_description="Test mount command"
9
. ./test-lib.sh
10
11
# if in travis CI, dont test mount (no fuse)
12
-if test "$TEST_NO_FUSE" = 1; then
13
- skip_all='skipping mount tests, fuse not available'
12
+if ! test_have_prereq FUSE; then
13
+ skip_all='skipping mount tests, fuse not available'
14
15
- test_done
15
+ test_done
16
fi
17
18
test_launch_ipfs_mount
test/t0040-add-and-cat.sh
+4
-4
@@ -30,11 +30,11 @@ test_expect_success "ipfs cat output looks good" '
30
test_cmp expected actual
31
'
32
33
-test_expect_success "cat ipfs/stuff succeeds" '
33
+test_expect_success FUSE "cat ipfs/stuff succeeds" '
34
cat ipfs/$HASH >actual
35
'
36
37
-test_expect_success "cat ipfs/stuff looks good" '
37
+test_expect_success FUSE "cat ipfs/stuff looks good" '
38
test_cmp expected actual
39
'
40
@@ -71,11 +71,11 @@ test_expect_success "ipfs cat output looks good" '
71
test_cmp sha1_expected sha1_actual
72
'
73
74
-test_expect_success "cat ipfs/bigfile succeeds" '
74
+test_expect_success FUSE "cat ipfs/bigfile succeeds" '
75
cat ipfs/$HASH | shasum >sha1_actual
76
'
77
78
-test_expect_success "cat ipfs/bigfile looks good" '
78
+test_expect_success FUSE "cat ipfs/bigfile looks good" '
79
test_cmp sha1_expected sha1_actual
80
'
81
test/test-lib.sh
+6
-4
@@ -16,6 +16,8 @@ SHARNESS_LIB="./sharness.sh"
16
17
# Please put go-ipfs specific shell functions below
18
19
+test "$TEST_NO_FUSE" != 1 && test_set_prereq FUSE
20
+
21
test_cmp_repeat_10_sec() {
22
for i in 1 2 3 4 5 6 7 8 9 10
23
do
@@ -38,11 +40,11 @@ test_launch_ipfs_mount() {
40
ipfs config Mounts.IPNS "$(pwd)/ipns"
41
'
42
41
- test_expect_success "ipfs mount succeeds" '
43
+ test_expect_success FUSE "ipfs mount succeeds" '
44
ipfs mount mountdir >actual &
45
'
46
45
- test_expect_success "ipfs mount output looks good" '
47
+ test_expect_success FUSE "ipfs mount output looks good" '
48
IPFS_PID=$! &&
49
echo "mounting ipfs at $(pwd)/ipfs" >expected &&
50
echo "mounting ipns at $(pwd)/ipns" >>expected &&
@@ -52,11 +54,11 @@ test_launch_ipfs_mount() {
54
55
test_kill_ipfs_mount() {
56
55
- test_expect_success "ipfs mount is still running" '
57
+ test_expect_success FUSE "ipfs mount is still running" '
58
kill -0 $IPFS_PID
59
'
60
59
- test_expect_success "ipfs mount can be killed" '
61
+ test_expect_success FUSE "ipfs mount can be killed" '
62
kill $IPFS_PID &&
63
sleep 1 &&
64
! kill -0 $IPFS_PID 2>/dev/null