diff --git a/Makefile b/Makefile index c24c63459..af76d8385 100644 --- a/Makefile +++ b/Makefile @@ -270,8 +270,8 @@ build/%: | $(NIMBLEDEPS_STAMP) build deps librln compile-test: | $(NIMBLEDEPS_STAMP) build deps librln echo -e $(BUILD_MSG) "$(TEST_FILE)" "\"$(TEST_NAME)\"" && \ - TEST_FILE="$(TEST_FILE)" nimble buildTest && \ - TEST_FILE="$(TEST_FILE)" TEST_NAME="$(TEST_NAME)" nimble execTest + nimble buildTest $(TEST_FILE) && \ + nimble execTest $(TEST_FILE) "\"$(TEST_NAME)\"" ################ ## Waku tools ## diff --git a/waku.nimble b/waku.nimble index 6ef8fcecf..a366142ea 100644 --- a/waku.nimble +++ b/waku.nimble @@ -80,7 +80,10 @@ proc getNimParams(): string = proc buildModule(filePath, params = "", lang = "c"): bool = if not dirExists "build": mkDir "build" + # allow something like "nim nimbus --verbosity:0 --hints:off nimbus.nims" var extra_params = params + for i in 2 ..< paramCount() - 1: + extra_params &= " " & paramStr(i) if not fileExists(filePath): echo "File to build not found: " & filePath @@ -444,21 +447,20 @@ task lightpushwithmix, "Build lightpushwithmix": buildBinary name, "examples/lightpush_mix/" task buildTest, "Test custom target": - let filepath = getEnv("TEST_FILE") - if filepath == "": - quit "Missing TEST_FILE environment variable" + let filepath = paramStr(paramCount()) discard buildModule(filepath) import std/strutils task execTest, "Run test": - let filepath = getEnv("TEST_FILE") - if filepath == "": - quit "Missing TEST_FILE environment variable" - var testSuite = getEnv("TEST_NAME").strip(chars = {'\"'}) + # 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) + var testSuite = paramStr(paramCount()).strip(chars = {'\"'}) if testSuite != "": testSuite = " \"" & testSuite & "\"" - exec "build/" & filepath & ".bin" & testSuite + exec "build/" & filepath & ".bin " & testSuite ### C Bindings let chroniclesParams =