Skip to content

Commit

Permalink
Launch Fluffy builds directly from make to avoid compile issue (#1646)
Browse files Browse the repository at this point in the history
* Launch Fluffy builds directly from make to avoid compile issue

Without this change, builds on latest macos fails when ulimit is
not set to 1024. But it will still cause libbacktrace error to occur
when launching the binaries so it would be still advised to
set it to 1024.

* Fix fluffy local testnet for some macOS systems

And some additional improvements to the script + run the fluffy
nodes at INFO log-level to speed-up the testing time.

* Split up fluffy tests in separate targets

This way the two test binaries can be build and ran
concurrently.
  • Loading branch information
kdeme committed Jul 21, 2023
1 parent 3aff8d0 commit edc87b7
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ nimcache

/all_test.md

# local testnet files
/local_testnet_data

# Nimble user files
nimble.develop
nimble.paths
Expand Down
24 changes: 17 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ test-reproducibility:
# builds the fluffy client
fluffy: | build deps
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim fluffy $(NIM_PARAMS) nimbus.nims
$(ENV_SCRIPT) nim c $(NIM_PARAMS) -d:chronicles_log_level=TRACE -o:build/$@ "fluffy/$@.nim"

# primitive reproducibility test
fluffy-test-reproducibility:
Expand All @@ -233,9 +233,18 @@ fluffy-test-reproducibility:
[ "$$MD5SUM1" = "$$MD5SUM2" ] && echo -e "\e[92mSuccess: identical binaries.\e[39m" || \
{ echo -e "\e[91mFailure: the binary changed between builds.\e[39m"; exit 1; }

# fluffy tests
all_fluffy_portal_spec_tests: | build deps
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim c -r $(NIM_PARAMS) -d:chronicles_log_level=ERROR -d:nimbus_db_backend=sqlite -o:build/$@ "fluffy/tests/portal_spec_tests/mainnet/$@.nim"


all_fluffy_tests: | build deps
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim c -r $(NIM_PARAMS) -d:chronicles_log_level=ERROR -d:nimbus_db_backend=sqlite -d:mergeBlockNumber:38130 -o:build/$@ "fluffy/tests/$@.nim"

# builds and runs the fluffy test suite
fluffy-test: | build deps
$(ENV_SCRIPT) nim fluffy_test $(NIM_PARAMS) nimbus.nims
fluffy-test: | all_fluffy_portal_spec_tests all_fluffy_tests

# builds the fluffy tools, wherever they are
$(FLUFFY_TOOLS): | build deps
Expand All @@ -246,6 +255,11 @@ $(FLUFFY_TOOLS): | build deps
# builds all the fluffy tools
fluffy-tools: | $(FLUFFY_TOOLS)

# Build fluffy test_portal_testnet
test_portal_testnet: | build deps
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim c $(NIM_PARAMS) -o:build/$@ "fluffy/scripts/$@.nim"

# builds the uTP test app
utp-test-app: | build deps
$(ENV_SCRIPT) nim utp_test_app $(NIM_PARAMS) nimbus.nims
Expand All @@ -254,10 +268,6 @@ utp-test-app: | build deps
utp-test: | build deps
$(ENV_SCRIPT) nim utp_test $(NIM_PARAMS) nimbus.nims

# Build fluffy test_portal_testnet
fluffy-test-portal-testnet: | build deps
$(ENV_SCRIPT) nim fluffy_test_portal_testnet $(NIM_PARAMS) nimbus.nims

# Nimbus Verified Proxy related targets

# Builds the nimbus_verified_proxy
Expand Down
12 changes: 6 additions & 6 deletions fluffy/scripts/launch_local_testnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cd "$(dirname "${BASH_SOURCE[0]}")"/../..
GETOPT_BINARY="getopt"
if uname | grep -qi darwin; then
# macOS
GETOPT_BINARY="/usr/local/opt/gnu-getopt/bin/getopt"
GETOPT_BINARY=$(find /opt/homebrew/opt/gnu-getopt/bin/getopt /usr/local/opt/gnu-getopt/bin/getopt 2> /dev/null | head -n1 || true)
[[ -f "$GETOPT_BINARY" ]] || { echo "GNU getopt not installed. Please run 'brew install gnu-getopt'. Aborting."; exit 1; }
fi

Expand All @@ -40,10 +40,10 @@ LONGOPTS="help,nodes:,data-dir:,enable-htop,log-level:,base-port:,base-rpc-port:
NUM_NODES="64"
DATA_DIR="local_testnet_data"
USE_HTOP="0"
LOG_LEVEL="TRACE"
LOG_LEVEL="INFO"
BASE_PORT="9000"
BASE_METRICS_PORT="8008"
BASE_RPC_PORT="7000"
BASE_RPC_PORT="10000"
REUSE_EXISTING_DATA_DIR="0"
TIMEOUT_DURATION="0"
KILL_OLD_PROCESSES="0"
Expand Down Expand Up @@ -183,9 +183,9 @@ fi

# Build the binaries
BINARIES="fluffy"
TEST_BINARIES="fluffy-test-portal-testnet"
$MAKE -j ${NPROC} LOG_LEVEL=TRACE ${BINARIES} NIMFLAGS="-d:chronicles_colors=off -d:chronicles_sinks=textlines"
$MAKE -j ${NPROC} LOG_LEVEL=INFO ${TEST_BINARIES} NIMFLAGS="-d:chronicles_sinks=textlines"
TEST_BINARIES="test_portal_testnet"
$MAKE -j ${NPROC} LOG_LEVEL=TRACE ${BINARIES}
$MAKE -j ${NPROC} LOG_LEVEL=INFO ${TEST_BINARIES}

# Kill child processes on Ctrl-C/SIGTERM/exit, passing the PID of this shell
# instance as the parent and the target process name as a pattern to the
Expand Down
1 change: 1 addition & 0 deletions fluffy/scripts/nim.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-d:unittest2DisableParamFiltering
2 changes: 1 addition & 1 deletion fluffy/scripts/test_portal_testnet.nim
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type
name: "rpc-address" }: string

baseRpcPort* {.
defaultValue: 7000
defaultValue: 10000
desc: "Port of the JSON-RPC service of the bootstrap (first) node"
name: "base-rpc-port" .}: uint16

Expand Down
2 changes: 1 addition & 1 deletion nimbus.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ task utp_test_app, "Build uTP test app":
task utp_test, "Run uTP integration tests":
test "fluffy/tools/utp_testing", "utp_test", "-d:chronicles_log_level=ERROR -d:chronosStrictException"

task fluffy_test_portal_testnet, "Build test_portal_testnet":
task test_portal_testnet, "Build test_portal_testnet":
buildBinary "test_portal_testnet", "fluffy/scripts/", "-d:chronicles_log_level=DEBUG -d:unittest2DisableParamFiltering"

## Nimbus Verified Proxy tasks
Expand Down

0 comments on commit edc87b7

Please sign in to comment.