@@ -56,17 +56,12 @@ proc sanFlags(san: string): string =
5656 of " none" , " " :
5757 " "
5858 of " asan-ubsan" :
59- " --passC:-fsanitize=address,undefined" &
60- " --passC:-fno-sanitize-recover=all" &
61- " --passC:-fno-omit-frame-pointer" &
62- " --passC:-g" &
63- " --passL:-fsanitize=address,undefined"
59+ " --passC:-fsanitize=address,undefined" & " --passC:-fno-sanitize-recover=all" &
60+ " --passC:-fno-omit-frame-pointer" & " --passC:-g" &
61+ " --passL:-fsanitize=address,undefined"
6462 of " tsan" :
65- " --passC:-fsanitize=thread" &
66- " --passC:-fno-omit-frame-pointer" &
67- " --passC:-g" &
68- " --passC:-O1" &
69- " --passL:-fsanitize=thread"
63+ " --passC:-fsanitize=thread" & " --passC:-fno-omit-frame-pointer" & " --passC:-g" &
64+ " --passC:-O1" & " --passL:-fsanitize=thread"
7065 else :
7166 raise newException (ValueError , " unknown NIM_FFI_SAN: " & san)
7267
@@ -95,17 +90,24 @@ task test_cpp_e2e, "Build and run the C++ end-to-end tests for the timer example
9590 runOrQuit " nimble genbindings_cpp"
9691 runOrQuit " nimble genbindings_cpp_echo"
9792 runOrQuit " cmake -S tests/e2e/cpp -B tests/e2e/cpp/build"
98- runOrQuit " cmake --build tests/e2e/cpp/build"
99- runOrQuit " ctest --test-dir tests/e2e/cpp/build --output-on-failure"
100-
101- task test_sanitized, " Run all unit tests under a sanitizer (NIM_FFI_SAN) and mm (NIM_FFI_MM)" :
93+ runOrQuit " cmake --build tests/e2e/cpp/build --config Debug"
94+ # `-C Debug` is required on Windows multi-config generators because
95+ # gtest_discover_tests(PRE_TEST) loads per-config include files; harmless on
96+ # single-config generators (Make/Ninja) on Linux/macOS.
97+ runOrQuit " ctest --test-dir tests/e2e/cpp/build --output-on-failure -C Debug"
98+
99+ task test_sanitized,
100+ " Run all unit tests under a sanitizer (NIM_FFI_SAN) and mm (NIM_FFI_MM)" :
102101 let san = getEnv (" NIM_FFI_SAN" , " none" )
103- let mm = getEnv (" NIM_FFI_MM" , " " )
102+ let mm = getEnv (" NIM_FFI_MM" , " " )
104103 let extra = sanFlags (san)
105104 let modes =
106- if mm == " orc" : @ [nimFlagsOrc]
107- elif mm == " refc" : @ [nimFlagsRefc]
108- else : @ [nimFlagsOrc, nimFlagsRefc]
105+ if mm == " orc" :
106+ @ [nimFlagsOrc]
107+ elif mm == " refc" :
108+ @ [nimFlagsRefc]
109+ else :
110+ @ [nimFlagsOrc, nimFlagsRefc]
109111 if san == " tsan" :
110112 let suppPath = thisDir () & " /tsan.supp"
111113 let existing = getEnv (" TSAN_OPTIONS" )
@@ -117,82 +119,67 @@ task test_sanitized, "Run all unit tests under a sanitizer (NIM_FFI_SAN) and mm
117119 for t in unitTests:
118120 exec " nim c -r " & flags & extra & " tests/unit/" & t & " .nim"
119121
120- task test_cpp_e2e_sanitized, " Build and run the C++ e2e tests with a sanitizer (NIM_FFI_SAN) and mm (NIM_FFI_MM)" :
121- let mm = getEnv (" NIM_FFI_MM" , " orc" )
122+ task test_cpp_e2e_sanitized,
123+ " Build and run the C++ e2e tests with a sanitizer (NIM_FFI_SAN) and mm (NIM_FFI_MM)" :
124+ let mm = getEnv (" NIM_FFI_MM" , " orc" )
122125 let san = getEnv (" NIM_FFI_SAN" , " none" )
123126 runOrQuit " nimble genbindings_cpp"
124127 runOrQuit " nimble genbindings_cpp_echo"
125- runOrQuit " cmake -S tests/e2e/cpp -B tests/e2e/cpp/build" &
126- " -DNIM_FFI_MM=" & mm &
127- " -DNIM_FFI_SANITIZER=" & san
128- runOrQuit " cmake --build tests/e2e/cpp/build -j"
129- runOrQuit " ctest --test-dir tests/e2e/cpp/build --output-on-failure"
128+ runOrQuit " cmake -S tests/e2e/cpp -B tests/e2e/cpp/build" & " -DNIM_FFI_MM=" & mm &
129+ " -DNIM_FFI_SANITIZER=" & san
130+ runOrQuit " cmake --build tests/e2e/cpp/build --config Debug -j"
131+ runOrQuit " ctest --test-dir tests/e2e/cpp/build --output-on-failure -C Debug"
130132
131133task genbindings_example, " Generate Rust bindings for the timer example" :
132- exec " nim c " & nimFlagsOrc & " --app:lib --noMain --nimMainPrefix:libmy_timer -d:ffiGenBindings -o:/dev/null examples/timer/timer.nim"
133- exec " nim c " & nimFlagsRefc & " --app:lib --noMain --nimMainPrefix:libmy_timer -d:ffiGenBindings -o:/dev/null examples/timer/timer.nim"
134+ exec " nim c " & nimFlagsOrc &
135+ " --app:lib --noMain --nimMainPrefix:libmy_timer -d:ffiGenBindings -o:/dev/null examples/timer/timer.nim"
136+ exec " nim c " & nimFlagsRefc &
137+ " --app:lib --noMain --nimMainPrefix:libmy_timer -d:ffiGenBindings -o:/dev/null examples/timer/timer.nim"
134138
135139task genbindings_rust, " Generate Rust bindings for the timer example" :
136- exec " nim c " & nimFlagsOrc &
137- " --app:lib --noMain --nimMainPrefix:libmy_timer" &
140+ exec " nim c " & nimFlagsOrc & " --app:lib --noMain --nimMainPrefix:libmy_timer" &
138141 " -d:ffiGenBindings -d:targetLang=rust" &
139- " -d:ffiOutputDir=examples/timer/rust_bindings" &
140- " -d:ffiSrcPath=../timer.nim" &
142+ " -d:ffiOutputDir=examples/timer/rust_bindings" & " -d:ffiSrcPath=../timer.nim" &
141143 " -o:/dev/null examples/timer/timer.nim"
142- exec " nim c " & nimFlagsRefc &
143- " --app:lib --noMain --nimMainPrefix:libmy_timer" &
144+ exec " nim c " & nimFlagsRefc & " --app:lib --noMain --nimMainPrefix:libmy_timer" &
144145 " -d:ffiGenBindings -d:targetLang=rust" &
145- " -d:ffiOutputDir=examples/timer/rust_bindings" &
146- " -d:ffiSrcPath=../timer.nim" &
146+ " -d:ffiOutputDir=examples/timer/rust_bindings" & " -d:ffiSrcPath=../timer.nim" &
147147 " -o:/dev/null examples/timer/timer.nim"
148148
149149task genbindings_cddl, " Generate CDDL schema for the timer example" :
150- exec " nim c " & nimFlagsOrc &
151- " --app:lib --noMain --nimMainPrefix:libtimer" &
150+ exec " nim c " & nimFlagsOrc & " --app:lib --noMain --nimMainPrefix:libtimer" &
152151 " -d:ffiGenBindings -d:targetLang=cddl" &
153- " -d:ffiOutputDir=examples/timer/cddl_bindings" &
154- " -d:ffiSrcPath=../timer.nim" &
152+ " -d:ffiOutputDir=examples/timer/cddl_bindings" & " -d:ffiSrcPath=../timer.nim" &
155153 " -o:/dev/null examples/timer/timer.nim"
156154
157155task genbindings_cpp, " Generate C++ bindings for the timer example" :
158- exec " nim c " & nimFlagsOrc &
159- " --app:lib --noMain --nimMainPrefix:libmy_timer" &
156+ exec " nim c " & nimFlagsOrc & " --app:lib --noMain --nimMainPrefix:libmy_timer" &
160157 " -d:ffiGenBindings -d:targetLang=cpp" &
161- " -d:ffiOutputDir=examples/timer/cpp_bindings" &
162- " -d:ffiSrcPath=../timer.nim" &
158+ " -d:ffiOutputDir=examples/timer/cpp_bindings" & " -d:ffiSrcPath=../timer.nim" &
163159 " -o:/dev/null examples/timer/timer.nim"
164- exec " nim c " & nimFlagsRefc &
165- " --app:lib --noMain --nimMainPrefix:libmy_timer" &
160+ exec " nim c " & nimFlagsRefc & " --app:lib --noMain --nimMainPrefix:libmy_timer" &
166161 " -d:ffiGenBindings -d:targetLang=cpp" &
167- " -d:ffiOutputDir=examples/timer/cpp_bindings" &
168- " -d:ffiSrcPath=../timer.nim" &
162+ " -d:ffiOutputDir=examples/timer/cpp_bindings" & " -d:ffiSrcPath=../timer.nim" &
169163 " -o:/dev/null examples/timer/timer.nim"
170164
171165task genbindings_cpp_echo, " Generate C++ bindings for the echo example" :
172- exec " nim c " & nimFlagsOrc &
173- " --app:lib --noMain --nimMainPrefix:libecho" &
166+ exec " nim c " & nimFlagsOrc & " --app:lib --noMain --nimMainPrefix:libecho" &
174167 " -d:ffiGenBindings -d:targetLang=cpp" &
175- " -d:ffiOutputDir=examples/echo/cpp_bindings" &
176- " -d:ffiSrcPath=../echo.nim" &
168+ " -d:ffiOutputDir=examples/echo/cpp_bindings" & " -d:ffiSrcPath=../echo.nim" &
177169 " -o:/dev/null examples/echo/echo.nim"
178- exec " nim c " & nimFlagsRefc &
179- " --app:lib --noMain --nimMainPrefix:libecho" &
170+ exec " nim c " & nimFlagsRefc & " --app:lib --noMain --nimMainPrefix:libecho" &
180171 " -d:ffiGenBindings -d:targetLang=cpp" &
181- " -d:ffiOutputDir=examples/echo/cpp_bindings" &
182- " -d:ffiSrcPath=../echo.nim" &
172+ " -d:ffiOutputDir=examples/echo/cpp_bindings" & " -d:ffiSrcPath=../echo.nim" &
183173 " -o:/dev/null examples/echo/echo.nim"
184174
185175task check_bindings_rust, " Verify checked-in Rust bindings match Nim source" :
186176 exec " nimble genbindings_rust"
187- exec " git diff --exit-code --" &
188- " examples/timer/rust_bindings/Cargo.toml" &
189- " examples/timer/rust_bindings/build.rs" &
190- " examples/timer/rust_bindings/src"
177+ exec " git diff --exit-code --" & " examples/timer/rust_bindings/Cargo.toml" &
178+ " examples/timer/rust_bindings/build.rs" & " examples/timer/rust_bindings/src"
191179
192180task check_bindings_cpp, " Verify checked-in C++ bindings match Nim source" :
193181 exec " nimble genbindings_cpp"
194- exec " git diff --exit-code --" &
195- " examples/timer/cpp_bindings/my_timer.hpp" &
182+ exec " git diff --exit-code --" & " examples/timer/cpp_bindings/my_timer.hpp" &
196183 " examples/timer/cpp_bindings/CMakeLists.txt"
197184
198185task check_bindings, " Verify all checked-in example bindings match Nim source" :
0 commit comments