Fix using 'make test <nim source file>', it was failing to run properly without specified test case (#3550)

This commit is contained in:
NagyZoltanPeter 2025-08-29 13:14:05 +02:00 committed by GitHub
parent 228e637c9f
commit 6cf3644097
2 changed files with 11 additions and 3 deletions

View File

@ -257,9 +257,9 @@ build/%: | build deps librln
$(ENV_SCRIPT) nim buildone $(NIM_PARAMS) waku.nims $*
compile-test: | build deps librln
echo -e $(BUILD_MSG) "$(TEST_FILE)" && \
echo -e $(BUILD_MSG) "$(TEST_FILE)" "\"$(TEST_NAME)\"" && \
$(ENV_SCRIPT) nim buildTest $(NIM_PARAMS) waku.nims $(TEST_FILE) && \
$(ENV_SCRIPT) nim execTest $(NIM_PARAMS) waku.nims $(TEST_FILE) "$(TEST_NAME)"
$(ENV_SCRIPT) nim execTest $(NIM_PARAMS) waku.nims $(TEST_FILE) "\"$(TEST_NAME)\""; \
################
## Waku tools ##

View File

@ -165,9 +165,17 @@ task buildTest, "Test custom target":
let filepath = paramStr(paramCount())
discard buildModule(filepath)
import std/strutils
task execTest, "Run test":
# Expects to be parameterized with test case name in quotes
# preceded with the nim source file name and path
# If no test case name is given still it requires empty quotes `""`
let filepath = paramStr(paramCount() - 1)
exec "build/" & filepath & ".bin" & " test \"" & paramStr(paramCount()) & "\""
var testSuite = paramStr(paramCount()).strip(chars = {'\"'})
if testSuite != "":
testSuite = " \"" & testSuite & "\""
exec "build/" & filepath & ".bin " & testSuite
### C Bindings
let chroniclesParams =