CMakeLists.txt 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. #
  10. # This software is licensed as described in the file COPYING, which
  11. # you should have received as part of this distribution. The terms
  12. # are also available at https://curl.se/docs/copyright.html.
  13. #
  14. # You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. # copies of the Software, and permit persons to whom the Software is
  16. # furnished to do so, under the terms of the COPYING file.
  17. #
  18. # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. # KIND, either express or implied.
  20. #
  21. # SPDX-License-Identifier: curl
  22. #
  23. ###########################################################################
  24. set(CMAKE_UNITY_BUILD OFF)
  25. add_custom_target(testdeps)
  26. add_subdirectory(data)
  27. add_subdirectory(libtest)
  28. add_subdirectory(server)
  29. add_subdirectory(unit)
  30. function(add_runtests targetname test_flags)
  31. # Use a special '$TFLAGS' placeholder as last argument which will be
  32. # replaced by the contents of the environment variable in runtests.pl.
  33. # This is a workaround for CMake's limitation where commands executed by
  34. # 'make' or 'ninja' cannot portably reference environment variables.
  35. string(REPLACE " " ";" test_flags_list "${test_flags}")
  36. add_custom_target(${targetname}
  37. COMMAND
  38. "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/runtests.pl"
  39. ${test_flags_list}
  40. "\$TFLAGS"
  41. DEPENDS testdeps
  42. VERBATIM USES_TERMINAL
  43. )
  44. endfunction()
  45. add_runtests(test-quiet "-a -s")
  46. add_runtests(test-am "-a -am")
  47. add_runtests(test-full "-a -p -r")
  48. # !flaky means that it'll skip all tests using the flaky keyword
  49. add_runtests(test-nonflaky "-a -p !flaky")
  50. add_runtests(test-ci "-a -p !flaky -r -rm")
  51. add_runtests(test-torture "-a -t")
  52. add_runtests(test-event "-a -e")