[CMake] add_test: specify working directory?
Dixon, Shane
Shane.Dixon at atmel.com
Thu Sep 24 16:54:21 EDT 2009
Clinton,
Thanks, that seems to work. Now I just get the fun of setting up all my tests. (Oops. I meant to send this to the list the first time. Sorry, Clinton)
Tyler,
Ha...it's not quite that kind of ping. It's just an end-to-end functionality test.
--
Shane
-----Original Message-----
From: Clinton Stimpson [mailto:clinton at elemtech.com]
Sent: Thursday, September 24, 2009 10:23 AM
To: cmake at cmake.org
Cc: Tyler Roscoe; Dixon, Shane
Subject: Re: [CMake] add_test: specify working directory?
On Thursday 24 September 2009 10:18:34 am Tyler Roscoe wrote:
> On Thu, Sep 24, 2009 at 10:04:40AM -0600, Dixon, Shane wrote:
> > ADD_TEST(ping_test ${CMAKE_CURRENT_BINARY_DIR}/testdir/bin/MyClient.exe
> > my.server.com 4321)
> >
> > SET_TESTS_PROPERTIES(ping_test PROPERTIES FAIL_REGULAR_EXPRESSION "Ping
> > Failed")
> >
> > SET_TESTS_PROPERTIES(ping_test PROPERTIES PASS_REGULAR_EXPRESSION "Ping
> > Successful!")
> >
> > If appears that by specifying the absolute path, it runs the
> > MyClient.exe and the working directory isn't set to the same directory
> > that the MyClient.exe resides. My ping test fails horribly because it
> > can't find the client.pem in the default working directory. Is there
> > any way to specify the working directory when using add_test?
>
> Wow, you TLS-encrypt your ping packets? That's hardcore. :)
>
> I'm surprised to see that add_test() doesn't accept a WORKING_DIRECTORY
> argument.
>
> One workaround would be to write a wrapper script that cd's to your
> desired working directory and then calls your exe. Then you would
> add_test(my_wrapper_script).
>
Or without a script:
add_test(MyTest ${CMAKE_COMMAND} -E chdir ${MyDir} testexex)
Clint
More information about the CMake
mailing list