@cryptotaxi247 / kubo / commits / 2b5f1b2d8

Install sharness in a 'sharness' directory

It is cleaner if sharness is installed in its own directory.

Christian Couder committed Nov 8, 2014 at 00:34 UTC 2b5f1b2d8cc2de1f6293817f4d4ea2e4898ffbd9
5 files changed +19 -9
test/.gitignore
+1
@@ -1,2 +1,3 @@
1 +sharness/
2 test-results/
3 trash directory.*.sh/
test/Makefile
+9 -7
@@ -5,6 +5,7 @@
5 #
6
7 T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
8 +SHARNESS = sharness/sharness.sh
9
10 all: clean deps $(T) aggregate
11
@@ -20,21 +21,22 @@ aggregate:
21 @echo "*** $@ ***"
22 ./test-aggregate-results.sh
23
23 -deps: ipfs sharness.sh random
24 +deps: $(SHARNESS) ipfs random
25 +
26 +$(SHARNESS):
27 + @echo "*** installing $@ ***"
28 + ./install-sharness.sh
29
30 # phony to ensure we re-build it every time we run tests
31 ipfs:
32 + @echo "*** installing $@ ***"
33 cd ../cmd/ipfs && go build
34 cp ../cmd/ipfs/ipfs ipfs
35
30 -sharness.sh:
31 - @echo "*** installing $@ ***"
32 - ./install-sharness.sh
33 -
34 -.PHONY: all clean $(T) aggregate ipfs
35 -
36 random:
37 @echo "*** installing $@ ***"
38 go get github.com/jbenet/go-random/random
39 go install github.com/jbenet/go-random/random
40 cp `which random` random
41 +
42 +.PHONY: all clean $(T) aggregate ipfs random
test/install-sharness.sh
+7
@@ -16,6 +16,11 @@ shash=eeaf96630fc25ec58fb678b64ef9772d5eb92f64
16 afile=aggregate-results.sh
17 ahash=948d6bc03222c5c00a1ed048068508d5ea1cce59
18
19 +die() {
20 + echo >&2 $@
21 + exit 1
22 +}
23 +
24 verified_download() {
25 file=$1
26 hash1=$2
@@ -34,6 +39,8 @@ verified_download() {
39 return 0
40 }
41
42 +mkdir -p sharness || die "Could not create 'sharness' directory"
43 +cd sharness || die "Could not cd into 'sharness' directory"
44
45 verified_download "$sfile" "$shash"; sok=$?
46 verified_download "$afile" "$ahash"; aok=$?
test/test-aggregate-results.sh
+1 -1
@@ -6,7 +6,7 @@
6 # MIT Licensed; see the LICENSE file in this repository.
7 #
8
9 -SHARNESS_AGGREGATE="./aggregate-results.sh"
9 +SHARNESS_AGGREGATE="sharness/aggregate-results.sh"
10
11 test -f "$SHARNESS_AGGREGATE" || {
12 echo >&2 "Cannot find: $SHARNESS_AGGREGATE"
test/test-lib.sh
+1 -1
@@ -18,7 +18,7 @@ if test `which ipfs` != $(pwd)/ipfs; then
18 exit 1
19 fi
20
21 -SHARNESS_LIB="./sharness.sh"
21 +SHARNESS_LIB="sharness/sharness.sh"
22
23 . "$SHARNESS_LIB" || {
24 echo >&2 "Cannot source: $SHARNESS_LIB"