From 7ddf43b443b29b03f2b5d73bd0d4cda412644a99 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Fri, 26 Nov 2021 08:09:41 +0100 Subject: [PATCH] mavlink_ftp: fix tests on Nuttx On Nuttx we have an additional check whether the directory is accessible to check if we are trying to write to storage that is not on the SD card. This returns the FileProtected error whereas on Linux this just ends up being a FileNotFound. The ifdefs around this issue are not pretty but the alternatives of either removing the tests for /bogus folders, or removing the additional check on the NuttX side don't seem better either. --- src/modules/mavlink/mavlink_tests/mavlink_ftp_test.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/modules/mavlink/mavlink_tests/mavlink_ftp_test.cpp b/src/modules/mavlink/mavlink_tests/mavlink_ftp_test.cpp index 981035594e..574a5164ad 100644 --- a/src/modules/mavlink/mavlink_tests/mavlink_ftp_test.cpp +++ b/src/modules/mavlink/mavlink_tests/mavlink_ftp_test.cpp @@ -700,7 +700,11 @@ bool MavlinkFtpTest::_removedirectory_test() uint8_t error_code; }; static const struct _testCase rgTestCases[] = { +#ifdef __PX4_NUTTX + { "/bogus", false, false, 1, MavlinkFTP::kErrFailFileProtected }, +#else { "/bogus", false, false, 1, MavlinkFTP::kErrFileNotFound }, +#endif { _unittest_microsd_dir, false, false, 2, MavlinkFTP::kErrFailErrno }, { _unittest_microsd_file, false, false, 2, MavlinkFTP::kErrFailErrno }, { _unittest_microsd_dir, true, true, 0, MavlinkFTP::kErrNone }, @@ -808,7 +812,11 @@ bool MavlinkFtpTest::_removefile_test() uint8_t error_code; }; static const struct _testCase rgTestCases[] = { +#ifdef __PX4_NUTTX + { "/bogus", false, 1, MavlinkFTP::kErrFailFileProtected }, +#else { "/bogus", false, 1, MavlinkFTP::kErrFileNotFound }, +#endif { _unittest_microsd_dir, false, 2, MavlinkFTP::kErrFailErrno }, { _unittest_microsd_file, true, 0, MavlinkFTP::kErrNone }, { _unittest_microsd_file, false, 1, MavlinkFTP::kErrFileNotFound },