When running `make runtest` (or `make run_quicktest`) and the test fails, it is not seldom that this is caused by an error in a unit test. If then one fixes the error in the unit test and runs the test again, the test keeps failing since it has not been copied to the build directory.
-- Anders On Thu, Dec 19, 2013 at 08:49:41AM +0100, Johan Hake wrote: > It is hard to be consequent with CMake for such a large and complex project as > DOLFIN. That said I think the rationale is that we only copy stuff to the > build > directory if it is needed by a certain target. It is obvious that the tests > are > needed for all run_foo_tests so therefor is the line: > > DEPENDS copy_data_test_demo > > added to the target declaration. It should be equivalent to using > add_dependencies. There are no direct requirements to have updated tests in > the > build directory when dolfin is built and they are therefore not copied. I can > see that it could be convenient to have them though. I do not have any strong > opinions of copying or not copying. > > Johan > > > On Thu, Dec 19, 2013 at 8:24 AM, Anders Logg <[email protected]> wrote: > > Yes, this is the correct list. > > I have experienced similar problems with not being able to edit unit > tests and then rerun them from the build directory. > > I don't know enough about CMake to say whether the fix is correct. > Johannes can comment. > > > > On Wed, Dec 18, 2013 at 10:37:46PM +0000, Myles English wrote: > > Bah, it only 'works' now because of the 'fix' I made so my first email > > is still correct. (By the way is this the right list?) > > > > On 18 December 2013 22:05, Myles English <[email protected]> wrote: > > > Nevermind, I caused a strange error whereby there was a file called > > > dolfin/dolfin/la/.#Matrix.h which stopped CMake working properly. > > > > > > Myles > > > > > > On 18 December 2013 15:07, Myles English <[email protected]> > wrote: > > >> Hello, > > >> > > >> If I build with cmake.local, then change the file > > >> test/unit/la/python/Matrix.py in the source directory, then do > > >> 'make' again in the build directory, I would have expected the > > >> changes to be copied to the build directory, but they are not. > > >> > > >> If I do 'make run_quicktest' the changes are copied. > > >> > > >> I think this is because the initial copy was done using the > > >> script copy_data_test_demo called from the top level > > >> CMakeLists.txt and so CMake cannot keep track of the files involved. > > >> > > >> I believe this could be changed by adding an add_dependencies() > > >> line, for example: > > >> > > >> if (DOLFIN_ENABLE_TESTING) > > >> > > >> # Add target "run_memorytests" [sic] for running memory tests > > >> add_custom_target(copy_data_test_demo > > >> COMMAND ${PYTHON_EXECUTABLE} > > >> ${DOLFIN_SOURCE_DIR}/cmake/scripts/copy-test-demo-data > > >> ${CMAKE_CURRENT_BINARY_DIR} > > >> WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) > > >> > > >> add_dependencies(dolfin copy_data_test_demo) <--- THIS LINE ADDED > > >> > > >> [snip] > > >> > > >> # Add target "run_quicktest" for running only Python unit tests > > >> add_custom_target(run_quicktest > > >> COMMAND ${PYTHON_EXECUTABLE} test.py --only-python > > >> DEPENDS copy_data_test_demo > > >> WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/unit") > > >> > > >> endif() > > >> > > >> However, I notice that there are no other occurences of > > >> add_dependencies() so I am wondering: > > >> > > >> 1) if the current behaviour is intentional, and also > > >> > > >> 2) if the change could have unintended consequences, and > > >> > > >> 3) what about all the other places where files are copied to the > > >> build tree with a COMMAND? > > >> > > >> Thanks, > > >> Myles > > _______________________________________________ > > fenics mailing list > > [email protected] > > http://fenicsproject.org/mailman/listinfo/fenics > _______________________________________________ > fenics mailing list > [email protected] > http://fenicsproject.org/mailman/listinfo/fenics > > _______________________________________________ fenics mailing list [email protected] http://fenicsproject.org/mailman/listinfo/fenics
