forked from Kitware/CDash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
175 lines (157 loc) · 6.23 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
cmake_minimum_required(VERSION 2.8)
project(CDash)
include(CTest)
configure_file(${CDash_SOURCE_DIR}/CTestCustom.cmake.in
${CDash_BINARY_DIR}/CTestCustom.cmake)
# set some cache variables that can be used
# to configure the testing install
set(CDASH_SERVER localhost CACHE STRING "CDash testing server")
set(CDASH_DB_LOGIN "root" CACHE STRING "Database user")
set(CDASH_DB_PASS "" CACHE STRING "Password for database user")
set(CDASH_DB_PORT "" CACHE STRING "Port to connect to the database")
set(CDASH_DB_HOST "localhost" CACHE STRING "Hostname of the database server")
set(CDASH_DB_TYPE "mysql" CACHE STRING "Database type")
set(CDASH_DB_CONNECTION_TYPE "host" CACHE STRING "Connection type (e.g. host or unix_socket)")
option(CDASH_USE_SELENIUM "Should CDash use Selenium to test ajax functionality?" OFF)
option(CDASH_USE_PROTRACTOR "Should CDash use Protractor to test angular functionality?" ON)
option(CDASH_USE_REDIS_QUEUE "Should CDash use a message queue (Redis) for submitting/processing builds?" OFF)
option(CDASH_PRO "Are we testing CDashPro?" OFF)
set(CMake_SOURCE_DIR CACHE FILEPATH "Path to CMake source dir. Set this to import tests from CMake")
set(CLIENT_TEST_SCRIPT1 CACHE FILEPATH "Path to client management test script")
set(CLIENT_TEST_SCRIPT2 CACHE FILEPATH "Path to client management test script")
set(CDASH_GITHUB_USERNAME "" CACHE STRING "Github user for testing")
set(CDASH_GITHUB_PASSWORD "" CACHE STRING "Github user's password")
get_filename_component(CDASH_DIR_NAME_DEFAULT ${CDash_SOURCE_DIR} NAME)
set(CDASH_DIR_NAME "${CDASH_DIR_NAME_DEFAULT}" CACHE STRING "URL suffix. Ie 'http://<CDASH_SERVER>/<CDASH_DIR_NAME>'")
message("CDASH_DIR_NAME = ${CDASH_DIR_NAME}")
set(CDASH_TESTING_URL "http://${CDASH_SERVER}/${CDASH_DIR_NAME}")
message("Using url: ${CDASH_TESTING_URL}")
make_directory("${CDash_BINARY_DIR}/tmp")
if(NOT DEFINED CDASH_SITE)
site_name(CDASH_SITE)
endif()
if(NOT DEFINED CDASH_BUILD_NAME)
set(CDASH_BUILD_NAME "inner")
endif()
# turn the CDash into one that can be tested
file(WRITE "${CDash_SOURCE_DIR}/tests/config.test.local.php"
"<?php
$configure = array(
'urlwebsite' => '${CDASH_TESTING_URL}',
'webserver' => 'http://${CDASH_SERVER}/',
'webpath' => '/${CDASH_DIR_NAME}',
'outputdirectory' => '${CDash_BINARY_DIR}/tmp',
'type' => 'Nightly',
'site' => '${CDASH_SITE}',
'buildname' => '${CDASH_BUILD_NAME}',
'cdash' => 'http://www.cdash.org/CDash',
'svnroot' => '${CDash_SOURCE_DIR}',
'cdashpro' => '${CDASH_PRO}',
'github_username' => '${CDASH_GITHUB_USERNAME}',
'github_password' => '${CDASH_GITHUB_PASSWORD}'
);
?>
")
if(NOT CDASH_DB_TYPE)
set(CDASH_DB_TYPE "mysql")
endif(NOT CDASH_DB_TYPE)
set(CDASH_COVERAGE_DIR "${CDash_BINARY_DIR}/xdebugCoverage")
make_directory("${CDASH_COVERAGE_DIR}")
configure_file(${CDash_SOURCE_DIR}/tests/prepend_coverage.php.in
${CDash_BINARY_DIR}/prepend_coverage.php)
# For coverage builds on apache web servers, provide a default
# .htaccess file, but only if explicitly asked to:
option(CDASH_CONFIGURE_HTACCESS_FILE "Create .htaccess file for coverage testing?" OFF)
if(CDASH_CONFIGURE_HTACCESS_FILE)
configure_file(
${CDash_SOURCE_DIR}/tests/htaccess.in
${CDash_SOURCE_DIR}/public/.htaccess)
# Yes, the output of this configure_file is intentionally in the
# source directory
endif()
find_program(PHP_EXE NAMES php PATHS c:/xampp/php /xampp/php)
# Update composer during configure time.
find_program(COMPOSER
NAMES composer composer.phar
PATHS ${CMAKE_CURRENT_SOURCE_DIR}
)
if(NOT COMPOSER)
file(DOWNLOAD "http://getcomposer.org/composer.phar" "${CMAKE_CURRENT_SOURCE_DIR}/composer.phar")
set(COMPOSER "${CMAKE_CURRENT_SOURCE_DIR}/composer.phar")
endif()
execute_process(
COMMAND ${PHP_EXE} ${COMPOSER} install
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
# Also run "npm install" during configure time.
find_program(NPM NAMES npm)
execute_process(
COMMAND ${NPM} install
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
# Run gulp too.
find_program(GULP
NAMES gulp
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/node_modules/.bin
)
execute_process(
COMMAND ${GULP}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
if(CDASH_USE_SELENIUM)
find_program(PHPUNIT_EXE NAMES phpunit PATHS c:/xampp/php /xampp/php vendor/bin)
endif(CDASH_USE_SELENIUM)
option(CDASH_TESTING_RENAME_LOGS
"If on, kw_web_tester::deleteLog renames cdash.log instead of deleting it"
OFF)
if(CDASH_TESTING_RENAME_LOGS)
set(rename_logs "true")
else()
set(rename_logs "false")
endif()
set(CDASH_USE_LOCAL_DIRECTORY 0)
if(${CDASH_PRO})
set(CDASH_USE_LOCAL_DIRECTORY 1)
endif(${CDASH_PRO})
if (CDASH_USE_REDIS_QUEUE)
set(CDASH_BERNARD_SUBMISSION "true")
set(CDASH_BERNARD_DRIVER "new \\Bernard\\Driver\\PredisDriver(new \\Predis\\Client('tcp://localhost'))")
set(CDASH_BERNARD_CONSUMERS_WHITELIST "array('127.0.0.1')")
else()
set(CDASH_BERNARD_SUBMISSION "false")
set(CDASH_BERNARD_DRIVER "false")
set(CDASH_BERNARD_CONSUMERS_WHITELIST "false")
endif()
file(WRITE "${CDash_SOURCE_DIR}/config/config.local.php"
"<?php
// WARNING: This file is unconditionally overwritten by the CMake configure
// step: [${CMAKE_CURRENT_LIST_FILE}]
//
// Some of the CDash tests also inject config settings below as tests run...
//
date_default_timezone_set('America/New_York');
$CDASH_DB_NAME = 'cdash4simpletest';
$CDASH_TESTING_MODE = true;
$CDASH_REGISTRATION_EMAIL_VERIFY = false;
$CDASH_TESTING_RENAME_LOGS = ${rename_logs};
$CDASH_DB_HOST = '${CDASH_DB_HOST}';
$CDASH_DB_LOGIN = '${CDASH_DB_LOGIN}';
$CDASH_DB_PORT = '${CDASH_DB_PORT}';
$CDASH_DB_PASS = '${CDASH_DB_PASS}';
$CDASH_DB_TYPE = '${CDASH_DB_TYPE}';
$CDASH_DB_CONNECTION_TYPE = '${CDASH_DB_CONNECTION_TYPE}';
$CDASH_COVERAGE_DIR = '${CDASH_COVERAGE_DIR}';
$CDASH_LOG_LEVEL = LOG_DEBUG;
$PHP_EXE = '${PHP_EXE}';
$PHPUNIT_EXE = '${PHPUNIT_EXE}';
$CDASH_MANAGE_CLIENTS = '1';
$CDASH_DEFAULT_GIT_DIRECTORY = '${CDash_BINARY_DIR}';
$CDASH_USE_LOCAL_DIRECTORY = '${CDASH_USE_LOCAL_DIRECTORY}';
$CDASH_BASE_URL = '${CDASH_TESTING_URL}';
$CDASH_BERNARD_SUBMISSION = ${CDASH_BERNARD_SUBMISSION};
$CDASH_BERNARD_DRIVER = ${CDASH_BERNARD_DRIVER};
$CDASH_BERNARD_CONSUMERS_WHITELIST = ${CDASH_BERNARD_CONSUMERS_WHITELIST};
?>
")
# add the tests directory
add_subdirectory(tests)