3044.2.1
by Łukasz 'sil2100' Zemczak
Added run-with-xvfb.sh from Unity-2d for enabling testing in a non-headless environment. |
1 |
# Based on gtest's GTEST_ADD_TESTS, but with run-with-xvfb.sh
|
2 |
function(ENV_GTEST_ADD_TESTS executable extra_args) |
|
3 |
if(NOT ARGN) |
|
4 |
message(FATAL_ERROR "Missing ARGN") |
|
5 |
endif() |
|
6 |
foreach(source ${ARGN}) |
|
7 |
file(READ "${source}" contents) |
|
8 |
string(REGEX MATCHALL "TEST_?F?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents}) |
|
9 |
foreach(hit ${found_tests}) |
|
10 |
string(REGEX REPLACE ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name ${hit}) |
|
11 |
add_test(${test_name} "/bin/bash" "${CMAKE_SOURCE_DIR}/scripts/run-with-xvfb.sh" "./${executable} --gtest_filter=${test_name} ${extra_args}") |
|
12 |
endforeach() |
|
13 |
endforeach() |
|
14 |
endfunction() |