prusa3d / Prusa-Firmware-MMU

Other
32 stars 15 forks source link

Fix unit tests on windows #213

Closed DRracer closed 1 year ago

DRracer commented 1 year ago

Based on PR#210 from @gudnimg

Cherry picked just the necessary changes + reformatted the corresponding CMakeLists.txt (the reformat is insanely huge and hides the 2 really changed lines)

vintagepc commented 1 year ago

Probably also not a bad idea to specify the generated files as BYPRODUCTS so they get cleaned by a normal 'make clean' call as well.

DRracer commented 1 year ago

Probably also not a bad idea to specify the generated files as BYPRODUCTS so they get cleaned by a normal 'make clean' call as well.

please feel free to improve it further

gudnimg commented 1 year ago

Just to clarify what the issue was on Windows:

COMMAND env CTEST_OUTPUT_ON_FAILURE=1 ctest

The env command here doesn't exist on Windows. Instead we can utilise the built-in env that comes with CMake (cmake -E env). Then there is also an issue with ctest when its not in PATH. Using ${CMAKE_CTEST_COMMAND} eliminates that issue.

There is another issue with python3, I can create a separate PR for that. (Fixing this will prevent one unit test being skipped)