CMakeLists.txt 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. include(ProcessorCount)
  2. ProcessorCount(PROCESSORS)
  3. if (NOT PROCESSORS EQUAL 0)
  4. math(EXPR JOBS "${PROCESSORS} * 2")
  5. set(CTEST_BUILD_FLAGS -j${JOBS})
  6. endif()
  7. add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} ${CTEST_BUILD_FLAGS})
  8. add_subdirectory(unit)
  9. if (HAVE_BOOST_PYTHON)
  10. set(TEST_PYTHON_FLAGS "--python")
  11. endif()
  12. macro(add_ledger_harness_tests _class)
  13. if (PYTHONINTERP_FOUND)
  14. file(GLOB ${_class}_TESTS *.test)
  15. foreach(TestFile ${${_class}_TESTS})
  16. get_filename_component(TestFile_Name ${TestFile} NAME_WE)
  17. string(FIND ${TestFile_Name} "_py" TestFile_IsPythonTest)
  18. if ((TestFile_IsPythonTest EQUAL -1) OR HAVE_BOOST_PYTHON)
  19. add_test(NAME ${_class}Test_${TestFile_Name}
  20. COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/RegressTests.py
  21. $<TARGET_FILE:ledger> ${PROJECT_SOURCE_DIR}
  22. ${TestFile} ${TEST_PYTHON_FLAGS})
  23. set_tests_properties(${_class}Test_${TestFile_Name}
  24. PROPERTIES ENVIRONMENT "TZ=${Ledger_TEST_TIMEZONE}")
  25. set_target_properties(check
  26. PROPERTIES DEPENDS ${_class}Test_${TestFile_Name})
  27. endif()
  28. endforeach()
  29. endif()
  30. endmacro(add_ledger_harness_tests _class)
  31. add_subdirectory(manual)
  32. add_subdirectory(baseline)
  33. add_subdirectory(regress)
  34. if (PYTHONINTERP_FOUND)
  35. set(_class DocTests)
  36. file(GLOB ${_class}_TESTS ${PROJECT_SOURCE_DIR}/doc/*.texi)
  37. foreach(TestFile ${${_class}_TESTS})
  38. get_filename_component(TestFile_Name ${TestFile} NAME_WE)
  39. add_test(NAME ${_class}Test_${TestFile_Name}
  40. COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/${_class}.py
  41. --ledger $<TARGET_FILE:ledger> --file ${TestFile})
  42. set_tests_properties(${_class}Test_${TestFile_Name}
  43. PROPERTIES ENVIRONMENT "TZ=${Ledger_TEST_TIMEZONE}")
  44. set_target_properties(check
  45. PROPERTIES DEPENDS ${_class}Test_${TestFile_Name})
  46. endforeach()
  47. # CheckManpage and CheckTexinfo are disabled, since they do not work
  48. # reliably yet, instead they are being run as a Travis CI report.
  49. list(APPEND CheckOptions CheckBaselineTests) #CheckManpage CheckTexinfo
  50. foreach(_class ${CheckOptions})
  51. add_test(NAME ${_class}
  52. COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/${_class}.py
  53. --ledger $<TARGET_FILE:ledger> --source ${PROJECT_SOURCE_DIR})
  54. set_tests_properties(${_class}
  55. PROPERTIES ENVIRONMENT "TZ=${Ledger_TEST_TIMEZONE}")
  56. endforeach()
  57. endif()
  58. ### CMakeLists.txt ends here