setup_build.cmake 846 B

123456789101112131415161718192021
  1. # Find nosetests; see spirv_add_nosetests() for opting in to nosetests in a
  2. # specific directory.
  3. find_program(NOSETESTS_EXE NAMES nosetests PATHS $ENV{PYTHON_PACKAGE_PATH})
  4. if (NOT NOSETESTS_EXE)
  5. message(STATUS "SPIRV-Tools: nosetests was not found - python support code will not be tested")
  6. else()
  7. message(STATUS "SPIRV-Tools: nosetests found - python support code will be tested")
  8. endif()
  9. # Run nosetests on file ${PREFIX}_nosetest.py. Nosetests will look for classes
  10. # and functions whose names start with "nosetest". The test name will be
  11. # ${PREFIX}_nosetests.
  12. function(spirv_add_nosetests PREFIX)
  13. if(NOT "${SPIRV_SKIP_TESTS}" AND NOSETESTS_EXE)
  14. add_test(
  15. NAME ${PREFIX}_nosetests
  16. COMMAND ${NOSETESTS_EXE} -m "^[Nn]ose[Tt]est" -v
  17. ${CMAKE_CURRENT_SOURCE_DIR}/${PREFIX}_nosetest.py)
  18. endif()
  19. endfunction()