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.
This commit is contained in:
Julian Oes 2021-11-26 08:09:41 +01:00 committed by Daniel Agar
parent 7c90b06628
commit 7ddf43b443
1 changed files with 8 additions and 0 deletions

View File

@ -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 },