Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
cbd230e3
Commit
cbd230e3
authored
5 years ago
by
Matthias Grob
Browse files
Options
Downloads
Patches
Plain Diff
Testing: Clean up unit_test target because test_results does all tests now
parent
d8e0d641
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CMakeLists.txt
+15
-3
15 additions, 3 deletions
CMakeLists.txt
Makefile
+1
-7
1 addition, 7 deletions
Makefile
cmake/gtest/px4_add_gtest.cmake
+2
-2
2 additions, 2 deletions
cmake/gtest/px4_add_gtest.cmake
platforms/posix/cmake/sitl_tests.cmake
+0
-13
0 additions, 13 deletions
platforms/posix/cmake/sitl_tests.cmake
with
18 additions
and
25 deletions
CMakeLists.txt
+
15
−
3
View file @
cbd230e3
...
...
@@ -416,18 +416,30 @@ endif()
# optionally enable cmake testing (supported only on posix)
option
(
CMAKE_TESTING
"Configure test targets"
OFF
)
if
(
CMAKE_TESTING
)
include
(
CTest
)
include
(
CTest
)
# sets BUILD_TESTING variable
endif
()
# enable test filtering to run only specific tests with the ctest -R regex functionality
set
(
TESTFILTER
""
CACHE STRING
"Filter string for ctest to selectively only run specific tests (ctest -R)"
)
# if testing is enabled download and configure gtest
list
(
APPEND CMAKE_MODULE_PATH
${
PX4_SOURCE_DIR
}
/cmake/gtest/
)
include
(
px4_add_gtest
)
if
(
BUILD_TESTING
)
include
(
gtest
)
add_custom_target
(
unit_test COMMAND GTEST_COLOR=1
${
CMAKE_CTEST_COMMAND
}
-V -R
${
TESTFILTER
}
USES_TERMINAL
)
endif
()
add_custom_target
(
test_results
COMMAND GTEST_COLOR=1
${
CMAKE_CTEST_COMMAND
}
--output-on-failure -T Test -R
${
TESTFILTER
}
USES_TERMINAL
DEPENDS
px4
examples__dyn_hello
test_mixer_multirotor
USES_TERMINAL
COMMENT
"Running tests"
WORKING_DIRECTORY
${
PX4_BINARY_DIR
}
)
set_target_properties
(
test_results PROPERTIES EXCLUDE_FROM_ALL TRUE
)
#=============================================================================
# subdirectories
#
...
...
This diff is collapsed.
Click to expand it.
Makefile
+
1
−
7
View file @
cbd230e3
...
...
@@ -340,15 +340,9 @@ format:
# Testing
# --------------------------------------------------------------------
.PHONY
:
tests tests_coverage tests_mission tests_mission_coverage tests_offboard tests_avoidance
unit_test
.PHONY
:
tests tests_coverage tests_mission tests_mission_coverage tests_offboard tests_avoidance
.PHONY
:
rostest python_coverage
unit_test
:
$(
eval
CMAKE_ARGS +
=
-DCMAKE_TESTING
=
ON
)
$(
eval
CMAKE_ARGS +
=
-DCONFIG
=
px4_sitl_test
)
$(
eval
ARGS +
=
unit_test
)
$(
call cmake-build,px4_sitl_test
)
tests
:
$(
eval
CMAKE_ARGS +
=
-DCMAKE_TESTING
=
ON
)
$(
eval
CMAKE_ARGS +
=
-DCONFIG
=
px4_sitl_test
)
...
...
This diff is collapsed.
Click to expand it.
cmake/gtest/px4_add_gtest.cmake
+
2
−
2
View file @
cbd230e3
...
...
@@ -37,7 +37,7 @@ include(px4_base)
#
# px4_add_gtest
#
# Adds a googletest unit test to the
uni
t_
t
es
t
target.
# Adds a googletest unit test to the
tes
t_
r
es
ults
target.
#
function
(
px4_add_gtest
)
# skip if unit testing is not configured
...
...
@@ -65,6 +65,6 @@ function(px4_add_gtest)
add_test
(
NAME
${
TESTNAME
}
COMMAND
${
TESTNAME
}
)
# attach it to the unit test target
add_dependencies
(
uni
t_
t
es
t
${
TESTNAME
}
)
add_dependencies
(
tes
t_
r
es
ults
${
TESTNAME
}
)
endif
()
endfunction
()
This diff is collapsed.
Click to expand it.
platforms/posix/cmake/sitl_tests.cmake
+
0
−
13
View file @
cbd230e3
...
...
@@ -145,19 +145,6 @@ foreach(cmd_name ${test_cmds})
set_tests_properties
(
posix_
${
cmd_name
}
PROPERTIES PASS_REGULAR_EXPRESSION
"Shutting down"
)
endforeach
()
add_custom_target
(
test_results
COMMAND
${
CMAKE_CTEST_COMMAND
}
--output-on-failure -T Test -R
${
TESTFILTER
}
DEPENDS
px4
examples__dyn_hello
test_mixer_multirotor
unit_test
USES_TERMINAL
COMMENT
"Running tests in sitl"
WORKING_DIRECTORY
${
PX4_BINARY_DIR
}
)
set_target_properties
(
test_results PROPERTIES EXCLUDE_FROM_ALL TRUE
)
if
(
CMAKE_BUILD_TYPE STREQUAL Coverage
)
setup_target_for_coverage
(
test_coverage
"
${
CMAKE_CTEST_COMMAND
}
--output-on-failure -T Test"
tests
)
setup_target_for_coverage
(
generate_coverage
"
${
CMAKE_COMMAND
}
-E echo"
generic
)
...
...
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