diff --git a/Makefile b/Makefile index 73bf497c4fb7a86e76c96dab94b5d7429f4e1b44..73fbb5585c86c26d5d30fe952126bf375c78c8cc 100644 --- a/Makefile +++ b/Makefile @@ -35,10 +35,10 @@ test_go_expensive: go test ./... test_sharness_short: - cd test/ && make + cd test/sharness/ && make test_sharness_expensive: - cd test/ && TEST_EXPENSIVE=1 make + cd test/sharness/ && TEST_EXPENSIVE=1 make test_all_commits: @echo "testing all commits between origin/master..HEAD" diff --git a/test/.gitignore b/test/.gitignore index 7c23cc5f7dc8f7836f6b65e6ac86798b508279fb..4f89478ac1a0188808f549ed85b622ca1d9b27dc 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -1,5 +1,2 @@ -lib/sharness/ bin/ipfs bin/random -test-results/ -trash directory.*.sh/ diff --git a/test/Makefile b/test/Makefile index 8cd48719da9abeaa1165dbba4f69fdb9101edec4..58a45deff09eb05e6372a11cfe9d53a167865c12 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,45 +1,25 @@ -# Run tests -# -# Copyright (c) 2014 Christian Couder -# MIT Licensed; see the LICENSE file in this repository. -# -# NOTE: run with TEST_VERBOSE=1 for verbose sharness tests. +BINS = bin/random bin/ipfs +IPFS_ROOT = ../ +IPFS_CMD = ../cmd/ipfs +RANDOM_SRC = ../Godeps/_workspace/src/github.com/jbenet/go-random -T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)) -SHARNESS = lib/sharness/sharness.sh -RANDOMSRC = Godeps/_workspace/src/github.com/jbenet/go-random/random +all: deps -all: clean deps $(T) aggregate +deps: bins clean: - @echo "*** $@ ***" - -rm -rf test-results + rm $(BINS) -$(T): - @echo "*** $@ ***" - ./$@ +bins: $(BINS) -aggregate: - @echo "*** $@ ***" - lib/test-aggregate-results.sh +bin/random: $(RANDOM_SRC)/**/*.go + go build -o bin/random $(RANDOM_SRC)/random -deps: $(SHARNESS) ipfs random +bin/ipfs: $(IPFS_ROOT)/**/*.go + go build -o bin/ipfs $(IPFS_CMD) -$(SHARNESS): - @echo "*** installing $@ ***" - lib/install-sharness.sh +test_sharness: + cd sharness && make -# phony to ensure we re-build it every time we run tests -ipfs: - @echo "*** installing $@ ***" - mkdir -p bin - cd ../cmd/ipfs && go build - cp ../cmd/ipfs/ipfs bin/ipfs - -random: - @echo "*** installing $@ ***" - mkdir -p bin - go build -o bin/random ../$(RANDOMSRC) - -.PHONY: all clean $(T) aggregate ipfs random +.PHONY: all clean diff --git a/test/sharness/.gitignore b/test/sharness/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..5e59048ac5fe131b42d6abc242593dc877b3496b --- /dev/null +++ b/test/sharness/.gitignore @@ -0,0 +1,3 @@ +lib/sharness/ +test-results/ +trash directory.*.sh/ diff --git a/test/sharness/Makefile b/test/sharness/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..b314c67574caced0bc1587b6bc5246fbe0b7a068 --- /dev/null +++ b/test/sharness/Makefile @@ -0,0 +1,37 @@ +# Run tests +# +# Copyright (c) 2014 Christian Couder +# MIT Licensed; see the LICENSE file in this repository. +# + +# NOTE: run with TEST_VERBOSE=1 for verbose sharness tests. + +T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)) +BINS = bin/random bin/ipfs +SHARNESS = lib/sharness/sharness.sh + +all: clean deps $(T) aggregate + +clean: + @echo "*** $@ ***" + -rm -rf test-results + +$(T): + @echo "*** $@ ***" + ./$@ + +aggregate: + @echo "*** $@ ***" + lib/test-aggregate-results.sh + +deps: $(SHARNESS) $(BINS) + +$(SHARNESS): + @echo "*** installing $@ ***" + lib/install-sharness.sh + +bin/%: + @echo "*** installing $@ ***" + cd .. && make $@ + +.PHONY: all clean $(T) aggregate diff --git a/test/README.md b/test/sharness/README.md similarity index 100% rename from test/README.md rename to test/sharness/README.md diff --git a/test/sharness/bin b/test/sharness/bin new file mode 120000 index 0000000000000000000000000000000000000000..19f285ac7c294bb361b37e7efd20baede12e9859 --- /dev/null +++ b/test/sharness/bin @@ -0,0 +1 @@ +../bin \ No newline at end of file diff --git a/test/lib/install-sharness.sh b/test/sharness/lib/install-sharness.sh similarity index 100% rename from test/lib/install-sharness.sh rename to test/sharness/lib/install-sharness.sh diff --git a/test/lib/random-dep.go b/test/sharness/lib/random-dep.go similarity index 100% rename from test/lib/random-dep.go rename to test/sharness/lib/random-dep.go diff --git a/test/lib/test-aggregate-results.sh b/test/sharness/lib/test-aggregate-results.sh similarity index 100% rename from test/lib/test-aggregate-results.sh rename to test/sharness/lib/test-aggregate-results.sh diff --git a/test/lib/test-lib.sh b/test/sharness/lib/test-lib.sh similarity index 100% rename from test/lib/test-lib.sh rename to test/sharness/lib/test-lib.sh diff --git a/test/t0010-basic-commands.sh b/test/sharness/t0010-basic-commands.sh similarity index 100% rename from test/t0010-basic-commands.sh rename to test/sharness/t0010-basic-commands.sh diff --git a/test/t0020-init.sh b/test/sharness/t0020-init.sh similarity index 100% rename from test/t0020-init.sh rename to test/sharness/t0020-init.sh diff --git a/test/t0030-mount.sh b/test/sharness/t0030-mount.sh similarity index 100% rename from test/t0030-mount.sh rename to test/sharness/t0030-mount.sh diff --git a/test/t0040-add-and-cat.sh b/test/sharness/t0040-add-and-cat.sh similarity index 100% rename from test/t0040-add-and-cat.sh rename to test/sharness/t0040-add-and-cat.sh diff --git a/test/t0050-block.sh b/test/sharness/t0050-block.sh similarity index 100% rename from test/t0050-block.sh rename to test/sharness/t0050-block.sh diff --git a/test/t0060-daemon.sh b/test/sharness/t0060-daemon.sh similarity index 100% rename from test/t0060-daemon.sh rename to test/sharness/t0060-daemon.sh