fix: make test configuration (#3480)

This commit is contained in:
Darshan K 2025-07-08 18:25:36 +05:30 committed by GitHub
parent c3991dbbc1
commit a0f8cb8297
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 28 additions and 13 deletions

View File

@ -119,12 +119,13 @@ jobs:
sudo docker run --rm -d -e POSTGRES_PASSWORD=test123 -p 5432:5432 postgres:15.4-alpine3.18
postgres_enabled=1
fi
export MAKEFLAGS="-j1"
export NIMFLAGS="--colors:off -d:chronicles_colors:none"
export USE_LIBBACKTRACE=0
make V=1 LOG_LEVEL=DEBUG QUICK_AND_DIRTY_COMPILER=1 POSTGRES=$postgres_enabled test testwakunode2
make V=1 LOG_LEVEL=DEBUG QUICK_AND_DIRTY_COMPILER=1 POSTGRES=$postgres_enabled test
make V=1 LOG_LEVEL=DEBUG QUICK_AND_DIRTY_COMPILER=1 POSTGRES=$postgres_enabled testwakunode2
build-docker-image:
needs: changes

View File

@ -53,7 +53,19 @@ endif
# default target, because it's the first one that doesn't start with '.'
all: | wakunode2 example2 chat2 chat2bridge libwaku
test: | testcommon testwaku
TEST_FILE := $(word 2,$(MAKECMDGOALS))
TEST_NAME := $(wordlist 3,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
test:
ifeq ($(strip $(TEST_FILE)),)
$(MAKE) testcommon
$(MAKE) testwaku
else
$(MAKE) compile-test $(TEST_FILE) $(TEST_NAME)
endif
# this prevents make from erroring on unknown targets like "Index"
%:
@true
waku.nims:
ln -s waku.nimble $@
@ -244,9 +256,10 @@ build/%: | build deps librln
echo -e $(BUILD_MSG) "build/$*" && \
$(ENV_SCRIPT) nim buildone $(NIM_PARAMS) waku.nims $*
test/%: | build deps librln
echo -e $(BUILD_MSG) "test/$*" && \
$(ENV_SCRIPT) nim testone $(NIM_PARAMS) waku.nims $*
compile-test: | build deps librln
echo -e $(BUILD_MSG) "$(TEST_FILE)" && \
$(ENV_SCRIPT) nim buildTest $(NIM_PARAMS) waku.nims $(TEST_FILE) && \
$(ENV_SCRIPT) nim execTest $(NIM_PARAMS) waku.nims $(TEST_FILE) "$(TEST_NAME)"
################
## Waku tools ##

View File

@ -38,7 +38,8 @@ when os == "Linux" and
#./waku_archive_legacy/test_driver_postgres_query,
#./waku_archive_legacy/test_driver_postgres,
./factory/test_node_factory,
./wakunode_rest/test_rest_store
./wakunode_rest/test_rest_store,
./wakunode_rest/test_all
# Waku store test suite
import
@ -91,9 +92,6 @@ import
# Waku Keystore test suite
import ./test_waku_keystore_keyfile, ./test_waku_keystore
## Wakunode Rest API test suite
import ./wakunode_rest/test_all
import ./waku_rln_relay/test_all
# Node Factory

View File

@ -161,10 +161,13 @@ task buildone, "Build custom target":
let filepath = paramStr(paramCount())
discard buildModule filepath
task testone, "Test custom target":
task buildTest, "Test custom target":
let filepath = paramStr(paramCount())
if buildModule(filepath):
exec "build/" & filepath & ".bin"
discard buildModule(filepath)
task execTest, "Run test":
let filepath = paramStr(paramCount() - 1)
exec "build/" & filepath & ".bin" & " test \"" & paramStr(paramCount()) & "\""
### C Bindings
let chroniclesParams =