Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Project_Phoenix
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LuFG VR VIS
VR-Group
Project_Phoenix
Commits
f529d692
Commit
f529d692
authored
7 years ago
by
Thomas Vierjahn
Browse files
Options
Downloads
Patches
Plain Diff
Some reorganization
#251
parent
e4f64108
No related branches found
No related tags found
1 merge request
!128
Feature/#251 make sure tests cpp is compiled once
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmake/Testing.cmake
+37
-34
37 additions, 34 deletions
cmake/Testing.cmake
with
37 additions
and
34 deletions
cmake/Testing.cmake
+
37
−
34
View file @
f529d692
...
...
@@ -38,7 +38,7 @@ define_property(TARGET
FULL_DOCS
"Libraries to be added for mocking"
)
set_property
(
GLOBAL PROPERTY USE_FOLDERS ON
)
set_property
(
GLOBAL PROPERTY
ADDED
_TESTS
""
)
set_property
(
GLOBAL PROPERTY
TESTING__AVAILABLE
_TESTS
""
)
set
(
IS_BUILD_SERVER
FALSE CACHE BOOL
...
...
@@ -139,7 +139,7 @@ macro(ADD_SINGLE_TEST)
testing__set_timeout_
(
${
TEST_NAME
}
)
set_property
(
GLOBAL APPEND PROPERTY
ADDED
_TESTS
"
${
TEST_NAME
}
"
)
TESTING__AVAILABLE
_TESTS
"
${
TEST_NAME
}
"
)
endmacro
()
...
...
@@ -278,18 +278,28 @@ endmacro()
#-------------------------------------------------------------------------------
macro
(
EXTRACT_UNIT_AND_INTEGRATION_TEST_TARGETS
)
get_property
(
added_tests GLOBAL PROPERTY ADDED_TESTS
)
foreach
(
filename
${
added_tests
}
)
if
(
${
filename
}
MATCHES
"integration_test"
)
message
(
STATUS
"Integration Test:
${
filename
}
"
)
set
(
INTEGRATION_TEST_TARGETS
${
INTEGRATION_TEST_TARGETS
}
${
filename
}
)
else
()
message
(
STATUS
"Unit Test:
${
filename
}
"
)
set
(
UNIT_TEST_TARGETS
${
UNIT_TEST_TARGETS
}
${
filename
}
)
endif
()
endforeach
()
endmacro
()
function
(
CREATE_TEST_SUITES
)
testing__extract_unit_and_integration_test_targets_
()
ADD_TEST_SUITE
(
NAME
"Unit-Test-Suite"
TEST_REGEX
"^test"
DEPEND_ON_TARGETS
${
TESTING__UNIT_TESTS
}
)
ADD_TEST_SUITE
(
NAME
"Integration-Test-Suite"
TEST_REGEX
"^integration"
DEPEND_ON_TARGETS
${
TESTING__INTEGRATION_TESTS
}
)
ADD_TEST_SUITE
(
NAME
"Cpplint-Test-Suite"
TEST_REGEX
"cpplint"
)
ADD_TEST_SUITE
(
NAME
"Cppcheck-Test-Suite"
TEST_REGEX
"cppcheck"
)
endfunction
()
macro
(
ADD_TEST_SUITE
)
set
(
options
)
...
...
@@ -297,6 +307,7 @@ macro(ADD_TEST_SUITE)
set
(
multiValueArgs DEPEND_ON_TARGETS
)
cmake_parse_arguments
(
ADD_TEST_SUITE
"
${
options
}
"
"
${
oneValueArgs
}
"
"
${
multiValueArgs
}
"
${
ARGN
}
)
#we have to escape the " for visual studio)
add_custom_target
(
${
ADD_TEST_SUITE_NAME
}
COMMAND ctest --tests-regex \"
${
ADD_TEST_SUITE_TEST_REGEX
}
\" -C $<CONFIG>
)
# This comment just ends the escaped signs, for VS highlighting "
...
...
@@ -307,25 +318,17 @@ macro(ADD_TEST_SUITE)
endmacro
()
macro
(
TESTING__EXTRACT_UNIT_AND_INTEGRATION_TEST_TARGETS_
)
set
(
TESTING__INTEGRATION_TESTS
)
set
(
TESTING__UNIT_TESTS
)
function
(
CREATE_TEST_SUITES
)
EXTRACT_UNIT_AND_INTEGRATION_TEST_TARGETS
()
ADD_TEST_SUITE
(
NAME
"Unit-Test-Suite"
TEST_REGEX
"^test"
DEPEND_ON_TARGETS
${
UNIT_TEST_TARGETS
}
)
ADD_TEST_SUITE
(
NAME
"Integration-Test-Suite"
TEST_REGEX
"^integration"
DEPEND_ON_TARGETS
${
INTEGRATION_TEST_TARGETS
}
)
ADD_TEST_SUITE
(
NAME
"Cpplint-Test-Suite"
TEST_REGEX
"cpplint"
)
get_property
(
TESTING__AVAILABLE_TESTS GLOBAL PROPERTY TESTING__AVAILABLE_TESTS
)
foreach
(
CURRENT_TEST
${
TESTING__AVAILABLE_TESTS
}
)
if
(
${
CURRENT_TEST
}
MATCHES
"integration_test"
)
list
(
APPEND TESTING__INTEGRATION_TESTS
${
CURRENT_TEST
}
)
else
()
list
(
APPEND TESTING__UNIT_TESTS
${
CURRENT_TEST
}
)
endif
()
endforeach
()
endmacro
()
ADD_TEST_SUITE
(
NAME
"Cppcheck-Test-Suite"
TEST_REGEX
"cppcheck"
)
endfunction
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment