Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MostafaMollaali
dynamic
Commits
5b9bf5af
Commit
5b9bf5af
authored
10 years ago
by
Lars Bilke
Browse files
Options
Downloads
Patches
Plain Diff
Disable tests if a requirement is not met instead of aborting CMake.
parent
751ec970
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/cmake/test/AddTest.cmake
+12
-11
12 additions, 11 deletions
scripts/cmake/test/AddTest.cmake
scripts/cmake/test/Test.cmake
+22
-0
22 additions, 0 deletions
scripts/cmake/test/Test.cmake
with
34 additions
and
11 deletions
scripts/cmake/test/AddTest.cmake
+
12
−
11
View file @
5b9bf5af
...
@@ -59,18 +59,18 @@ function (AddTest)
...
@@ -59,18 +59,18 @@ function (AddTest)
# --- Implement wrappers ---
# --- Implement wrappers ---
# check requirements
# check requirements
, disable if not met
if
(
AddTest_WRAPPER STREQUAL
"time"
AND NOT TIME_TOOL_PATH
)
if
(
AddTest_WRAPPER STREQUAL
"time"
AND NOT TIME_TOOL_PATH
)
message
(
FATAL_ERROR
"time-command is required for time wrapper but was not found!"
)
return
(
)
endif
()
endif
()
if
(
AddTest_WRAPPER STREQUAL
"memcheck"
AND NOT VALGRIND_TOOL_PATH
)
if
(
AddTest_WRAPPER STREQUAL
"memcheck"
AND NOT VALGRIND_TOOL_PATH
)
message
(
FATAL_ERROR
"Valgrind is required for memcheck wrapper but was not found!"
)
return
(
)
endif
()
endif
()
if
(
AddTest_WRAPPER STREQUAL
"callgrind"
AND NOT VALGRIND_TOOL_PATH
)
if
(
AddTest_WRAPPER STREQUAL
"callgrind"
AND NOT VALGRIND_TOOL_PATH
)
message
(
FATAL_ERROR
"Valgrind is required for callgrind wrapper but was not found!"
)
return
(
)
endif
()
endif
()
if
(
AddTest_WRAPPER STREQUAL
"mpirun"
AND NOT MPIRUN_TOOL_PATH
)
if
(
AddTest_WRAPPER STREQUAL
"mpirun"
AND NOT MPIRUN_TOOL_PATH
)
message
(
FATAL_ERROR
"mpirun is required for mpirun wrapper but was not found!"
)
return
(
)
endif
()
endif
()
if
(
AddTest_WRAPPER STREQUAL
"time"
)
if
(
AddTest_WRAPPER STREQUAL
"time"
)
...
@@ -86,19 +86,20 @@ function (AddTest)
...
@@ -86,19 +86,20 @@ function (AddTest)
endif
()
endif
()
# --- Implement testers ---
# --- Implement testers ---
# check requirements
# check requirements
, disable if not met
if
(
AddTest_TESTER STREQUAL
"diff"
AND NOT DIFF_TOOL_PATH
)
if
(
AddTest_TESTER STREQUAL
"diff"
AND NOT DIFF_TOOL_PATH
)
message
(
FATAL_ERROR
"diff-command is required for diff tester but was not found!"
)
return
(
)
endif
()
endif
()
if
(
AddTest_TESTER STREQUAL
"numdiff"
AND NOT NUMDIFF_TOOL_PATH
)
if
(
AddTest_TESTER STREQUAL
"numdiff"
AND NOT NUMDIFF_TOOL_PATH
)
message
(
FATAL_ERROR
"numdiff-command is required for numdiff tester but was not found!"
)
return
(
)
endif
()
endif
()
if
(
AddTest_TESTER STREQUAL
"memcheck"
AND NOT GREP_TOOL_PATH
)
return
()
endif
()
if
((
AddTest_TESTER STREQUAL
"diff"
OR AddTest_TESTER STREQUAL
"numdiff"
)
AND NOT AddTest_DIFF_DATA
)
if
((
AddTest_TESTER STREQUAL
"diff"
OR AddTest_TESTER STREQUAL
"numdiff"
)
AND NOT AddTest_DIFF_DATA
)
message
(
FATAL_ERROR
"AddTest():
${
AddTest_NAME
}
- no DIFF_DATA given!"
)
message
(
FATAL_ERROR
"AddTest():
${
AddTest_NAME
}
- no DIFF_DATA given!"
)
endif
()
endif
()
if
(
AddTest_TESTER STREQUAL
"memcheck"
AND NOT GREP_TOOL_PATH
)
message
(
FATAL_ERROR
"grep-command is required for memcheck tester but was not found!"
)
endif
()
if
(
AddTest_TESTER STREQUAL
"diff"
)
if
(
AddTest_TESTER STREQUAL
"diff"
)
set
(
SELECTED_DIFF_TOOL_PATH
${
DIFF_TOOL_PATH
}
)
set
(
SELECTED_DIFF_TOOL_PATH
${
DIFF_TOOL_PATH
}
)
...
...
This diff is collapsed.
Click to expand it.
scripts/cmake/test/Test.cmake
+
22
−
0
View file @
5b9bf5af
...
@@ -8,6 +8,28 @@ FIND_PROGRAM(BASH_TOOL_PATH bash)
...
@@ -8,6 +8,28 @@ FIND_PROGRAM(BASH_TOOL_PATH bash)
FIND_PROGRAM
(
VALGRIND_TOOL_PATH valgrind
)
FIND_PROGRAM
(
VALGRIND_TOOL_PATH valgrind
)
FIND_PROGRAM
(
MPIRUN_TOOL_PATH mpirun
)
FIND_PROGRAM
(
MPIRUN_TOOL_PATH mpirun
)
if
(
NOT TIME_TOOL_PATH
)
message
(
STATUS
"time-command is required for time wrapper but was not found! All corresponding tests are disabled."
)
endif
()
if
(
NOT VALGRIND_TOOL_PATH
)
message
(
STATUS
"Valgrind is required for memcheck wrapper but was not found! All corresponding tests are disabled."
)
endif
()
if
(
NOT VALGRIND_TOOL_PATH
)
message
(
STATUS
"Valgrind is required for callgrind wrapper but was not found! All corresponding tests are disabled."
)
endif
()
if
(
NOT MPIRUN_TOOL_PATH
)
message
(
STATUS
"mpirun is required for mpirun wrapper but was not found! All corresponding tests are disabled."
)
endif
()
if
(
NOT DIFF_TOOL_PATH
)
message
(
STATUS
"diff-command is required for diff tester but was not found! All corresponding tests are disabled."
)
endif
()
if
(
NOT NUMDIFF_TOOL_PATH
)
message
(
STATUS
"numdiff-command is required for numdiff tester but was not found! All corresponding tests are disabled."
)
endif
()
if
(
NOT GREP_TOOL_PATH
)
message
(
STATUS
"grep-command is required for memcheck tester but was not found! All corresponding tests are disabled."
)
endif
()
ENABLE_TESTING
()
# Enable CTest
ENABLE_TESTING
()
# Enable CTest
# See http://www.vtk.org/Wiki/CMake/Testing_With_CTest for some customization options
# See http://www.vtk.org/Wiki/CMake/Testing_With_CTest for some customization options
...
...
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