Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 7f98260

Browse files
author
Jamie Snape
committed
Write CTest generated files to CMAKE_BINARY_DIR to avoid permissions issues
1 parent 3b43a72 commit 7f98260

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,21 @@ if(NOT COMPOSER_LOCK)
6363
message(STATUS "Executing composer install - done")
6464
endif()
6565

66+
#-----------------------------------------------------------------------------
67+
# Create data, local configs, logs, and temporary directories for testing
68+
#-----------------------------------------------------------------------------
69+
set(ENV{midas_data_path} ${CMAKE_CURRENT_BINARY_DIR}/data)
70+
file(MAKE_DIRECTORY $ENV{midas_data_path})
71+
72+
set(ENV{midas_local_configs_path} ${CMAKE_CURRENT_BINARY_DIR}/configs)
73+
file(MAKE_DIRECTORY $ENV{midas_local_configs_path})
74+
75+
set(ENV{midas_logs_path} ${CMAKE_CURRENT_BINARY_DIR}/logs)
76+
file(MAKE_DIRECTORY $ENV{midas_logs_path})
77+
78+
set(ENV{midas_temp_path} ${CMAKE_CURRENT_BINARY_DIR}/tmp)
79+
file(MAKE_DIRECTORY $ENV{midas_temp_path})
80+
6681
#-----------------------------------------------------------------------------
6782
# Drop all tables from the testing database, then reinstall the database, set
6883
# a default asset store, and install all modules

tests/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ endfunction()
3939

4040
function(add_midas_mysql_test TestName TestFile)
4141
if(EXISTS ${CMAKE_SOURCE_DIR}/tests/configs/mysql.ini)
42+
set(Environment "midas_data_path=$ENV{midas_data_path};midas_local_configs_path=$ENV{midas_local_configs_path};midas_logs_path=$ENV{midas_logs_path};midas_temp_path=$ENV{midas_temp_path}")
4243
set(TestParams --debug --bootstrap ${CMAKE_SOURCE_DIR}/tests/TestsBootstrap.php)
4344
add_test(
4445
MySQL${TestName}
@@ -48,12 +49,14 @@ function(add_midas_mysql_test TestName TestFile)
4849
MySQL${TestName} PROPERTIES
4950
FAIL_REGULAR_EXPRESSION ".*Failures: [1-9]+.*;.*Exceptions: [1-9]+.*"
5051
RESOURCE_LOCK MIDASDatabase
52+
ENVIRONMENT "${Environment}"
5153
)
5254
endif()
5355
endfunction()
5456

5557
function(add_midas_pgsql_test TestName TestFile)
5658
if(EXISTS ${CMAKE_SOURCE_DIR}/tests/configs/pgsql.ini)
59+
set(Environment "midas_data_path=$ENV{midas_data_path};midas_local_configs_path=$ENV{midas_local_configs_path};midas_logs_path=$ENV{midas_logs_path};midas_temp_path=$ENV{midas_temp_path}")
5760
set(TestParams --debug --bootstrap ${CMAKE_SOURCE_DIR}/tests/TestsBootstrap.php)
5861
add_test(
5962
PgSQL${TestName}
@@ -63,12 +66,14 @@ function(add_midas_pgsql_test TestName TestFile)
6366
PgSQL${TestName} PROPERTIES
6467
FAIL_REGULAR_EXPRESSION ".*Failures: [1-9]+.*;.*Exceptions: [1-9]+.*"
6568
RESOURCE_LOCK MIDASDatabase
69+
ENVIRONMENT "${Environment}"
6670
)
6771
endif()
6872
endfunction()
6973

7074
function(add_midas_sqlite_test TestName TestFile)
7175
if(EXISTS ${CMAKE_SOURCE_DIR}/tests/configs/sqlite.ini)
76+
set(Environment "midas_data_path=$ENV{midas_data_path};midas_local_configs_path=$ENV{midas_local_configs_path};midas_logs_path=$ENV{midas_logs_path};midas_temp_path=$ENV{midas_temp_path}")
7277
set(TestParams --debug --bootstrap ${CMAKE_SOURCE_DIR}/tests/TestsBootstrap.php)
7378
add_test(
7479
SQLite${TestName}
@@ -78,6 +83,7 @@ function(add_midas_sqlite_test TestName TestFile)
7883
SQLite${TestName} PROPERTIES
7984
FAIL_REGULAR_EXPRESSION ".*Failures: [1-9]+.*;.*Exceptions: [1-9]+.*"
8085
RESOURCE_LOCK MIDASDatabase
86+
ENVIRONMENT "${Environment}"
8187
)
8288
endif()
8389
endfunction()

0 commit comments

Comments
 (0)