From cecfa45745c8e4d4378546a88478c499de0368f9 Mon Sep 17 00:00:00 2001 From: Juan Batiz-Benet <juan@benet.ai> Date: Wed, 7 Jan 2015 07:06:59 -0800 Subject: [PATCH] moved sharness tests to a subdir. kept bin in place --- Makefile | 4 +- test/.gitignore | 3 -- test/Makefile | 50 ++++++------------- test/sharness/.gitignore | 3 ++ test/sharness/Makefile | 37 ++++++++++++++ test/{ => sharness}/README.md | 0 test/sharness/bin | 1 + test/{ => sharness}/lib/install-sharness.sh | 0 test/{ => sharness}/lib/random-dep.go | 0 .../lib/test-aggregate-results.sh | 0 test/{ => sharness}/lib/test-lib.sh | 0 test/{ => sharness}/t0010-basic-commands.sh | 0 test/{ => sharness}/t0020-init.sh | 0 test/{ => sharness}/t0030-mount.sh | 0 test/{ => sharness}/t0040-add-and-cat.sh | 0 test/{ => sharness}/t0050-block.sh | 0 test/{ => sharness}/t0060-daemon.sh | 0 17 files changed, 58 insertions(+), 40 deletions(-) create mode 100644 test/sharness/.gitignore create mode 100644 test/sharness/Makefile rename test/{ => sharness}/README.md (100%) create mode 120000 test/sharness/bin rename test/{ => sharness}/lib/install-sharness.sh (100%) rename test/{ => sharness}/lib/random-dep.go (100%) rename test/{ => sharness}/lib/test-aggregate-results.sh (100%) rename test/{ => sharness}/lib/test-lib.sh (100%) rename test/{ => sharness}/t0010-basic-commands.sh (100%) rename test/{ => sharness}/t0020-init.sh (100%) rename test/{ => sharness}/t0030-mount.sh (100%) rename test/{ => sharness}/t0040-add-and-cat.sh (100%) rename test/{ => sharness}/t0050-block.sh (100%) rename test/{ => sharness}/t0060-daemon.sh (100%) diff --git a/Makefile b/Makefile index 73bf497c4..73fbb5585 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 7c23cc5f7..4f89478ac 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 8cd48719d..58a45deff 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 000000000..5e59048ac --- /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 000000000..b314c6757 --- /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 000000000..19f285ac7 --- /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 -- GitLab