kubo/test/sharness/Makefile
Tor Arne Vestbø 7b49419d93 Fix dependencies in sharness test makefile
Running make -jN would result in the tests starting to execute
before the tests binaries were built, resulting in the error:

 "Cannot find the tests' local ipfs tool"

Each test now depends on the deps. They also depend on a new
target for cleaning the test results, so that the tests can
write new clean results.

The aggregate target also needs to depend on the same test
results clean target, as well as the tests themselves, so
that the aggregation happens when all tests have finished
running.

By introducing a separate target for cleaning test results we
also ensure that we don't end up removing and rebuilding
the binary on each test run.

The result is that the tests *can* be run with with -jN > 1,
but individual tests may still not supports this, so to get
stable test results it's still recommended to run them in
sequence.
2015-04-07 21:21:58 +02:00

54 lines
1.1 KiB
Makefile

# 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/multihash bin/ipfs bin/pollEndpoint
SHARNESS = lib/sharness/sharness.sh
IPFS_ROOT = ../..
# User might want to override those on the command line
GOFLAGS =
all: aggregate
clean: clean-test-results
@echo "*** $@ ***"
-rm -rf bin/ipfs
clean-test-results:
@echo "*** $@ ***"
-rm -rf test-results
$(T): clean-test-results deps
@echo "*** $@ ***"
./$@
aggregate: clean-test-results $(T)
@echo "*** $@ ***"
lib/test-aggregate-results.sh
deps: $(SHARNESS) $(BINS) curl
$(SHARNESS):
@echo "*** installing $@ ***"
lib/install-sharness.sh
bin/%: FORCE
cd .. && make GOFLAGS=$(GOFLAGS) $@
race:
make GOFLAGS=-race all
.PHONY: all clean $(T) aggregate FORCE
# will fail if curl is not installed.
# TODO: get rid of this and install curl with git or ipfs.
install_curl_pls = "curl is required to run tests. please install it"
curl:
@which curl >/dev/null || (echo "$(install_curl_pls)" && false)