You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

157 lines
4.7 KiB

  1. # Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
  2. #
  3. # This program is free software; you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation; version 2 of the License.
  6. #
  7. # This program is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. # GNU General Public License for more details.
  11. #
  12. # You should have received a copy of the GNU General Public License
  13. # along with this program; if not, write to the Free Software
  14. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  15. IF(INSTALL_MYSQLTESTDIR)
  16. INSTALL(
  17. DIRECTORY .
  18. DESTINATION ${INSTALL_MYSQLTESTDIR}
  19. USE_SOURCE_PERMISSIONS
  20. COMPONENT Test
  21. PATTERN "var/" EXCLUDE
  22. PATTERN "lib/My/SafeProcess" EXCLUDE
  23. PATTERN "lib/t*" EXCLUDE
  24. PATTERN "CPack" EXCLUDE
  25. PATTERN "CMake*" EXCLUDE
  26. PATTERN "mtr.out*" EXCLUDE
  27. PATTERN ".cvsignore" EXCLUDE
  28. PATTERN "*.am" EXCLUDE
  29. PATTERN "*.in" EXCLUDE
  30. )
  31. ENDIF()
  32. IF(NOT ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
  33. # Enable running mtr from build directory
  34. CONFIGURE_FILE(
  35. ${CMAKE_CURRENT_SOURCE_DIR}/mtr.out-of-source
  36. ${CMAKE_CURRENT_BINARY_DIR}/mysql-test-run.pl
  37. @ONLY
  38. )
  39. ENDIF()
  40. IF(UNIX)
  41. EXECUTE_PROCESS(
  42. COMMAND chmod +x mysql-test-run.pl
  43. COMMAND ${CMAKE_COMMAND} -E create_symlink
  44. ./mysql-test-run.pl mtr
  45. COMMAND ${CMAKE_COMMAND} -E create_symlink
  46. ./mysql-test-run.pl mysql-test-run
  47. WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
  48. )
  49. IF(INSTALL_MYSQLTESTDIR)
  50. INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mtr
  51. ${CMAKE_CURRENT_BINARY_DIR}/mysql-test-run
  52. DESTINATION ${INSTALL_MYSQLTESTDIR}
  53. COMPONENT Test)
  54. ENDIF()
  55. ENDIF()
  56. IF(CMAKE_GENERATOR MATCHES "Visual Studio")
  57. SET(SETCONFIG_COMMAND set MTR_VS_CONFIG=${CMAKE_CFG_INTDIR})
  58. ELSEIF(CMAKE_GENERATOR MATCHES "Xcode")
  59. SET(SETCONFIG_COMMAND export MTR_VS_CONFIG=${CMAKE_CFG_INTDIR})
  60. ELSE()
  61. SET(SETCONFIG_COMMAND echo Running tests)
  62. ENDIF()
  63. IF(CYGWIN)
  64. # On cygwin, pretend to be "Unix" system
  65. SET(SETOS_COMMAND export MTR_CYGWIN_IS_UNIX=1)
  66. ELSE()
  67. SET(SETOS_COMMAND echo OS=${CMAKE_SYSTEM_NAME})
  68. ENDIF()
  69. SET(EXP --experimental=collections/default.experimental)
  70. IF(WIN32)
  71. SET(SET_ENV set)
  72. ELSE()
  73. SET(SET_ENV export)
  74. ENDIF()
  75. SET(MTR_FORCE perl ./mysql-test-run.pl --force)
  76. IF(EXISTS ${CMAKE_SOURCE_DIR}/mysql-test/suite/nist)
  77. SET(TEST_NIST ${MTR_FORCE} --comment=nist suite=nist ${EXP} &&
  78. ${MTR_FORCE} --comment=nist --force --suite=nist+ps ${EXP})
  79. ELSE()
  80. SET(TEST_NIST echo "NIST tests not found")
  81. ENDIF()
  82. IF(WITH_EMBEDDED_SERVER)
  83. SET(TEST_EMBEDDED ${MTR_FORCE} --comment=embedded --timer --embedded-server
  84. --skip-rpl --skip-ndbcluster $(EXP))
  85. ELSE()
  86. SET(TEST_EMBEDDED echo "Can not test embedded, not compiled in")
  87. ENDIF()
  88. SET(TEST_BT_START
  89. COMMAND ${SETCONFIG_COMMAND}
  90. COMMAND ${SETOS_COMMAND}
  91. COMMAND ${SET_ENV} MTR_BUILD_THREAD=auto
  92. )
  93. ADD_CUSTOM_TARGET(test-force
  94. ${TEST_BT_START}
  95. COMMAND ${MTR_FORCE}
  96. )
  97. ADD_CUSTOM_TARGET(test-bt
  98. ${TEST_BT_START}
  99. COMMAND ${MTR_FORCE} --comment=normal --timer --skip-ndbcluster --report-features ${EXP}
  100. COMMAND ${MTR_FORCE} --comment=ps --timer --skip-ndbcluster --ps-protocol ${EXP}
  101. COMMAND ${MTR_FORCE} --comment=funcs1+ps --ps-protocol --reorder --suite=funcs_1 ${EXP}
  102. COMMAND ${MTR_FORCE} --comment=funcs2 --suite=funcs_2 ${EXP}
  103. COMMAND ${MTR_FORCE} --comment=partitions --suite=parts ${EXP}
  104. COMMAND ${MTR_FORCE} --comment=stress --suite=stress ${EXP}
  105. COMMAND ${MTR_FORCE} --force --comment=jp --suite=jp ${EXP}
  106. COMMAND ${TEST_NIST}
  107. COMMAND ${TEST_EMBEDDED}
  108. )
  109. ADD_CUSTOM_TARGET(test-bt-fast
  110. ${TEST_BT_START}
  111. COMMAND ${MTR_FORCE} --comment=ps --timer --skip-ndbcluster --ps-protocol --report-features ${EXP}
  112. COMMAND ${MTR_FORCE} --comment=stress --suite=stress ${EXP}
  113. )
  114. ADD_CUSTOM_TARGET(test-bt-debug
  115. ${TEST_BT_START}
  116. COMMAND ${MTR_FORCE} --comment=debug --timer --skip-ndbcluster --skip-rpl --report-features ${EXP}
  117. )
  118. # Process .in files with includes in collections/
  119. MACRO(PROCESS_COLLECTION_INCLUDE collin collection)
  120. FILE(STRINGS ${collin} inlines)
  121. FOREACH(line ${inlines})
  122. IF(${line} MATCHES "#include .*")
  123. STRING(REPLACE "#include " "collections/" incfile ${line})
  124. FILE(READ ${incfile} contents)
  125. FILE(APPEND ${collection} "${contents}")
  126. ELSE()
  127. FILE(APPEND ${collection} "${line}\n")
  128. ENDIF()
  129. ENDFOREACH()
  130. ENDMACRO()
  131. FILE(GLOB infiles "collections/*.in")
  132. FOREACH(collin ${infiles})
  133. STRING(REPLACE ".in" "" collection ${collin})
  134. # Only generate file once
  135. IF(NOT EXISTS ${collection})
  136. PROCESS_COLLECTION_INCLUDE(${collin} ${collection})
  137. ENDIF()
  138. ENDFOREACH()