On Thu, Sep 8, 2011 at 9:30 AM, Delphinus Delphinus <[email protected]> wrote: > Hi all, > > I am using the Qt module QTestLib to do some tests on my application > (windows, MSVC 2008) that has been all set up with CMake. > > A test I have created with QTestLib is executed, all output is sent to the > command window. Since I want it to a file, I used what Qt suggest to > redirect all output: -xml -o my_file.xml > so I do this in my CMake file: > > add_test ( NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} -xml -o > log/foo.xml ) > > So now, when I do the "run_test" through visual, my test is run and my file > is created (so far so good!). > > > My problem is that I want the name of the file to be time and date dependant > (log20110908140230.xml - a year, month, day, hour, minute and second > format). > > So I have considered the following solution (I did not succeed in > implementing it so far): > I want to execute a script, just after the execution of my test that will > rename the result file generated. > --> Here I don't know how I can tell CMake to execute my script just when > the test has been executed ? > > NB: I do NOT have any problem creating a script that rename a foo.xml file > to a log20110908140230.xml file (my script.bat file is already ready). The > problem is how to make this script to be executed just after the test > execution. > > > Any insight is welcomed on how to implement my suggestion (or if you have > another choice, I'm all ears :)! ). > > > _______________________________________________ > 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 >
You can either: (1) execute your script as an additional test that depends on the first one (so that guarantees it to run *after* the test, even in parallel testing scenarios, although not necessarily *immediately* after) or (2) execute a single script as the test itself, and then inside that script, execute the real test first, followed immediately by the script your already have... I would do option #2 if I were you. :-) You can probably find other examples of this by googling around for "add_test script cmake" ( one of the hits is another reply I made previously on this list: http://www.cmake.org/pipermail/cmake/2011-May/044180.html ) HTH, David _______________________________________________ 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
