Trying to add_test using cmd.exe
Using cmake version 3.8.1 The following really short CMakeLists.txt file should add a single test that runs cmd /?. As running the help returns failure it should fail and with the --output-on-failure option you can see the output.
enable_testing() add_test(NAME Test COMMAND cmd /? WORKING_DIRECTORY ".")
executing the test:
cmake . && ctest -C Debug --output-on-failure
The result is surprising:
Start 1: Test 1/1 Test #1: Test .............................***Failed 0.02 sec Creates a directory. MKDIR [drive:]path MD [drive:]path If Command Extensions are enabled MKDIR changes as follows: MKDIR creates any intermediate directories in the path, if needed. For example, assume \a does not exist then: mkdir \a\b\c\d is the same as: mkdir \a chdir \a mkdir b chdir b mkdir c chdir c mkdir d which is what you would have to type if extensions were disabled. 0% tests passed, 1 tests failed out of 1 Total Test time (real) = 0.03 sec The following tests FAILED: 1 - Test (Failed) Errors while running CTest
Which is the help for the
md command. And indeed the
md instead of
It somehow omits the first character of the command. It doesn't do that with other commands though.