From 12d18a1fd69229808ed899dea4655ab4d0221a22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=98tefan=20Talpalaru?= Date: Tue, 26 Feb 2019 23:13:31 +0100 Subject: [PATCH] build p2pd and run some client tests (with `make V=0 test-libp2p-daemon`) --- .gitignore | 4 ++++ .gitmodules | 10 ++++++++++ Makefile | 19 ++++++++++++++----- env.sh | 5 ++++- .../go/src/github.com/libp2p/go-libp2p-daemon | 1 + vendor/nim-libp2p | 1 + 6 files changed, 34 insertions(+), 6 deletions(-) create mode 160000 vendor/go/src/github.com/libp2p/go-libp2p-daemon create mode 160000 vendor/nim-libp2p diff --git a/.gitignore b/.gitignore index da69be96c..05748331d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,10 @@ # Nimble packages /vendor/.nimble +# Go packages +/vendor/go +!/vendor/go/src/github.com/libp2p/go-libp2p-daemon + # ntags/ctags output /tags diff --git a/.gitmodules b/.gitmodules index bdf6f809f..1fed6835e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -123,3 +123,13 @@ url = https://github.com/OpenSystemsLab/tempfile.nim.git ignore = dirty branch = master +[submodule "vendor/go/src/github.com/libp2p/go-libp2p-daemon"] + path = vendor/go/src/github.com/libp2p/go-libp2p-daemon + url = https://github.com/libp2p/go-libp2p-daemon.git + ignore = dirty + branch = master +[submodule "vendor/nim-libp2p"] + path = vendor/nim-libp2p + url = https://github.com/status-im/nim-libp2p.git + ignore = dirty + branch = master diff --git a/Makefile b/Makefile index 498f2710d..bed4752d0 100644 --- a/Makefile +++ b/Makefile @@ -137,7 +137,7 @@ test-reproducibility: # usual cleaning clean: - rm -rf build/{nimbus,premix,persist,debug,dumper,hunter,all_tests,beacon_node,validator_keygen,*.exe} \ + rm -rf build/{nimbus,premix,persist,debug,dumper,hunter,all_tests,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 @@ -172,10 +172,6 @@ status: | $(REPOS) $(eval CMD := $(GIT_STATUS)) $(RUN_CMD_IN_ALL_REPOS) -# https://bitbucket.org/nimcontrib/ntags/ - currently fails with "out of memory" -ntags: - ntags -R . - #- actually binaries, but have them as phony targets to force rebuilds beacon_node validator_keygen: | build deps $(ENV_SCRIPT) nim c $(NIM_PARAMS) -o:build/$@ $(REPOS_DIR)/nim-beacon-chain/beacon_chain/$@.nim @@ -186,6 +182,19 @@ clean_eth2_network_simulation_files: eth2_network_simulation: | beacon_node validator_keygen clean_eth2_network_simulation_files SKIP_BUILDS=1 $(ENV_SCRIPT) $(REPOS_DIR)/nim-beacon-chain/tests/simulation/start.sh +vendor/go/bin/p2pd: + cd vendor/go/src/github.com/libp2p/go-libp2p-daemon && \ + $(ENV_SCRIPT) $(MAKE) + +test-libp2p-daemon: | vendor/go/bin/p2pd deps + cd vendor/nim-libp2p && \ + $(ENV_SCRIPT) nim c -r $(NIM_PARAMS) tests/testdaemon.nim && \ + rm -f tests/testdaemon + +# https://bitbucket.org/nimcontrib/ntags/ - currently fails with "out of memory" +ntags: + ntags -R . + #- a few files need to be excluded because they trigger an infinite loop in https://github.com/universal-ctags/ctags #- limiting it to Nim files, because there are a lot of C files we don't care about ctags: diff --git a/env.sh b/env.sh index ef2e47058..c758da828 100755 --- a/env.sh +++ b/env.sh @@ -7,8 +7,11 @@ uname | grep -qi mingw && PWD_CMD="pwd -W" rel_path="$(dirname $0)" abs_path="$(cd $rel_path; ${PWD_CMD})" +# used by libp2p/go-libp2p-daemon +export GOPATH="${abs_path}/vendor/go" + # make it an absolute path, so we can call this script from other dirs -export PATH="${abs_path}/vendor/Nim/bin:$PATH" +export PATH="${abs_path}/vendor/Nim/bin:${GOPATH}/bin:${PATH}" # Nimble needs this to be an absolute path export NIMBLE_DIR="${abs_path}/vendor/.nimble" diff --git a/vendor/go/src/github.com/libp2p/go-libp2p-daemon b/vendor/go/src/github.com/libp2p/go-libp2p-daemon new file mode 160000 index 000000000..de7ca070e --- /dev/null +++ b/vendor/go/src/github.com/libp2p/go-libp2p-daemon @@ -0,0 +1 @@ +Subproject commit de7ca070e6f487655d787d82d819e70ca96ada2d diff --git a/vendor/nim-libp2p b/vendor/nim-libp2p new file mode 160000 index 000000000..cb334cc8a --- /dev/null +++ b/vendor/nim-libp2p @@ -0,0 +1 @@ +Subproject commit cb334cc8ab186496d8b73d5a2fe1b6298598b7f6