Re: [CMake] Problem setting ENVIRONMENT for ctest
What version of cmake/ctest are you using? (i.e. -- send the output of cmake --version) What does CTestTestfile.cmake contain if you change your CMakeLists file to use set_property(TEST ...) instead of set_tests_properties()? This should work as expected in CMake. We have a test in the test suite that tests the ENVIRONMENT test property at CMake/Tests/Environment/CMakeLists.txt -- the test uses set_tests_properties. ??? David On Fri, Dec 3, 2010 at 12:37 PM, Johannes Wienke jwie...@techfak.uni-bielefeld.de wrote: Dear all, I am try to set the PATH environment variable on windows for running the unit tests through ctest. The ctest file is generated by the cmake scripts. The PATH is required to for finding additional dlls required by the tests. I tried to set the PATH using this cmake code: SET(PATH_STRING $ENV{PATH};${Boost_LIBRARY_DIRS}) STRING(REPLACE ; \\; PATH_STRING ${PATH_STRING}) SET_TESTS_PROPERTIES(rsbtest PROPERTIES ENVIRONMENT PATH=${PATH_STRING}) This is done according to this list posting some time ago: http://www.cmake.org/pipermail/cmake/2009-May/029464.html However, it does not work for me. PATH is not changed when calling ctest and the dlls are not found. I investigated a bit and found out that the resulting CTestTestfile.cmake file contains these lines for every specified test: ADD_TEST(rsbtest correct binary) SET_TESTS_PROPERTIES(rsbtest PROPERTIES ENVIRONMENT PATH=correct path with correct escapes) However, man ctest does not even document that SET_TESTS_PROPERTIES is a valid command for ctest. Instead SET_PROPERTY(TEST...) is explained. So I changed the generated CTestTestfile.cmake according to this information to: ADD_TEST(rsbtest correct binary) SET_PROPERTY(TEST rsbtest PROPERTY ENVIRONMENT PATH=correct path with correct escapes) Afterwards all unit tests run as expected. What am I doing wrong here? Or is this a bug in cmake? Thanks for any help! Johannes ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Problem setting ENVIRONMENT for ctest
Hey, thanks for the quick reply. Am 03.12.2010 19:12 schrieb David Cole: What version of cmake/ctest are you using? (i.e. -- send the output of cmake --version) On the windows machine (32 bit) where the problem is visible it is 2.8.3. I could also verify the generated CTestTestfile on linux 64 bit with 2.8.0. What does CTestTestfile.cmake contain if you change your CMakeLists file to use set_property(TEST ...) instead of set_tests_properties()? The same content that does not work. This should work as expected in CMake. We have a test in the test suite that tests the ENVIRONMENT test property at CMake/Tests/Environment/CMakeLists.txt -- the test uses set_tests_properties. I took a look at the contents of that test and transferred it to my project printing out the PATH environment variable. There I found two things: a) an inconsistent behavior and b) the real problem. ;) a) I had the correct path required for running the tests exported on the shell prior to calling ctest. With the SET_TESTS_PROPERTIES test file version generated by cmake this is ignored (PATH is completely replaced by the contents of the test file) whereas the SET_PROPERTIES(TEST...) version (modified by hand) seems to append to the current path instead of replacing it and hence passed through the correct export from my shell to the test executable. b) The real problem is that the system path of my machine contains an entry that ends with a slash (completely legal): ...tem32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\... (end of the powershell entry) Using the regular expression above to escape the semicolons results in: ...tem32\Wbem\;C:\Windows\System32\WindowsPowerShell\v1.0\\;C:\... You see the double-slash. Using this string again in the SET_TESTS_PROPERTIES macro again results in a path truncated after this entry because everything after the powershell entry is misinterpreted by the macro as a new environment variable or I don't know. So the real question is how to handle this case correctly? The need to escape the semicolons seems to be a burden for users that isn't event documented and in this case results in a error which requires strange corner cases routines. Regards, Johannes On Fri, Dec 3, 2010 at 12:37 PM, Johannes Wienke jwie...@techfak.uni-bielefeld.de wrote: Dear all, I am try to set the PATH environment variable on windows for running the unit tests through ctest. The ctest file is generated by the cmake scripts. The PATH is required to for finding additional dlls required by the tests. I tried to set the PATH using this cmake code: SET(PATH_STRING $ENV{PATH};${Boost_LIBRARY_DIRS}) STRING(REPLACE ; \\; PATH_STRING ${PATH_STRING}) SET_TESTS_PROPERTIES(rsbtest PROPERTIES ENVIRONMENT PATH=${PATH_STRING}) This is done according to this list posting some time ago: http://www.cmake.org/pipermail/cmake/2009-May/029464.html However, it does not work for me. PATH is not changed when calling ctest and the dlls are not found. I investigated a bit and found out that the resulting CTestTestfile.cmake file contains these lines for every specified test: ADD_TEST(rsbtest correct binary) SET_TESTS_PROPERTIES(rsbtest PROPERTIES ENVIRONMENT PATH=correct path with correct escapes) However, man ctest does not even document that SET_TESTS_PROPERTIES is a valid command for ctest. Instead SET_PROPERTY(TEST...) is explained. So I changed the generated CTestTestfile.cmake according to this information to: ADD_TEST(rsbtest correct binary) SET_PROPERTY(TEST rsbtest PROPERTY ENVIRONMENT PATH=correct path with correct escapes) Afterwards all unit tests run as expected. What am I doing wrong here? Or is this a bug in cmake? Thanks for any help! Johannes ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake signature.asc Description: OpenPGP digital signature ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Problem setting ENVIRONMENT for ctest
Try just the single line: SET_TESTS_PROPERTIES(rsbtest PROPERTIES ENVIRONMENT PATH=$ENV{PATH};${Boost_LIBRARY_DIRS}) Or... if there's still a \; problem with that call, then try it this way, reversing the ordering: SET_TESTS_PROPERTIES(rsbtest PROPERTIES ENVIRONMENT PATH=${Boost_LIBRARY_DIRS};$ENV{PATH}) Let us know if that works. It's not documented, because where would we document something like that so that it would be useful and found by someone looking for it. The best solution is google first, email here second... :-) Thanks, David On Fri, Dec 3, 2010 at 3:49 PM, Johannes Wienke jwie...@techfak.uni-bielefeld.de wrote: Hey, thanks for the quick reply. Am 03.12.2010 19:12 schrieb David Cole: What version of cmake/ctest are you using? (i.e. -- send the output of cmake --version) On the windows machine (32 bit) where the problem is visible it is 2.8.3. I could also verify the generated CTestTestfile on linux 64 bit with 2.8.0. What does CTestTestfile.cmake contain if you change your CMakeLists file to use set_property(TEST ...) instead of set_tests_properties()? The same content that does not work. This should work as expected in CMake. We have a test in the test suite that tests the ENVIRONMENT test property at CMake/Tests/Environment/CMakeLists.txt -- the test uses set_tests_properties. I took a look at the contents of that test and transferred it to my project printing out the PATH environment variable. There I found two things: a) an inconsistent behavior and b) the real problem. ;) a) I had the correct path required for running the tests exported on the shell prior to calling ctest. With the SET_TESTS_PROPERTIES test file version generated by cmake this is ignored (PATH is completely replaced by the contents of the test file) whereas the SET_PROPERTIES(TEST...) version (modified by hand) seems to append to the current path instead of replacing it and hence passed through the correct export from my shell to the test executable. b) The real problem is that the system path of my machine contains an entry that ends with a slash (completely legal): ...tem32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\... (end of the powershell entry) Using the regular expression above to escape the semicolons results in: ...tem32\Wbem\;C:\Windows\System32\WindowsPowerShell\v1.0\\;C:\... You see the double-slash. Using this string again in the SET_TESTS_PROPERTIES macro again results in a path truncated after this entry because everything after the powershell entry is misinterpreted by the macro as a new environment variable or I don't know. So the real question is how to handle this case correctly? The need to escape the semicolons seems to be a burden for users that isn't event documented and in this case results in a error which requires strange corner cases routines. Regards, Johannes On Fri, Dec 3, 2010 at 12:37 PM, Johannes Wienke jwie...@techfak.uni-bielefeld.de wrote: Dear all, I am try to set the PATH environment variable on windows for running the unit tests through ctest. The ctest file is generated by the cmake scripts. The PATH is required to for finding additional dlls required by the tests. I tried to set the PATH using this cmake code: SET(PATH_STRING $ENV{PATH};${Boost_LIBRARY_DIRS}) STRING(REPLACE ; \\; PATH_STRING ${PATH_STRING}) SET_TESTS_PROPERTIES(rsbtest PROPERTIES ENVIRONMENT PATH=${PATH_STRING}) This is done according to this list posting some time ago: http://www.cmake.org/pipermail/cmake/2009-May/029464.html However, it does not work for me. PATH is not changed when calling ctest and the dlls are not found. I investigated a bit and found out that the resulting CTestTestfile.cmake file contains these lines for every specified test: ADD_TEST(rsbtest correct binary) SET_TESTS_PROPERTIES(rsbtest PROPERTIES ENVIRONMENT PATH=correct path with correct escapes) However, man ctest does not even document that SET_TESTS_PROPERTIES is a valid command for ctest. Instead SET_PROPERTY(TEST...) is explained. So I changed the generated CTestTestfile.cmake according to this information to: ADD_TEST(rsbtest correct binary) SET_PROPERTY(TEST rsbtest PROPERTY ENVIRONMENT PATH=correct path with correct escapes) Afterwards all unit tests run as expected. What am I doing wrong here? Or is this a bug in cmake? Thanks for any help! Johannes ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check
Re: [CMake] Problem setting ENVIRONMENT for ctest
Ok, so just as a start, the PATH of the shell is: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE;C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN;C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools;C:\Windows\Microsoft.NET\Framework\v3.5;C:\Windows\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 9.0\VC\VCPackages;C:\Program Files\\Microsoft SDKs\Windows\v6.0A\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\CMake 2.8\bin;C:\Program Files\TortoiseSVN\bin;C:\MinGW\msys\1.0;C:\MinGW\msys\1.0\bin Am 03.12.2010 22:26 schrieb David Cole: Try just the single line: SET_TESTS_PROPERTIES(rsbtest PROPERTIES ENVIRONMENT PATH=$ENV{PATH};${Boost_LIBRARY_DIRS}) This results in the following path being exported to the test program: Environment: PATH='C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE' Or... if there's still a \; problem with that call, then try it this way, reversing the ordering: SET_TESTS_PROPERTIES(rsbtest PROPERTIES ENVIRONMENT PATH=${Boost_LIBRARY_DIRS};$ENV{PATH}) Environment: PATH='C:/Program Files/boost/boost_1_44/lib' So you really have to escape the semicolons, otherwise only the first path entry is passed to the program. My solution that works now is a two-step replace procedure: STRING(REPLACE \\; ; PATH_STRING ${PATH_STRING}) STRING(REPLACE ; \\; PATH_STRING ${PATH_STRING}) But this is really ugly. There must be a better solution or fix for setting this property. It's not documented, because where would we document something like that so that it would be useful and found by someone looking for it. The best solution is google first, email here second... :-) In the section Properties on tests in the man page. ;) At least I looked up the ENVIRONMENT property there and I'm sure others will do the same. Cheers, Johannes On Fri, Dec 3, 2010 at 3:49 PM, Johannes Wienke jwie...@techfak.uni-bielefeld.de wrote: Hey, thanks for the quick reply. Am 03.12.2010 19:12 schrieb David Cole: What version of cmake/ctest are you using? (i.e. -- send the output of cmake --version) On the windows machine (32 bit) where the problem is visible it is 2.8.3. I could also verify the generated CTestTestfile on linux 64 bit with 2.8.0. What does CTestTestfile.cmake contain if you change your CMakeLists file to use set_property(TEST ...) instead of set_tests_properties()? The same content that does not work. This should work as expected in CMake. We have a test in the test suite that tests the ENVIRONMENT test property at CMake/Tests/Environment/CMakeLists.txt -- the test uses set_tests_properties. I took a look at the contents of that test and transferred it to my project printing out the PATH environment variable. There I found two things: a) an inconsistent behavior and b) the real problem. ;) a) I had the correct path required for running the tests exported on the shell prior to calling ctest. With the SET_TESTS_PROPERTIES test file version generated by cmake this is ignored (PATH is completely replaced by the contents of the test file) whereas the SET_PROPERTIES(TEST...) version (modified by hand) seems to append to the current path instead of replacing it and hence passed through the correct export from my shell to the test executable. b) The real problem is that the system path of my machine contains an entry that ends with a slash (completely legal): ...tem32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\... (end of the powershell entry) Using the regular expression above to escape the semicolons results in: ...tem32\Wbem\;C:\Windows\System32\WindowsPowerShell\v1.0\\;C:\... You see the double-slash. Using this string again in the SET_TESTS_PROPERTIES macro again results in a path truncated after this entry because everything after the powershell entry is misinterpreted by the macro as a new environment variable or I don't know. So the real question is how to handle this case correctly? The need to escape the semicolons seems to be a burden for users that isn't event documented and in this case results in a error which requires strange corner cases routines. Regards, Johannes On Fri, Dec 3, 2010 at 12:37 PM, Johannes Wienke jwie...@techfak.uni-bielefeld.de wrote: Dear all, I am try to set the PATH environment variable on windows for running the unit tests through ctest. The ctest file is generated by the cmake scripts. The PATH is required to for finding additional dlls required by the tests. I tried to set the PATH using this cmake code: SET(PATH_STRING $ENV{PATH};${Boost_LIBRARY_DIRS}) STRING(REPLACE ; \\; PATH_STRING ${PATH_STRING}) SET_TESTS_PROPERTIES(rsbtest PROPERTIES ENVIRONMENT PATH=${PATH_STRING}) This is done according to this list posting some time ago: http://www.cmake.org/pipermail/cmake/2009-May/029464.html However, it does not work for me. PATH is not