1
# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
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.
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.
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
16
IF(INSTALL_MYSQLTESTDIR)
19
DESTINATION ${INSTALL_MYSQLTESTDIR}
20
USE_SOURCE_PERMISSIONS
22
PATTERN "var/" EXCLUDE
23
PATTERN "lib/My/SafeProcess" EXCLUDE
24
PATTERN "lib/t*" EXCLUDE
25
PATTERN "CPack" EXCLUDE
26
PATTERN "CMake*" EXCLUDE
27
PATTERN "mtr.out*" EXCLUDE
28
PATTERN ".cvsignore" EXCLUDE
29
PATTERN "*.am" EXCLUDE
30
PATTERN "*.in" EXCLUDE
36
IF(NOT ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
37
# Enable running mtr from build directory
39
${CMAKE_CURRENT_SOURCE_DIR}/mtr.out-of-source
40
${CMAKE_CURRENT_BINARY_DIR}/mysql-test-run.pl
46
COMMAND chmod +x mysql-test-run.pl
47
COMMAND ${CMAKE_COMMAND} -E create_symlink
48
./mysql-test-run.pl mtr
49
COMMAND ${CMAKE_COMMAND} -E create_symlink
50
./mysql-test-run.pl mysql-test-run
51
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
53
IF(INSTALL_MYSQLTESTDIR)
54
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mtr
55
${CMAKE_CURRENT_BINARY_DIR}/mysql-test-run
56
DESTINATION ${INSTALL_MYSQLTESTDIR}
62
SET(EXP --experimental=collections/default.experimental)
68
SET(DEBUG_SERVER "--debug-server")
72
IF(CMAKE_BUILD_TYPE MATCHES "Debug")
73
SET(DEBUG_SERVER "--debug-server")
76
IF(CMAKE_GENERATOR MATCHES "Visual Studio" OR
77
CMAKE_GENERATOR MATCHES "Xcode")
78
SET(VS_CONFIG "--vs-config=${CMAKE_CFG_INTDIR}")
83
# On windows do: 'devenv mysql.sln /build Debug /project test-mtr'
84
# On unix do: 'make test-mtr'
85
ADD_CUSTOM_TARGET(test-mtr
86
COMMAND perl ./mysql-test-run.pl --force --parallel=4 --suite=main
87
${VS_CONFIG} ${DEBUG_SERVER} ${EXP}
90
## We could do something like this, but the 'test' target generated
91
## by cmake is really for unit testing: all output is muted by default,
92
## even in case of test failure.
93
## ADD_EXECUTABLE(perl IMPORTED)
94
## ADD_TEST(xxx perl ./mysql-test-run.pl --force
95
## ${VS_CONFIG} ${DEBUG_SERVER} ${EXP})
98
# Process .in files with includes in collections/
100
MACRO(PROCESS_COLLECTION_INCLUDE collin collection)
101
FILE(STRINGS ${collin} inlines)
102
FOREACH(line ${inlines})
103
IF(${line} MATCHES "#include .*")
104
STRING(REPLACE "#include " "collections/" incfile ${line})
105
FILE(READ ${incfile} contents)
106
FILE(APPEND ${collection} "${contents}")
108
FILE(APPEND ${collection} "${line}\n")
113
FILE(GLOB infiles "collections/*.in")
114
FOREACH(collin ${infiles})
115
STRING(REPLACE ".in" "" collection ${collin})
116
STRING(REPLACE ".in" ".done" colldone ${collin})
117
# Only generate file once
118
IF(NOT EXISTS ${colldone})
119
PROCESS_COLLECTION_INCLUDE(${collin} ${collection})
120
FILE(APPEND ${colldone} "${collin}\n")