CMakeLists.txt 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1998 - 2022, 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. add_custom_target(testdeps)
  25. add_subdirectory(data)
  26. add_subdirectory(libtest)
  27. add_subdirectory(server)
  28. add_subdirectory(unit)
  29. function(add_runtests targetname test_flags)
  30. # Use a special '$TFLAGS' placeholder as last argument which will be
  31. # replaced by the contents of the environment variable in runtests.pl.
  32. # This is a workaround for CMake's limitation where commands executed by
  33. # 'make' or 'ninja' cannot portably reference environment variables.
  34. string(REPLACE " " ";" test_flags_list "${test_flags}")
  35. add_custom_target(${targetname}
  36. COMMAND
  37. "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/runtests.pl"
  38. ${test_flags_list}
  39. "\$TFLAGS"
  40. DEPENDS testdeps
  41. VERBATIM USES_TERMINAL
  42. )
  43. endfunction()
  44. add_runtests(test-quiet "-a -s")
  45. add_runtests(test-am "-a -am")
  46. add_runtests(test-full "-a -p -r")
  47. # !flaky means that it'll skip all tests using the flaky keyword
  48. add_runtests(test-nonflaky "-a -p !flaky")
  49. add_runtests(test-ci "-a -p !flaky -r -rm")
  50. add_runtests(test-torture "-a -t")
  51. add_runtests(test-event "-a -e")