diff --git a/boards/emlid/navio2/cross.cmake b/boards/emlid/navio2/cross.cmake index 21b05878468bd4838fa9c73be632ef62461dd7a9..d5e1cc038faee3eaf3228790864a315ca4d51eeb 100644 --- a/boards/emlid/navio2/cross.cmake +++ b/boards/emlid/navio2/cross.cmake @@ -85,6 +85,7 @@ px4_add_board( EXAMPLES bottle_drop # OBC challenge + dyn_hello # dynamically loading modules example fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello #hwtest # Hardware test diff --git a/boards/emlid/navio2/native.cmake b/boards/emlid/navio2/native.cmake index d7fe1c66ad3663cfa3be6063306ef7c7f9daaf21..23b11f1d5f220b072285d89883f14c1782c81937 100644 --- a/boards/emlid/navio2/native.cmake +++ b/boards/emlid/navio2/native.cmake @@ -83,6 +83,7 @@ px4_add_board( EXAMPLES bottle_drop # OBC challenge + dyn_hello # dynamically loading modules example fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello #hwtest # Hardware test diff --git a/boards/px4/raspberrypi/cross.cmake b/boards/px4/raspberrypi/cross.cmake index 15d75d0760243371af37e89c99c0ba0c14cb324f..c37217e6c6ee63e8ba417361d11173b1e663ca8c 100644 --- a/boards/px4/raspberrypi/cross.cmake +++ b/boards/px4/raspberrypi/cross.cmake @@ -5,7 +5,7 @@ px4_add_board( LABEL cross PLATFORM posix ARCHITECTURE cortex-a53 - TOOLCHAIN Toolchain-arm-linux-gnueabihf + TOOLCHAIN arm-linux-gnueabihf TESTING DRIVERS @@ -64,6 +64,7 @@ px4_add_board( pwm reboot sd_bench + shutdown tests # tests and test runner top topic_listener @@ -72,6 +73,7 @@ px4_add_board( EXAMPLES bottle_drop # OBC challenge + dyn_hello # dynamically loading modules example fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello #hwtest # Hardware test diff --git a/boards/px4/raspberrypi/native.cmake b/boards/px4/raspberrypi/native.cmake index 01257d2a9dc0d1bbe2a5eaf3ac8de0dba3a412bc..80a714db6c68263f962d2002fa6154516a791800 100644 --- a/boards/px4/raspberrypi/native.cmake +++ b/boards/px4/raspberrypi/native.cmake @@ -47,6 +47,7 @@ px4_add_board( navigator position_estimator_inav sensors + #simulator #uavcan vtol_att_control wind_estimator @@ -62,6 +63,7 @@ px4_add_board( pwm reboot sd_bench + shutdown tests # tests and test runner top topic_listener @@ -70,6 +72,7 @@ px4_add_board( EXAMPLES bottle_drop # OBC challenge + dyn_hello # dynamically loading modules example fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello #hwtest # Hardware test diff --git a/boards/px4/sitl/default.cmake b/boards/px4/sitl/default.cmake index 184a8c00ea2baa2b5d7d116dbd69c55dabf5f0b8..b960ccce8f3ecaba1490770280f895bcbfc813fb 100644 --- a/boards/px4/sitl/default.cmake +++ b/boards/px4/sitl/default.cmake @@ -73,6 +73,7 @@ px4_add_board( EXAMPLES bottle_drop # OBC challenge + dyn_hello # dynamically loading modules example fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello #hwtest # Hardware test diff --git a/boards/px4/sitl/rtps.cmake b/boards/px4/sitl/rtps.cmake index 9be0cde875c94a5e3da45dfbd1eb8c55caab75c5..fae8d89331218d614342d9654bdae5f327b10b35 100644 --- a/boards/px4/sitl/rtps.cmake +++ b/boards/px4/sitl/rtps.cmake @@ -75,6 +75,7 @@ px4_add_board( EXAMPLES bottle_drop # OBC challenge + dyn_hello # dynamically loading modules example fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello #hwtest # Hardware test diff --git a/boards/px4/sitl/test.cmake b/boards/px4/sitl/test.cmake index 2c541dfee9eac0003c969ce9b2bf54ea5dd6be24..3dcb200120edd2efe78a9fcb123576e0f37d3d33 100644 --- a/boards/px4/sitl/test.cmake +++ b/boards/px4/sitl/test.cmake @@ -73,6 +73,7 @@ px4_add_board( EXAMPLES bottle_drop # OBC challenge + dyn_hello # dynamically loading modules example fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello #hwtest # Hardware test diff --git a/platforms/posix/cmake/sitl_tests.cmake b/platforms/posix/cmake/sitl_tests.cmake index 11cca7cf1a481cae3c5256c3e2c047e5cfe7fc0b..4d1f5990706fcb8c6c6618dd9065684182cecbfb 100644 --- a/platforms/posix/cmake/sitl_tests.cmake +++ b/platforms/posix/cmake/sitl_tests.cmake @@ -100,18 +100,18 @@ set_tests_properties(shutdown PROPERTIES PASS_REGULAR_EXPRESSION "Shutting down" sanitizer_fail_test_on_error(shutdown) # Dynamic module loading test -#add_test(NAME dyn -# COMMAND ${PX4_SOURCE_DIR}/Tools/sitl_run.sh -# $<TARGET_FILE:px4> -# none -# none -# test_dyn_hello -# ${PX4_SOURCE_DIR} -# ${PX4_BINARY_DIR} -# $<TARGET_FILE:platforms__posix__tests__dyn_hello> -# WORKING_DIRECTORY ${SITL_WORKING_DIR}) -#set_tests_properties(dyn PROPERTIES PASS_REGULAR_EXPRESSION "1: PASSED") -#sanitizer_fail_test_on_error(dyn) +add_test(NAME dyn + COMMAND ${PX4_SOURCE_DIR}/Tools/sitl_run.sh + $<TARGET_FILE:px4> + none + none + test_dyn_hello + ${PX4_SOURCE_DIR} + ${PX4_BINARY_DIR} + $<TARGET_FILE:examples__dyn_hello> + WORKING_DIRECTORY ${SITL_WORKING_DIR}) +set_tests_properties(dyn PROPERTIES PASS_REGULAR_EXPRESSION "1: PASSED") +sanitizer_fail_test_on_error(dyn) # run arbitrary commands set(test_cmds @@ -140,7 +140,9 @@ endforeach() add_custom_target(test_results COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -T Test - DEPENDS px4 #platforms__posix__tests__dyn_hello + DEPENDS + px4 + examples__dyn_hello USES_TERMINAL COMMENT "Running tests in sitl" WORKING_DIRECTORY ${PX4_BINARY_DIR}) diff --git a/posix-configs/SITL/init/test/test_dyn_hello b/posix-configs/SITL/init/test/test_dyn_hello index e323fa95c27ee25307bce1d155424278e6ed555c..a97ff51d60225e25ab2f71af3d7bbbfa2c896665 100644 --- a/posix-configs/SITL/init/test/test_dyn_hello +++ b/posix-configs/SITL/init/test/test_dyn_hello @@ -3,6 +3,6 @@ # (px4-alias.sh is expected to be in the PATH) . px4-alias.sh -dyn ./platforms__posix__tests__dyn_hello.px4mod PASSED +dyn ./examples__dyn_hello.px4mod PASSED shutdown diff --git a/src/examples/dyn_hello/CMakeLists.txt b/src/examples/dyn_hello/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..99c47bdafdc90692e2ef9e3c12a118a519a80596 --- /dev/null +++ b/src/examples/dyn_hello/CMakeLists.txt @@ -0,0 +1,41 @@ +############################################################################ +# +# Copyright (c) 2018 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +px4_add_module( + MODULE examples__dyn_hello + MAIN hello + SRCS + hello.cpp + DEPENDS + DYNAMIC + ) diff --git a/src/platforms/posix/tests/dyn_hello/hello.cpp b/src/examples/dyn_hello/hello.cpp similarity index 100% rename from src/platforms/posix/tests/dyn_hello/hello.cpp rename to src/examples/dyn_hello/hello.cpp diff --git a/src/platforms/posix/tests/dyn_hello/CMakeLists.txt b/src/platforms/posix/tests/dyn_hello/CMakeLists.txt deleted file mode 100644 index fd1577b8db66f3ab3d169589e095b4519451ce77..0000000000000000000000000000000000000000 --- a/src/platforms/posix/tests/dyn_hello/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -px4_add_module( - MODULE platforms__posix__tests__dyn_hello - MAIN hello - SRCS - hello.cpp - DEPENDS - DYNAMIC - )