From 6cf36440972f9da44295af94110a2ee54079e434 Mon Sep 17 00:00:00 2001 From: NagyZoltanPeter <113987313+NagyZoltanPeter@users.noreply.github.com> Date: Fri, 29 Aug 2025 13:14:05 +0200 Subject: [PATCH] Fix using 'make test ', it was failing to run properly without specified test case (#3550) --- Makefile | 4 ++-- waku.nimble | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 4f15b45c0..f8d09c7ac 100644 --- a/Makefile +++ b/Makefile @@ -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 ## diff --git a/waku.nimble b/waku.nimble index 4eb2c8c08..ffda7b44b 100644 --- a/waku.nimble +++ b/waku.nimble @@ -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 =