Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration Candidate: 2020-04-22 #440

Merged
merged 12 commits into from
May 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 52 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,55 @@ addons:
sources:
- ubuntu-toolchain-r-test
packages:
- cmake

before_install:
- sudo apt-get install cppcheck

script:
# Check versions
- cppcheck --version

#cppcheck flight software osal/src/bsp, osal/src/os
- cppcheck --force --inline-suppr --std=c99 --language=c --error-exitcode=1 --enable=warning,performance,portability,style --suppress=variableScope --inconclusive src/bsp src/os 2>cppcheck_flight_osal.txt
- |
if [[ -s cppcheck_flight_osal.txt ]]; then
echo "You must fix cppcheck errors before submitting a pull request"
echo ""
cat cppcheck_flight_osal.txt
exit -1
fi

- cmake cppcheck lcov

_functional_test: &functional_test
script:
# Check versions
- cppcheck --version

#cppcheck flight software osal/src/bsp, osal/src/os
- cppcheck --force --inline-suppr --std=c99 --language=c --error-exitcode=1
--enable=warning,performance,portability,style --suppress=variableScope
--inconclusive --quiet src/bsp src/os 2>cppcheck_flight_osal.txt
- |
if [[ -s cppcheck_flight_osal.txt ]]; then
echo "You must fix cppcheck errors before submitting a pull request"
echo ""
cat cppcheck_flight_osal.txt
exit -1
fi

# Setup
- mkdir build
- cd build

# Prep and build
- cmake -DENABLE_UNIT_TESTS=true -DOSAL_SYSTEM_OSTYPE=posix -DOSAL_SYSTEM_BSPTYPE=pc-linux
-DOSAL_INCLUDEDIR=src/bsp/pc-linux/config/ ..
- make

# lcov capture pre-execution
- lcov --rc lcov_branch_coverage=1 --capture --initial --directory ./ --output-file coverage_base.info

# Test
- make test

# lcov post run analysis
- lcov --rc lcov_branch_coverage=1 --capture --directory ./ --output-file coverage_test.info
- lcov --rc lcov_branch_coverage=1 --add-tracefile coverage_base.info --add-tracefile
coverage_test.info --output-file coverage_total.info
- lcov --rc lcov_branch_coverage=1 --remove coverage_total.info '*unit-test-coverage*'
--output-file coverage_filtered.info
- genhtml coverage_filtered.info --output-directory lcov

jobs:
include:
- env: BUILDTYPE=release OSAL_OMIT_DEPRECATED=true
<<: *functional_test
- env: BUILDTYPE=release OSAL_OMIT_DEPRECATED=false
<<: *functional_test
- env: BUILDTYPE=debug OSAL_OMIT_DEPRECATED=true
<<: *functional_test
- env: BUILDTYPE=debug OSAL_OMIT_DEPRECATED=false
<<: *functional_test
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ This distribution contains:

## Version History

#### Development Build: 5.0.14
- Adds library build, functional, and coverage test to CI
- Deprecates `OS_FS_SUCCESS, OS_FS_ERROR , OS_FS_ERR_INVALID_POINTER, OS_FS_ERR_NO_FREE_FDS , OS_FS_ERR_INVALID_FD, and OS_FS_UNIMPLEMENTED` from from `osapi-os-filesys.h`
- Individual directory names now limited to OS_MAX_FILE_NAME
- Fix tautology, local_idx1 is now compared with local_idx2
- Module files are generated when the `osal_loader_UT` test is built and run
- Consistent osal-core-test execution status
- See https://github.com/nasa/osal/pull/440 for more details

#### Development Build: 5.0.13
- Added coverage test to `OS_TimerCreate` for `OS_ERR_NAME_TOO_LONG`.
- Externalize enum for `SelectSingle`, ensures that pointers passed to `SelectFd...()` APIs are not null, ensures that pointer to `SelectSingle` is not null.
Expand Down
2 changes: 1 addition & 1 deletion src/bsp/mcp750-vxworks/config/osconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#define OS_MAX_API_NAME 20

/*
** The maximum length for a file name
** The maximum length (including null terminator) for a file name
*/
#define OS_MAX_FILE_NAME 20

Expand Down
2 changes: 1 addition & 1 deletion src/bsp/pc-linux/config/osconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#define OS_MAX_API_NAME 20

/*
** The maximum length for a file name
** The maximum length (including null terminator) for a file name
*/
#define OS_MAX_FILE_NAME 20

Expand Down
2 changes: 1 addition & 1 deletion src/bsp/pc-rtems/config/osconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#define OS_MAX_API_NAME 20

/*
** The maximum length for a file name
** The maximum length (including null terminator) for a file name
*/
#define OS_MAX_FILE_NAME 20

Expand Down
19 changes: 10 additions & 9 deletions src/os/inc/osapi-os-filesys.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,18 @@
#define OS_FS_ERR_DEVICE_NOT_FREE (-107) /**< @brief FS device not free */
#define OS_FS_ERR_PATH_INVALID (-108) /**< @brief FS path invalid */


#ifndef OSAL_OMIT_DEPRECATED
/*
* Map some codes used by the file API back to the generic counterparts
* where there is overlap between them. Do not duplicate error codes.
*/
#define OS_FS_SUCCESS OS_SUCCESS /**< @brief Successful execution */
#define OS_FS_ERROR OS_ERROR /**< @brief Failed execution */
#define OS_FS_ERR_INVALID_POINTER OS_INVALID_POINTER /**< @brief Invalid pointer */
#define OS_FS_ERR_NO_FREE_FDS OS_ERR_NO_FREE_IDS /**< @brief No free IDs */
#define OS_FS_ERR_INVALID_FD OS_ERR_INVALID_ID /**< @brief Invalid ID */
#define OS_FS_UNIMPLEMENTED OS_ERR_NOT_IMPLEMENTED /**< @brief Not implemented */
#define OS_FS_SUCCESS OS_SUCCESS /**< @deprecated Successful execution */
#define OS_FS_ERROR OS_ERROR /**< @deprecated Failed execution */
#define OS_FS_ERR_INVALID_POINTER OS_INVALID_POINTER /**< @deprecated Invalid pointer */
#define OS_FS_ERR_NO_FREE_FDS OS_ERR_NO_FREE_IDS /**< @deprecated No free IDs */
#define OS_FS_ERR_INVALID_FD OS_ERR_INVALID_ID /**< @deprecated Invalid ID */
#define OS_FS_UNIMPLEMENTED OS_ERR_NOT_IMPLEMENTED /**< @deprecated Not implemented */
#endif
/**@}*/

#ifndef OSAL_OMIT_DEPRECATED
Expand Down Expand Up @@ -189,7 +190,7 @@ enum
/** @brief Directory entry */
typedef struct
{
char FileName[OS_MAX_PATH_LEN];
char FileName[OS_MAX_FILE_NAME];
} os_dirent_t;

#ifndef OSAL_OMIT_DEPRECATED
Expand Down Expand Up @@ -775,7 +776,7 @@ int32 OS_FileSysAddFixedMap(uint32 *filesys_id, const char *phys_path,
* @retval #OS_INVALID_POINTER if devname is NULL
* @retval #OS_FS_ERR_DRIVE_NOT_CREATED if the OS calls to create the the drive failed
* @retval #OS_FS_ERR_DEVICE_NOT_FREE if the volume table is full
* @retval #OS_FS_SUCCESS on creating the disk
* @retval #OS_SUCCESS on creating the disk
*/
int32 OS_mkfs (char *address, const char *devname, const char *volname,
uint32 blocksize, uint32 numblocks);
Expand Down
2 changes: 1 addition & 1 deletion src/os/inc/osapi-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#define OS_MAJOR_VERSION 5 /**< @brief Major version number */
#define OS_MINOR_VERSION 0 /**< @brief Minor version number */
#define OS_REVISION 13 /**< @brief Revision number */
#define OS_REVISION 14 /**< @brief Revision number */
#define OS_MISSION_REV 0 /**< @brief Mission revision */

/**
Expand Down
26 changes: 13 additions & 13 deletions src/os/portable/os-impl-posix-dirs.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,20 @@ int32 OS_DirCreate_Impl(const char *local_path, uint32 access)

if ( mkdir(local_path, S_IFDIR |S_IRWXU | S_IRWXG | S_IRWXO) < 0 )
{
return_code = OS_FS_ERROR;
return_code = OS_ERROR;

if (errno == EEXIST)
{
/* it exists, but not necessarily a directory */
if ( stat(local_path, &st) == 0 && S_ISDIR(st.st_mode) )
{
return_code = OS_FS_SUCCESS;
return_code = OS_SUCCESS;
}
}
}
else
{
return_code = OS_FS_SUCCESS;
return_code = OS_SUCCESS;
}

return return_code;
Expand All @@ -86,9 +86,9 @@ int32 OS_DirOpen_Impl(uint32 local_id, const char *local_path)
OS_impl_dir_table[local_id] = opendir(local_path);
if (OS_impl_dir_table[local_id] == NULL)
{
return OS_FS_ERROR;
return OS_ERROR;
}
return OS_FS_SUCCESS;
return OS_SUCCESS;
} /* end OS_DirOpen_Impl */

/*----------------------------------------------------------------
Expand All @@ -103,7 +103,7 @@ int32 OS_DirClose_Impl(uint32 local_id)
{
closedir(OS_impl_dir_table[local_id]);
OS_impl_dir_table[local_id] = NULL;
return OS_FS_SUCCESS;
return OS_SUCCESS;
} /* end OS_DirClose_Impl */

/*----------------------------------------------------------------
Expand All @@ -130,13 +130,13 @@ int32 OS_DirRead_Impl(uint32 local_id, os_dirent_t *dirent)
de = readdir(OS_impl_dir_table[local_id]);
if (de == NULL)
{
return OS_FS_ERROR;
return OS_ERROR;
}

strncpy(dirent->FileName, de->d_name, OS_MAX_PATH_LEN - 1);
dirent->FileName[OS_MAX_PATH_LEN - 1] = 0;
strncpy(dirent->FileName, de->d_name, sizeof(dirent->FileName) - 1);
dirent->FileName[sizeof(dirent->FileName) - 1] = 0;

return OS_FS_SUCCESS;
return OS_SUCCESS;
} /* end OS_DirRead_Impl */

/*----------------------------------------------------------------
Expand All @@ -150,7 +150,7 @@ int32 OS_DirRead_Impl(uint32 local_id, os_dirent_t *dirent)
int32 OS_DirRewind_Impl(uint32 local_id)
{
rewinddir(OS_impl_dir_table[local_id]);
return OS_FS_SUCCESS;
return OS_SUCCESS;
} /* end OS_DirRewind_Impl */

/*----------------------------------------------------------------
Expand All @@ -165,8 +165,8 @@ int32 OS_DirRemove_Impl(const char *local_path)
{
if ( rmdir(local_path) < 0 )
{
return OS_FS_ERROR;
return OS_ERROR;
}

return OS_FS_SUCCESS;
return OS_SUCCESS;
} /* end OS_DirRemove_Impl */
14 changes: 7 additions & 7 deletions src/os/portable/os-impl-posix-files.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int32 OS_FileOpen_Impl(uint32 local_id, const char *local_path, int32 flags, int
os_perm = O_RDWR;
break;
default:
return OS_FS_ERROR;
return OS_ERROR;
}

if (flags & OS_FILE_FLAG_CREATE)
Expand All @@ -88,7 +88,7 @@ int32 OS_FileOpen_Impl(uint32 local_id, const char *local_path, int32 flags, int
if (OS_impl_filehandle_table[local_id].fd < 0)
{
OS_DEBUG("open(%s): %s\n", local_path, strerror(errno));
return OS_FS_ERROR;
return OS_ERROR;
}

/*
Expand All @@ -98,7 +98,7 @@ int32 OS_FileOpen_Impl(uint32 local_id, const char *local_path, int32 flags, int
OS_impl_filehandle_table[local_id].selectable =
((os_perm & O_NONBLOCK) != 0);

return OS_FS_SUCCESS;
return OS_SUCCESS;
} /* end OS_FileOpen_Impl */

/*----------------------------------------------------------------
Expand All @@ -118,7 +118,7 @@ int32 OS_FileStat_Impl(const char *local_path, os_fstat_t *FileStats)

if ( stat(local_path, &st) < 0 )
{
return OS_FS_ERROR;
return OS_ERROR;
}

FileStats->FileSize = st.st_size;
Expand Down Expand Up @@ -164,7 +164,7 @@ int32 OS_FileStat_Impl(const char *local_path, os_fstat_t *FileStats)
FileStats->FileModeBits |= OS_FILESTAT_MODE_EXEC;
}

return OS_FS_SUCCESS;
return OS_SUCCESS;
} /* end OS_FileStat_Impl */


Expand Down Expand Up @@ -193,7 +193,7 @@ int32 OS_FileChmod_Impl(const char *local_path, uint32 access)
*/
if ( stat(local_path, &st) < 0 )
{
return OS_FS_ERROR;
return OS_ERROR;
}

/* always check world bits */
Expand Down Expand Up @@ -239,7 +239,7 @@ int32 OS_FileChmod_Impl(const char *local_path, uint32 access)
/* finally, write the modified mode back to the file */
if ( chmod(local_path, st.st_mode) < 0 )
{
return OS_FS_ERROR;
return OS_ERROR;
}

return OS_SUCCESS;
Expand Down
8 changes: 4 additions & 4 deletions src/os/portable/os-impl-posix-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ int32 OS_GenericClose_Impl(uint32 local_id)
OS_DEBUG("close: %s\n",strerror(errno));
}
OS_impl_filehandle_table[local_id].fd = -1;
return OS_FS_SUCCESS;
return OS_SUCCESS;
} /* end OS_GenericClose_Impl */

/*----------------------------------------------------------------
Expand Down Expand Up @@ -96,7 +96,7 @@ int32 OS_GenericSeek_Impl (uint32 local_id, int32 offset, uint32 whence)
where = SEEK_END;
break;
default:
return OS_FS_ERROR;
return OS_ERROR;
}

result = lseek(OS_impl_filehandle_table[local_id].fd, (off_t)offset, where);
Expand All @@ -111,15 +111,15 @@ int32 OS_GenericSeek_Impl (uint32 local_id, int32 offset, uint32 whence)
* Use a different error code to differentiate from an
* error involving a bad whence/offset
*/
result = OS_FS_UNIMPLEMENTED;
result = OS_ERR_NOT_IMPLEMENTED;
}
else
{
/*
* Most likely the "whence" and/or "offset" combo was not valid.
*/
OS_DEBUG("lseek: %s\n",strerror(errno));
result = OS_FS_ERROR;
result = OS_ERROR;
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/os/posix/osfilesys.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ int32 OS_FileSysMountVolume_Impl (uint32 filesys_id)
}


return OS_FS_SUCCESS;
return OS_SUCCESS;

} /* end OS_FileSysMountVolume_Impl */

Expand All @@ -281,7 +281,7 @@ int32 OS_FileSysUnmountVolume_Impl (uint32 filesys_id)
* This is a no-op. The mount point that was created during
* the mount process can stay for the next mount.
*/
return OS_FS_SUCCESS;
return OS_SUCCESS;

} /* end OS_FileSysUnmountVolume_Impl */

Expand All @@ -307,7 +307,7 @@ int32 OS_FileSysStatVolume_Impl (uint32 filesys_id, OS_statvfs_t *result)
result->blocks_free = stat_buf.f_bfree;
result->total_blocks = stat_buf.f_blocks;

return(OS_FS_SUCCESS);
return(OS_SUCCESS);
} /* end OS_FileSysStatVolume_Impl */


Expand Down
2 changes: 0 additions & 2 deletions src/os/rtems/osfileapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,3 @@ int32 OS_Rtems_DirAPI_Impl_Init(void)
return OS_SUCCESS;
} /* end OS_Rtems_DirAPI_Impl_Init */


/* FIXME - need to do something better here */
Loading