提交 7e14f173 作者: Juan Batiz-Benet

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.
上级 53c2cacd
...@@ -19,5 +19,5 @@ test: test_go test_sharness ...@@ -19,5 +19,5 @@ test: test_go test_sharness
test_go: test_go:
go test ./... go test ./...
test_sharness: install test_sharness:
cd test/ && make cd test/ && make
...@@ -21,13 +21,18 @@ aggregate: ...@@ -21,13 +21,18 @@ aggregate:
@echo "*** $@ ***" @echo "*** $@ ***"
./test-aggregate-results.sh ./test-aggregate-results.sh
deps: sharness.sh $(RANDOM) deps: ipfs sharness.sh $(RANDOM)
# phony to ensure we re-build it every time we run tests
ipfs:
cd ../cmd/ipfs && go build
cp ../cmd/ipfs/ipfs ipfs
sharness.sh: sharness.sh:
@echo "*** installing $@ ***" @echo "*** installing $@ ***"
./install-sharness.sh ./install-sharness.sh
.PHONY: all clean $(T) aggregate .PHONY: all clean $(T) aggregate ipfs
$(RANDOM): $(RANDOM):
go get github.com/jbenet/go-random/random go get github.com/jbenet/go-random/random
......
...@@ -13,7 +13,7 @@ test_expect_success "current dir is writable" ' ...@@ -13,7 +13,7 @@ test_expect_success "current dir is writable" '
' '
test_expect_success "ipfs version succeeds" ' test_expect_success "ipfs version succeeds" '
ipfs version >version.txt $ipfs version >version.txt
' '
test_expect_success "ipfs version output looks good" ' test_expect_success "ipfs version output looks good" '
...@@ -21,7 +21,7 @@ test_expect_success "ipfs version output looks good" ' ...@@ -21,7 +21,7 @@ test_expect_success "ipfs version output looks good" '
' '
test_expect_success "ipfs help succeeds" ' test_expect_success "ipfs help succeeds" '
ipfs help >help.txt $ipfs help >help.txt
' '
test_expect_success "ipfs help output looks good" ' test_expect_success "ipfs help output looks good" '
......
...@@ -10,7 +10,7 @@ test_description="Test init command" ...@@ -10,7 +10,7 @@ test_description="Test init command"
test_expect_success "ipfs init succeeds" ' test_expect_success "ipfs init succeeds" '
export IPFS_DIR="$(pwd)/.go-ipfs" && export IPFS_DIR="$(pwd)/.go-ipfs" &&
ipfs init $ipfs init
' '
test_expect_success ".go-ipfs/ has been created" ' test_expect_success ".go-ipfs/ has been created" '
...@@ -21,7 +21,7 @@ test_expect_success ".go-ipfs/ has been created" ' ...@@ -21,7 +21,7 @@ test_expect_success ".go-ipfs/ has been created" '
test_expect_success "ipfs config succeeds" ' test_expect_success "ipfs config succeeds" '
echo leveldb >expected && echo leveldb >expected &&
ipfs config Datastore.Type >actual && $ipfs config Datastore.Type >actual &&
test_cmp expected actual test_cmp expected actual
' '
......
...@@ -12,7 +12,7 @@ test_launch_ipfs_mount ...@@ -12,7 +12,7 @@ test_launch_ipfs_mount
test_expect_success "ipfs add succeeds" ' test_expect_success "ipfs add succeeds" '
echo "Hello Worlds!" >mountdir/hello.txt && echo "Hello Worlds!" >mountdir/hello.txt &&
ipfs add mountdir/hello.txt >actual $ipfs add mountdir/hello.txt >actual
' '
test_expect_success "ipfs add output looks good" ' test_expect_success "ipfs add output looks good" '
...@@ -22,7 +22,7 @@ test_expect_success "ipfs add output looks good" ' ...@@ -22,7 +22,7 @@ test_expect_success "ipfs add output looks good" '
' '
test_expect_success "ipfs cat succeeds" ' test_expect_success "ipfs cat succeeds" '
ipfs cat $HASH >actual $ipfs cat $HASH >actual
' '
test_expect_success "ipfs cat output looks good" ' test_expect_success "ipfs cat output looks good" '
...@@ -53,7 +53,7 @@ test_expect_success "sha1 of the file looks ok" ' ...@@ -53,7 +53,7 @@ test_expect_success "sha1 of the file looks ok" '
' '
test_expect_success "ipfs add bigfile succeeds" ' test_expect_success "ipfs add bigfile succeeds" '
ipfs add mountdir/bigfile >actual $ipfs add mountdir/bigfile >actual
' '
test_expect_success "ipfs add bigfile output looks good" ' test_expect_success "ipfs add bigfile output looks good" '
...@@ -63,7 +63,7 @@ test_expect_success "ipfs add bigfile output looks good" ' ...@@ -63,7 +63,7 @@ test_expect_success "ipfs add bigfile output looks good" '
' '
test_expect_success "ipfs cat succeeds" ' test_expect_success "ipfs cat succeeds" '
ipfs cat $HASH | shasum >sha1_actual $ipfs cat $HASH | shasum >sha1_actual
' '
test_expect_success "ipfs cat output looks good" ' test_expect_success "ipfs cat output looks good" '
......
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
SHARNESS_LIB="./sharness.sh" SHARNESS_LIB="./sharness.sh"
# the ipfs tool to test against
# ../ipfs because it will be one level above during test exec
ipfs="../ipfs"
. "$SHARNESS_LIB" || { . "$SHARNESS_LIB" || {
echo >&2 "Cannot source: $SHARNESS_LIB" echo >&2 "Cannot source: $SHARNESS_LIB"
echo >&2 "Please check Sharness installation." echo >&2 "Please check Sharness installation."
...@@ -31,17 +35,17 @@ test_launch_ipfs_mount() { ...@@ -31,17 +35,17 @@ test_launch_ipfs_mount() {
test_expect_success "ipfs init succeeds" ' test_expect_success "ipfs init succeeds" '
export IPFS_DIR="$(pwd)/.go-ipfs" && export IPFS_DIR="$(pwd)/.go-ipfs" &&
ipfs init -b=2048 $ipfs init -b=2048
' '
test_expect_success "prepare config" ' test_expect_success "prepare config" '
mkdir mountdir ipfs ipns && mkdir mountdir ipfs ipns &&
ipfs config Mounts.IPFS "$(pwd)/ipfs" && $ipfs config Mounts.IPFS "$(pwd)/ipfs" &&
ipfs config Mounts.IPNS "$(pwd)/ipns" $ipfs config Mounts.IPNS "$(pwd)/ipns"
' '
test_expect_success FUSE "ipfs mount succeeds" ' test_expect_success FUSE "ipfs mount succeeds" '
ipfs mount mountdir >actual & $ipfs mount mountdir >actual &
' '
test_expect_success FUSE "ipfs mount output looks good" ' test_expect_success FUSE "ipfs mount output looks good" '
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论