CMakeLists.txt 2.0 KB

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