testsuite: build the tools in parallel

This commit is contained in:
Ștefan Talpalaru 2019-02-28 00:07:23 +01:00
parent d2b95c8191
commit 4326d98434
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
2 changed files with 23 additions and 22 deletions

View File

@ -81,17 +81,27 @@ else
MD5SUM := md5sum
endif
.PHONY: all premix persist debug dumper hunter regress deps github-ssh build-nim update status ntags ctags nimbus test clean mrproper fetch-dlls beacon_node validator_keygen clean_eth2_network_simulation_files eth2_network_simulation test-libp2p-daemon
# guess who does parsing before variable expansion
COMMA := ,
EMPTY :=
SPACE := $(EMPTY) $(EMPTY)
# debugging tools + testing tools
TOOLS := premix persist debug dumper hunter regress tracerTestGen persistBlockTestGen
# comma-separated values for the "clean" target
TOOLS_CSV := $(subst $(SPACE),$(COMMA),$(TOOLS))
.PHONY: all $(TOOLS) deps github-ssh build-nim update status ntags ctags nimbus testsuite test clean mrproper fetch-dlls beacon_node validator_keygen clean_eth2_network_simulation_files eth2_network_simulation test-libp2p-daemon
# default target, because it's the first one that doesn't start with '.'
all: premix persist debug dumper hunter regress nimbus
all: $(TOOLS) nimbus
# debugging tools
premix persist debug dumper hunter regress: | build deps
$(ENV_SCRIPT) nim c $(NIM_PARAMS) -o:build/$@ premix/$@.nim && \
# builds the tools, wherever they are
$(TOOLS): | build deps
for D in premix tests; do [ -e "$${D}/$@.nim" ] && TOOL_DIR="$${D}" && break; done && \
$(ENV_SCRIPT) nim c $(NIM_PARAMS) -o:build/$@ "$${TOOL_DIR}/$@.nim" && \
echo -e "\nThe binary is in './build/$@'.\n"
#- a phony target, because teaching `make` how to do conditional recompilation of Nim projects is too complicated
# a phony target, because teaching `make` how to do conditional recompilation of Nim projects is too complicated
nimbus: | build deps
$(ENV_SCRIPT) nim nimbus $(NIM_PARAMS) nimbus.nims && \
echo -e "\nThe binary is in './build/nimbus'.\n"
@ -121,10 +131,14 @@ $(NIMBLE_DIR): | $(NIM_BINARY)
nimbus.nims:
ln -s nimbus.nimble $@
# builds and runs all tests
test: | build deps
# builds and runs the testsuite
testsuite: | build deps
$(ENV_SCRIPT) nim test $(NIM_PARAMS) nimbus.nims
#- builds the tools, to make sure they're still compilable
#- builds and runs all tests
test: | $(TOOLS) testsuite
# primitive reproducibility test
test-reproducibility:
+ [ -e build/nimbus ] || $(MAKE) V=0 nimbus; \
@ -137,7 +151,7 @@ test-reproducibility:
# usual cleaning
clean:
rm -rf build/{nimbus,premix,persist,debug,dumper,hunter,regress,all_tests,beacon_node,validator_keygen,*.exe} vendor/go/bin \
rm -rf build/{nimbus,$(TOOLS_CSV),all_tests,test_rpc,beacon_node,validator_keygen,*.exe} vendor/go/bin \
$(NIMBLE_DIR) $(NIM_BINARY) $(NIM_DIR)/nimcache nimcache
# dangerous cleaning, because you may have not-yet-pushed branches and commits in those vendor repos you're about to delete

View File

@ -32,19 +32,6 @@ proc test(name: string, lang = "c") =
buildBinary name, "tests/", "-r -d:chronicles_log_level=ERROR"
task test, "Run tests":
# debugging tools don't have tests yet, but they should be compilable
for binary in [
"premix/premix",
"premix/persist",
"premix/debug",
"premix/dumper",
"premix/hunter",
"premix/regress",
"tests/tracerTestGen",
"tests/persistBlockTestGen",
]:
exec "nim c --verbosity:0 --hints:off --warnings:off " & binary
rmFile binary
test "all_tests"
test "test_rpc"