test/: build own ipfs tool to test
The tests were using the globally installed ipfs. This commit changes it to build + use its own ipfs binary.
Juan Batiz-Benet committed
Nov 7, 2014 at 15:14 UTC
7e14f1737d146cb45f3d788f229dae9fd964e524
6 files changed
+24
-15
Makefile
+1
-1
@@ -19,5 +19,5 @@ test: test_go test_sharness
19
test_go:
20
go test ./...
21
22
-test_sharness: install
22
+test_sharness:
23
cd test/ && make
test/Makefile
+7
-2
@@ -21,13 +21,18 @@ aggregate:
21
@echo "*** $@ ***"
22
./test-aggregate-results.sh
23
24
-deps: sharness.sh $(RANDOM)
24
+deps: ipfs sharness.sh $(RANDOM)
25
+
26
+# phony to ensure we re-build it every time we run tests
27
+ipfs:
28
+ cd ../cmd/ipfs && go build
29
+ cp ../cmd/ipfs/ipfs ipfs
30
31
sharness.sh:
32
@echo "*** installing $@ ***"
33
./install-sharness.sh
34
30
-.PHONY: all clean $(T) aggregate
35
+.PHONY: all clean $(T) aggregate ipfs
36
37
$(RANDOM):
38
go get github.com/jbenet/go-random/random
test/t0010-basic-commands.sh
+2
-2
@@ -13,7 +13,7 @@ test_expect_success "current dir is writable" '
13
'
14
15
test_expect_success "ipfs version succeeds" '
16
- ipfs version >version.txt
16
+ $ipfs version >version.txt
17
'
18
19
test_expect_success "ipfs version output looks good" '
@@ -21,7 +21,7 @@ test_expect_success "ipfs version output looks good" '
21
'
22
23
test_expect_success "ipfs help succeeds" '
24
- ipfs help >help.txt
24
+ $ipfs help >help.txt
25
'
26
27
test_expect_success "ipfs help output looks good" '
test/t0020-init.sh
+2
-2
@@ -10,7 +10,7 @@ test_description="Test init command"
10
11
test_expect_success "ipfs init succeeds" '
12
export IPFS_DIR="$(pwd)/.go-ipfs" &&
13
- ipfs init
13
+ $ipfs init
14
'
15
16
test_expect_success ".go-ipfs/ has been created" '
@@ -21,7 +21,7 @@ test_expect_success ".go-ipfs/ has been created" '
21
22
test_expect_success "ipfs config succeeds" '
23
echo leveldb >expected &&
24
- ipfs config Datastore.Type >actual &&
24
+ $ipfs config Datastore.Type >actual &&
25
test_cmp expected actual
26
'
27
test/t0040-add-and-cat.sh
+4
-4
@@ -12,7 +12,7 @@ test_launch_ipfs_mount
12
13
test_expect_success "ipfs add succeeds" '
14
echo "Hello Worlds!" >mountdir/hello.txt &&
15
- ipfs add mountdir/hello.txt >actual
15
+ $ipfs add mountdir/hello.txt >actual
16
'
17
18
test_expect_success "ipfs add output looks good" '
@@ -22,7 +22,7 @@ test_expect_success "ipfs add output looks good" '
22
'
23
24
test_expect_success "ipfs cat succeeds" '
25
- ipfs cat $HASH >actual
25
+ $ipfs cat $HASH >actual
26
'
27
28
test_expect_success "ipfs cat output looks good" '
@@ -53,7 +53,7 @@ test_expect_success "sha1 of the file looks ok" '
53
'
54
55
test_expect_success "ipfs add bigfile succeeds" '
56
- ipfs add mountdir/bigfile >actual
56
+ $ipfs add mountdir/bigfile >actual
57
'
58
59
test_expect_success "ipfs add bigfile output looks good" '
@@ -63,7 +63,7 @@ test_expect_success "ipfs add bigfile output looks good" '
63
'
64
65
test_expect_success "ipfs cat succeeds" '
66
- ipfs cat $HASH | shasum >sha1_actual
66
+ $ipfs cat $HASH | shasum >sha1_actual
67
'
68
69
test_expect_success "ipfs cat output looks good" '
test/test-lib.sh
+8
-4
@@ -8,6 +8,10 @@
8
9
SHARNESS_LIB="./sharness.sh"
10
11
+# the ipfs tool to test against
12
+# ../ipfs because it will be one level above during test exec
13
+ipfs="../ipfs"
14
+
15
. "$SHARNESS_LIB" || {
16
echo >&2 "Cannot source: $SHARNESS_LIB"
17
echo >&2 "Please check Sharness installation."
@@ -31,17 +35,17 @@ test_launch_ipfs_mount() {
35
36
test_expect_success "ipfs init succeeds" '
37
export IPFS_DIR="$(pwd)/.go-ipfs" &&
34
- ipfs init -b=2048
38
+ $ipfs init -b=2048
39
'
40
41
test_expect_success "prepare config" '
42
mkdir mountdir ipfs ipns &&
39
- ipfs config Mounts.IPFS "$(pwd)/ipfs" &&
40
- ipfs config Mounts.IPNS "$(pwd)/ipns"
43
+ $ipfs config Mounts.IPFS "$(pwd)/ipfs" &&
44
+ $ipfs config Mounts.IPNS "$(pwd)/ipns"
45
'
46
47
test_expect_success FUSE "ipfs mount succeeds" '
44
- ipfs mount mountdir >actual &
48
+ $ipfs mount mountdir >actual &
49
'
50
51
test_expect_success FUSE "ipfs mount output looks good" '