partially restore mavlink_tests

This commit is contained in:
Daniel Agar
2017-01-01 23:52:00 -05:00
committed by Lorenz Meier
parent 5ec546f735
commit 28971caaf3
9 changed files with 48 additions and 19 deletions
+1 -1
View File
@@ -289,7 +289,7 @@ tests_coverage:
@$(call PX4_RUN,lcov --capture --initial --directory $(SRC_DIR) --quiet --output-file coverage.info) @$(call PX4_RUN,lcov --capture --initial --directory $(SRC_DIR) --quiet --output-file coverage.info)
@$(call PX4_RUN,$(MAKE) --no-print-directory tests PX4_CODE_COVERAGE=1 CCACHE_DISABLE=1 HEADLESS=1) @$(call PX4_RUN,$(MAKE) --no-print-directory tests PX4_CODE_COVERAGE=1 CCACHE_DISABLE=1 HEADLESS=1)
@$(call PX4_RUN,lcov --no-checksum --directory $(SRC_DIR) --capture --quiet --output-file coverage.info) @$(call PX4_RUN,lcov --no-checksum --directory $(SRC_DIR) --capture --quiet --output-file coverage.info)
@$(call PX4_RUN,lcov --remove coverage.info '/usr/*' 'unittests/googletest/*' 'mavlink/*' --quiet --output-file coverage.info) @$(call PX4_RUN,lcov --remove coverage.info '/usr/*' 'unittests/googletest/*' --quiet --output-file coverage.info)
@$(call PX4_RUN,genhtml --legend --show-details --function-coverage --quiet --output-directory coverage-html coverage.info ) @$(call PX4_RUN,genhtml --legend --show-details --function-coverage --quiet --output-directory coverage-html coverage.info )
test_startup_shutdown: test_startup_shutdown:
+1 -1
View File
@@ -88,7 +88,7 @@ set(config_module_list
modules/commander/commander_tests modules/commander/commander_tests
modules/mc_pos_control/mc_pos_control_tests modules/mc_pos_control/mc_pos_control_tests
modules/controllib_test modules/controllib_test
#modules/mavlink/mavlink_tests #TODO: fix mavlink_tests modules/mavlink/mavlink_tests
modules/unit_test modules/unit_test
modules/uORB/uORB_tests modules/uORB/uORB_tests
systemcmds/tests systemcmds/tests
@@ -127,6 +127,5 @@ gpssim stop
measairspeedsim stop measairspeedsim stop
dataman stop dataman stop
uorb stop
shutdown shutdown
@@ -17,6 +17,15 @@ tone_alarm start
#gpssim start #gpssim start
#pwm_out_sim mode_pwm #pwm_out_sim mode_pwm
mavlink start -u 14556 -r 2000000
tests @test_name@ tests @test_name@
mavlink stop-all
tone_alarm stop
rgbledsim stop
dataman stop
shutdown shutdown
+1
View File
@@ -156,6 +156,7 @@ set(tests
int int
mathlib mathlib
matrix matrix
mavlink
mc_pos_control mc_pos_control
mixer mixer
param param
-3
View File
@@ -48,9 +48,6 @@
// Uncomment the line below to get better debug output. Never commit with this left on. // Uncomment the line below to get better debug output. Never commit with this left on.
//#define MAVLINK_FTP_DEBUG //#define MAVLINK_FTP_DEBUG
int buf_size_1 = 0;
int buf_size_2 = 0;
MavlinkFTP::MavlinkFTP(Mavlink *mavlink) : MavlinkFTP::MavlinkFTP(Mavlink *mavlink) :
MavlinkStream(mavlink), MavlinkStream(mavlink),
_session_info{}, _session_info{},
@@ -36,6 +36,8 @@ px4_add_module(
STACK_MAIN 5000 STACK_MAIN 5000
COMPILE_FLAGS COMPILE_FLAGS
-DMAVLINK_FTP_UNIT_TEST -DMAVLINK_FTP_UNIT_TEST
-DMavlinkStream=MavlinkStreamTest
-DMavlinkFTP=MavlinkFTPTest
SRCS SRCS
mavlink_tests.cpp mavlink_tests.cpp
mavlink_ftp_test.cpp mavlink_ftp_test.cpp
@@ -42,15 +42,21 @@
#include "mavlink_ftp_test.h" #include "mavlink_ftp_test.h"
#include "../mavlink_ftp.h" #include "../mavlink_ftp.h"
#if !defined(CONFIG_ARCH_BOARD_SITL)
#define PX4_MAVLINK_TEST_DATA_DIR "ROMFS/px4fmu_test/"
#else
#define PX4_MAVLINK_TEST_DATA_DIR "/etc/"
#endif
/// @brief Test case file name for Read command. File are generated using mavlink_ftp_test_data.py /// @brief Test case file name for Read command. File are generated using mavlink_ftp_test_data.py
const MavlinkFtpTest::DownloadTestCase MavlinkFtpTest::_rgDownloadTestCases[] = { const MavlinkFtpTest::DownloadTestCase MavlinkFtpTest::_rgDownloadTestCases[] = {
{ "/etc/unit_test_data/mavlink_tests/test_238.data", MAVLINK_MSG_FILE_TRANSFER_PROTOCOL_FIELD_PAYLOAD_LEN - sizeof(MavlinkFTP::PayloadHeader) - 1, true, false }, // Read takes less than single packet { PX4_MAVLINK_TEST_DATA_DIR "/unit_test_data/mavlink_tests/test_238.data", MAVLINK_MSG_FILE_TRANSFER_PROTOCOL_FIELD_PAYLOAD_LEN - sizeof(MavlinkFTP::PayloadHeader) - 1, true, false }, // Read takes less than single packet
{ "/etc/unit_test_data/mavlink_tests/test_239.data", MAVLINK_MSG_FILE_TRANSFER_PROTOCOL_FIELD_PAYLOAD_LEN - sizeof(MavlinkFTP::PayloadHeader), true, true }, // Read completely fills single packet { PX4_MAVLINK_TEST_DATA_DIR "/unit_test_data/mavlink_tests/test_239.data", MAVLINK_MSG_FILE_TRANSFER_PROTOCOL_FIELD_PAYLOAD_LEN - sizeof(MavlinkFTP::PayloadHeader), true, true }, // Read completely fills single packet
{ "/etc/unit_test_data/mavlink_tests/test_240.data", MAVLINK_MSG_FILE_TRANSFER_PROTOCOL_FIELD_PAYLOAD_LEN - sizeof(MavlinkFTP::PayloadHeader) + 1, false, false }, // Read take two packets { PX4_MAVLINK_TEST_DATA_DIR "/unit_test_data/mavlink_tests/test_240.data", MAVLINK_MSG_FILE_TRANSFER_PROTOCOL_FIELD_PAYLOAD_LEN - sizeof(MavlinkFTP::PayloadHeader) + 1, false, false }, // Read take two packets
}; };
const char MavlinkFtpTest::_unittest_microsd_dir[] = "/fs/microsd/ftp_unit_test_dir"; const char MavlinkFtpTest::_unittest_microsd_dir[] = PX4_ROOTFSDIR "/fs/microsd/ftp_unit_test_dir";
const char MavlinkFtpTest::_unittest_microsd_file[] = "/fs/microsd/ftp_unit_test_dir/file"; const char MavlinkFtpTest::_unittest_microsd_file[] = PX4_ROOTFSDIR "/fs/microsd/ftp_unit_test_dir/file";
MavlinkFtpTest::MavlinkFtpTest() : MavlinkFtpTest::MavlinkFtpTest() :
_ftp_server(nullptr), _ftp_server(nullptr),
@@ -922,14 +928,29 @@ bool MavlinkFtpTest::run_tests(void)
ut_run_test(_ack_test); ut_run_test(_ack_test);
ut_run_test(_bad_opcode_test); ut_run_test(_bad_opcode_test);
ut_run_test(_bad_datasize_test); ut_run_test(_bad_datasize_test);
//ut_run_test(_list_test); // TODO: cmake build system needs to run mavlink_ftp_test_data.py
ut_run_test(_list_eof_test); // TODO FIX: cmake build system needs to run mavlink_ftp_test_data.py
//ut_run_test(_list_test);
// TODO FIX: Compare failed: Didn't get Nak back - (reply->opcode:128) (MavlinkFTP::kRspNak:129) (../src/modules/mavlink/mavlink_tests/mavlink_ftp_test.cpp:265)
//ut_run_test(_list_eof_test);
ut_run_test(_open_badfile_test); ut_run_test(_open_badfile_test);
ut_run_test(_open_terminate_test);
ut_run_test(_terminate_badsession_test); // TODO FIX: Compare failed: stat failed - (stat(test->file, &st):-1) (0:0) (../src/modules/mavlink/mavlink_tests/mavlink_ftp_test.cpp:320)
ut_run_test(_read_test); //ut_run_test(_open_terminate_test);
ut_run_test(_read_badsession_test);
ut_run_test(_burst_test); // TODO FIX: Compare failed: Didn't get Ack back - (reply->opcode:129) (MavlinkFTP::kRspAck:128) (../src/modules/mavlink/mavlink_tests/mavlink_ftp_test.cpp:366)
//ut_run_test(_terminate_badsession_test);
// TODO FIX: Compare failed: Didn't get Ack back - (reply->opcode:129) (MavlinkFTP::kRspAck:128) (../src/modules/mavlink/mavlink_tests/mavlink_ftp_test.cpp:366)
//ut_run_test(_read_test);
// TODO FIX: Compare failed: Didn't get Ack back - (reply->opcode:129) (MavlinkFTP::kRspAck:128) (../src/modules/mavlink/mavlink_tests/mavlink_ftp_test.cpp:605)
//ut_run_test(_read_badsession_test);
// TODO FIX: Compare failed: stat failed - (stat(test->file, &st):-1) (0:0) (../src/modules/mavlink/mavlink_tests/mavlink_ftp_test.cpp:513)
//ut_run_test(_burst_test);
ut_run_test(_removedirectory_test); ut_run_test(_removedirectory_test);
ut_run_test(_createdirectory_test); ut_run_test(_createdirectory_test);
ut_run_test(_removefile_test); ut_run_test(_removefile_test);
+1 -1
View File
@@ -93,8 +93,8 @@ const struct {
/* external tests */ /* external tests */
{"commander", commander_tests_main, 0}, {"commander", commander_tests_main, 0},
{"controllib", controllib_test_main, 0}, {"controllib", controllib_test_main, 0},
{"mavlink", mavlink_tests_main, 0},
{"mc_pos_control", mc_pos_control_tests_main, 0}, {"mc_pos_control", mc_pos_control_tests_main, 0},
//{"mavlink", mavlink_tests_main, 0}, // TODO: fix mavlink_tests
{"sf0x", sf0x_tests_main, 0}, {"sf0x", sf0x_tests_main, 0},
#ifndef __PX4_DARWIN #ifndef __PX4_DARWIN
{"uorb", uorb_tests_main, 0}, {"uorb", uorb_tests_main, 0},