Browse Source

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.
master
Julian Oes 3 years ago committed by Daniel Agar
parent
commit
7ddf43b443
  1. 8
      src/modules/mavlink/mavlink_tests/mavlink_ftp_test.cpp

8
src/modules/mavlink/mavlink_tests/mavlink_ftp_test.cpp

@ -700,7 +700,11 @@ bool MavlinkFtpTest::_removedirectory_test() @@ -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() @@ -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 },

Loading…
Cancel
Save