Skip to content
Snippets Groups Projects
TestsRelaxSE.cmake 2.79 KiB
Newer Older
  • Learn to ignore specific revisions
  • #Run through each source
    foreach(testSrc ${UNITTEST_SOURCES})
      #Extract the filename without an extension (NAME_WE)
      get_filename_component(testName ${testSrc} NAME_WE)
      
      #Add compile target
      add_executable(${testName} ${testSrc})
    	
      #link to Boost libraries AND your targets and dependencies
      target_link_libraries(${testName}
        RelaxSE_lib
        RelaxSE_type
        RelaxSE_IO
        RelaxSE_common
        #test_utils
        ${LAPACK_LIBRARIES}
        ${BLAS_LIBRARIES})
      
      #I like to move testing binaries into a testBin directory
      set_target_properties(${testName} PROPERTIES 
        RUNTIME_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR}/testBin)
      
      #Finally add it to test execution - 
      #Notice the WORKING_DIRECTORY and COMMAND
      add_test(NAME ${testName} 
        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/testBin 
        COMMAND ${CMAKE_BINARY_DIR}/testBin/${testName} )
    endforeach(testSrc)
    
    macro(add_runtest _name)
      add_test(
        NAME ${_name}
        COMMAND python3 ${CMAKE_SOURCE_DIR}/test/${_name}/test --binary-dir=${CMAKE_BINARY_DIR} --work-dir=${CMAKE_BINARY_DIR}/test/${_name} --verbose --log=${CMAKE_BINARY_DIR}/test/${_name}/runtest.stderr.log)
      #if(NOT "${_labels}" STREQUAL "")
      set_tests_properties(${_name} PROPERTIES
        RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test/${_name})
      #endif()
    endmacro()
    add_runtest(CuO_20204)
    add_runtest(CuO_20204_spin)
    add_runtest(CuO_20240)
    add_runtest(CuO_02204)
    add_runtest(CuO_00800_HS)
    add_runtest(CuO_00800_LS)
    if(NOT ENABLE_NOGEN)
      add_runtest(CuO_02240)
      add_runtest(CuO_30405)
      add_runtest(CuO_03450_nodet2)
      add_runtest(CuO_03450_nodet3)
      add_runtest(CuO_03450_nocontraction)
      add_runtest(CuO_03450_allcontraction)
      add_runtest(CuO_03450)
      add_runtest(CuO_12423)
      add_runtest(CuO_CAS+S)
      add_runtest(CuO_DDCI)
      add_test(NAME prop 
        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test/CuO_DDCI
        COMMAND ${CMAKE_BINARY_DIR}/prop.x )
    endif()
    
    if(ENABLE_MPI)
      add_runtest(CuO_03450_bigbatch_MPIload)
      add_runtest(CuO_03450_bigbatch_noMPIload)
      add_runtest(CuO_03450_smallbatch_MPIload)
      add_runtest(CuO_03450_smallbatch_noMPIload)
    endif()
    
    Elisa Rebolini's avatar
    Elisa Rebolini committed
    
    if(ENABLE_DEV)
      
      add_test(
        NAME prop_CuO_02204
        COMMAND python3 ${CMAKE_SOURCE_DIR}/test/CuO_02204/test_prop --binary-dir=${CMAKE_BINARY_DIR} --work-dir=${CMAKE_BINARY_DIR}/test/CuO_02204 --verbose --log=${CMAKE_BINARY_DIR}/test/CuO_02204/runtest.stderr.logprop)
      set_tests_properties(prop_CuO_02204 PROPERTIES
        RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test/CuO_02204)
    
    Elisa Rebolini's avatar
    Elisa Rebolini committed
    
      add_test(
        NAME prop_CuO_03450
        COMMAND python3 ${CMAKE_SOURCE_DIR}/test/CuO_03450/test_prop --binary-dir=${CMAKE_BINARY_DIR} --work-dir=${CMAKE_BINARY_DIR}/test/CuO_03450 --verbose --log=${CMAKE_BINARY_DIR}/test/CuO_03450/runtest.stderr.logprop)
      set_tests_properties(prop_CuO_03450 PROPERTIES
        RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test/CuO_03450)
    
    Elisa Rebolini's avatar
    Elisa Rebolini committed
      
    endif()