mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-29 09:34:03 +08:00
Merge pull request #278 from chriscool/install-sharness
Install sharness
This commit is contained in:
1
test/.gitignore
vendored
1
test/.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
|
sharness/
|
||||||
test-results/
|
test-results/
|
||||||
trash directory.*.sh/
|
trash directory.*.sh/
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
|
T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
|
||||||
|
SHARNESS = sharness/sharness.sh
|
||||||
|
|
||||||
all: clean deps $(T) aggregate
|
all: clean deps $(T) aggregate
|
||||||
|
|
||||||
@ -20,21 +21,22 @@ aggregate:
|
|||||||
@echo "*** $@ ***"
|
@echo "*** $@ ***"
|
||||||
./test-aggregate-results.sh
|
./test-aggregate-results.sh
|
||||||
|
|
||||||
deps: ipfs sharness.sh random
|
deps: $(SHARNESS) ipfs random
|
||||||
|
|
||||||
# phony to ensure we re-build it every time we run tests
|
$(SHARNESS):
|
||||||
ipfs:
|
|
||||||
cd ../cmd/ipfs && go build
|
|
||||||
cp ../cmd/ipfs/ipfs ipfs
|
|
||||||
|
|
||||||
sharness.sh:
|
|
||||||
@echo "*** installing $@ ***"
|
@echo "*** installing $@ ***"
|
||||||
./install-sharness.sh
|
./install-sharness.sh
|
||||||
|
|
||||||
.PHONY: all clean $(T) aggregate ipfs
|
# phony to ensure we re-build it every time we run tests
|
||||||
|
ipfs:
|
||||||
|
@echo "*** installing $@ ***"
|
||||||
|
cd ../cmd/ipfs && go build
|
||||||
|
cp ../cmd/ipfs/ipfs ipfs
|
||||||
|
|
||||||
random:
|
random:
|
||||||
@echo "*** installing $@ ***"
|
@echo "*** installing $@ ***"
|
||||||
go get github.com/jbenet/go-random/random
|
go get github.com/jbenet/go-random/random
|
||||||
go install github.com/jbenet/go-random/random
|
go install github.com/jbenet/go-random/random
|
||||||
cp `which random` random
|
cp `which random` random
|
||||||
|
|
||||||
|
.PHONY: all clean $(T) aggregate ipfs random
|
||||||
|
26
test/README.md
Normal file
26
test/README.md
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# ipfs whole tests using the [sharness framework](https://github.com/mlafeldt/sharness/)
|
||||||
|
|
||||||
|
## Running all the tests
|
||||||
|
|
||||||
|
Just use `make` in this directory to run all the tests.
|
||||||
|
|
||||||
|
## Running just one test
|
||||||
|
|
||||||
|
You can run only one test script by launching it like a regular shell
|
||||||
|
script:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ./t0010-basic-commands.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sharness
|
||||||
|
|
||||||
|
When running "make" in this directory for the first time, sharness
|
||||||
|
will be downloaded from its github repo and installed in a "sharness"
|
||||||
|
directory.
|
||||||
|
|
||||||
|
Please do not change anything in the "sharness" directory.
|
||||||
|
|
||||||
|
If you really need some changes in sharness, please fork it from
|
||||||
|
[its cannonical repo](https://github.com/mlafeldt/sharness/) and
|
||||||
|
send pull requests there.
|
@ -16,6 +16,11 @@ shash=eeaf96630fc25ec58fb678b64ef9772d5eb92f64
|
|||||||
afile=aggregate-results.sh
|
afile=aggregate-results.sh
|
||||||
ahash=948d6bc03222c5c00a1ed048068508d5ea1cce59
|
ahash=948d6bc03222c5c00a1ed048068508d5ea1cce59
|
||||||
|
|
||||||
|
die() {
|
||||||
|
echo >&2 $@
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
verified_download() {
|
verified_download() {
|
||||||
file=$1
|
file=$1
|
||||||
hash1=$2
|
hash1=$2
|
||||||
@ -34,6 +39,8 @@ verified_download() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mkdir -p sharness || die "Could not create 'sharness' directory"
|
||||||
|
cd sharness || die "Could not cd into 'sharness' directory"
|
||||||
|
|
||||||
verified_download "$sfile" "$shash"; sok=$?
|
verified_download "$sfile" "$shash"; sok=$?
|
||||||
verified_download "$afile" "$ahash"; aok=$?
|
verified_download "$afile" "$ahash"; aok=$?
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
# MIT Licensed; see the LICENSE file in this repository.
|
# MIT Licensed; see the LICENSE file in this repository.
|
||||||
#
|
#
|
||||||
|
|
||||||
SHARNESS_AGGREGATE="./aggregate-results.sh"
|
SHARNESS_AGGREGATE="sharness/aggregate-results.sh"
|
||||||
|
|
||||||
test -f "$SHARNESS_AGGREGATE" || {
|
test -f "$SHARNESS_AGGREGATE" || {
|
||||||
echo >&2 "Cannot find: $SHARNESS_AGGREGATE"
|
echo >&2 "Cannot find: $SHARNESS_AGGREGATE"
|
||||||
|
@ -18,7 +18,7 @@ if test `which ipfs` != $(pwd)/ipfs; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SHARNESS_LIB="./sharness.sh"
|
SHARNESS_LIB="sharness/sharness.sh"
|
||||||
|
|
||||||
. "$SHARNESS_LIB" || {
|
. "$SHARNESS_LIB" || {
|
||||||
echo >&2 "Cannot source: $SHARNESS_LIB"
|
echo >&2 "Cannot source: $SHARNESS_LIB"
|
||||||
|
Reference in New Issue
Block a user