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
ed079eb2
Commit
ed079eb2
authored
Nov 13, 2017
by
jwendt
Browse files
Options
Downloads
Patches
Plain Diff
put different parts of test suite creation into methods
#182
parent
40893b01
No related branches found
No related tags found
1 merge request
!56
Feature/#182 test suites
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmake/Testing.cmake
+49
-29
49 additions, 29 deletions
cmake/Testing.cmake
with
49 additions
and
29 deletions
cmake/Testing.cmake
+
49
−
29
View file @
ed079eb2
...
@@ -126,37 +126,57 @@ function(ADD_TEST_CATCH)
...
@@ -126,37 +126,57 @@ function(ADD_TEST_CATCH)
endforeach
()
endforeach
()
endfunction
()
endfunction
()
function
(
CREATE_TEST_SUITE
S
)
macro
(
EXTRACT_UNIT_AND_INTEGRATION_TEST_TARGET
S
)
get_property
(
added_tests GLOBAL PROPERTY ADDED_TESTS
)
get_property
(
added_tests GLOBAL PROPERTY ADDED_TESTS
)
foreach
(
filename
${
added_tests
}
)
foreach
(
filename
${
added_tests
}
)
if
(
${
filename
}
MATCHES
"integration_test"
)
if
(
${
filename
}
MATCHES
"integration_test"
)
message
(
STATUS
"Integration Test:
${
filename
}
"
)
message
(
STATUS
"Integration Test:
${
filename
}
"
)
set
(
INTEGRATION_TESTS
${
INTEGRATION_TESTS
}
${
filename
}
)
set
(
INTEGRATION_TEST
_TARGET
S
${
INTEGRATION_TEST
_TARGET
S
}
${
filename
}
)
else
()
else
()
message
(
STATUS
"Unit Test:
${
filename
}
"
)
message
(
STATUS
"Unit Test:
${
filename
}
"
)
set
(
UNIT_TESTS
${
UNIT_TESTS
}
${
filename
}
)
set
(
UNIT_TEST
_TARGET
S
${
UNIT_TEST
_TARGET
S
}
${
filename
}
)
endif
()
endif
()
endforeach
()
endforeach
()
endmacro
()
if
(
"integration_test"
MATCHES
"^test"
)
macro
(
ADD_TEST_SUITE
)
message
(
"JOOOOOW"
)
set
(
options
)
set
(
oneValueArgs NAME TEST_REGEX
)
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 "
if
(
ADD_TEST_SUITE_DEPEND_ON_TARGETS
)
add_dependencies
(
${
ADD_TEST_SUITE_NAME
}
${
ADD_TEST_SUITE_DEPEND_ON_TARGETS
}
)
message
(
"
${
ADD_TEST_SUITE_DEPEND_ON_TARGETS
}
"
)
endif
()
endif
()
set_property
(
TARGET
${
ADD_TEST_SUITE_NAME
}
PROPERTY FOLDER
"_Test-Suites_"
)
endmacro
()
function
(
CREATE_TEST_SUITES
)
EXTRACT_UNIT_AND_INTEGRATION_TEST_TARGETS
()
message
(
${
INTEGRATION_TEST_TARGETS
}
)
#Add a Unit Test Suite (we have to escape the " for visual studio)
ADD_TEST_SUITE
(
add_custom_target
(
Unit-Test-Suite COMMAND ctest --tests-regex \"^test\" -C $<CONFIG>
)
NAME
"Unit-Test-Suite"
add_dependencies
(
Unit-Test-Suite
${
UNIT_TESTS
}
)
TEST_REGEX
"^test"
set_property
(
TARGET Unit-Test-Suite PROPERTY FOLDER
"_Test-Suites_"
)
DEPEND_ON_TARGETS
${
UNIT_TEST_TARGETS
}
)
#Add a Integration Test Suite
ADD_TEST_SUITE
(
add_custom_target
(
Integration-Test-Suite
COMMAND ctest --tests-regex \"^integration\" -C $<CONFIG>
)
NAME
"
Integration-Test-Suite
"
add_dependencies
(
Integration-Test-Suite
${
INTEGRATION_TESTS
}
)
TEST_REGEX
"^integration"
set_property
(
TARGET Integration-Test-Suite PROPERTY FOLDER
"_Test-Suites_"
)
DEPEND_ON_TARGETS
${
INTEGRATION_TEST_TARGETS
}
)
#Add a cpplint Test Suite
ADD_TEST_SUITE
(
add_custom_target
(
Cpplint-Test-Suite COMMAND ctest --tests-regex \"cpplint\" -C $<CONFIG>
)
NAME
"Cpplint-Test-Suite"
set_property
(
TARGET Cpplint-Test-Suite PROPERTY FOLDER
"_Test-Suites_
"
)
TEST_REGEX
"cpplint
"
)
#Add a cppcheck Test Suite
ADD_TEST_SUITE
(
add_custom_target
(
Cppcheck-Test-Suite
COMMAND ctest --tests-regex \"cppcheck\" -C $<CONFIG>
)
NAME
"
Cppcheck-Test-Suite
"
set_property
(
TARGET Cppcheck-Test-Suite PROPERTY FOLDER
"_Test-Suites_
"
)
TEST_REGEX
"cppcheck
"
)
endfunction
()
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