Skip to content

Commit

Permalink
Merge pull request #487 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
Integration Candidate: 2020-05-27
  • Loading branch information
astrogeco authored Jun 10, 2020
2 parents 3604387 + 28d6865 commit 07fd022
Show file tree
Hide file tree
Showing 20 changed files with 806 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ _functional_test: &functional_test
- cd build

# Prep and build
- cmake -DENABLE_UNIT_TESTS=true -DOSAL_SYSTEM_BSPTYPE=pc-linux -DOSAL_CONFIG_DEBUG_PERMISSIVE_MODE=TRUE ..
- cmake -DENABLE_UNIT_TESTS=true -DOSAL_SYSTEM_BSPTYPE=generic-linux -DOSAL_CONFIG_DEBUG_PERMISSIVE_MODE=TRUE ..
- make

# lcov capture pre-execution
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ This distribution contains:

## Version History

### Development Build: 5.0.19

- Rename BSPs that can be used on multiple platforms.
`mcp750-vxworks` becomes `generic-vxworks`
`pc-linux` becomes `generic-linux`
- New features only, does not change existing behavior.
UT Hook functions now have the capability to get argument values by name, which is more future proof than assuming a numeric index.
- Add functional test for `OS_TimerAdd`
- Added functional tests for `OS_TimeBase Api` on `OS_TimeBaseCreate`, `OS_TimeBaseSet`, `OS_TimeBaseDelete`, `OS_TimeBaseGetIdByName`, `OS_TimeBaseGetInfo`, `OS_TimeBaseGetFreeRun`
- See <https://github.com/nasa/osal/pull/487> for details


### Development Build: 5.0.18

- Add functional tests for `OS_IdentifyObject`, `OS_ConvertToArrayIndex` and `OS_ForEachObject` functions.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
######################################################################
#
# CMAKE build recipe for PC-LINUX Board Support Package (BSP)
# CMAKE build recipe for LINUX Board Support Package (BSP)
#
######################################################################

# NOTE: Although this is traditionally called "pc-linux", it is generic
# enough to be applied to non-PC systems running embedded Linux, such
# as Raspberry Pi, BeagleBoard, Zync, or custom hardware.

add_library(osal_pc-linux_impl OBJECT
# This basic implementation library should be generic enough to use
# on any Linux-based processor board, as well as a standard development PC.
add_library(osal_generic-linux_impl OBJECT
src/bsp_start.c
src/bsp_console.c
)
Expand All @@ -23,7 +21,7 @@ add_library(osal_pc-linux_impl OBJECT
#
# See http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html
# for a more detailed description of the feature test macros and available values
target_compile_definitions(osal_pc-linux_impl PUBLIC
target_compile_definitions(osal_generic-linux_impl PUBLIC
_XOPEN_SOURCE=600
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
##########################################################################
#
# Build options for "pc-linux" BSP
# Build options for "generic-linux" BSP
#
##########################################################################

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <sys/types.h>
#include <sys/wait.h>

#include "pclinux_bsp_internal.h"
#include "generic_linux_bsp_internal.h"
#include "bsp-impl.h"

/*----------------------------------------------------------------
Expand Down Expand Up @@ -88,7 +88,7 @@ void OS_BSP_ConsoleSetMode_Impl(uint32 ModeBits)
{
char param[32];

if (OS_BSP_PcLinuxGlobal.EnableTermControl)
if (OS_BSP_GenericLinuxGlobal.EnableTermControl)
{
if (ModeBits == OS_BSP_CONSOLEMODE_NORMAL)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
#include <sys/types.h>
#include <sys/stat.h>

#include "pclinux_bsp_internal.h"
#include "generic_linux_bsp_internal.h"

OS_BSP_PcLinuxGlobalData_t OS_BSP_PcLinuxGlobal;
OS_BSP_GenericLinuxGlobalData_t OS_BSP_GenericLinuxGlobal;

/* ---------------------------------------------------------
OS_BSP_Initialize()
Expand Down Expand Up @@ -130,7 +130,7 @@ int main(int argc, char *argv[])
* Initially clear the global objects
*/
memset(&OS_BSP_Global, 0, sizeof(OS_BSP_Global));
memset(&OS_BSP_PcLinuxGlobal, 0, sizeof(OS_BSP_PcLinuxGlobal));
memset(&OS_BSP_GenericLinuxGlobal, 0, sizeof(OS_BSP_GenericLinuxGlobal));

/*
* Save the argc/argv arguments for future use.
Expand All @@ -155,7 +155,7 @@ int main(int argc, char *argv[])
*/
if (getenv("TERM") != NULL)
{
OS_BSP_PcLinuxGlobal.EnableTermControl = isatty(STDOUT_FILENO);
OS_BSP_GenericLinuxGlobal.EnableTermControl = isatty(STDOUT_FILENO);
}

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/******************************************************************************
** File: pclinux_bsp_internal.h
** File: generic_linux_bsp_internal.h
**
**
** This is governed by the NASA Open Source Agreement and may be used,
Expand All @@ -11,12 +11,12 @@
**
**
** Purpose:
** Header file for internal data to the PC-LINUX BSP
** Header file for internal data to the LINUX BSP
**
******************************************************************************/

#ifndef _PCLINUX_BSP_INTERNAL_H_
#define _PCLINUX_BSP_INTERNAL_H_
#ifndef GENERIC_LINUX_BSP_INTERNAL_H_
#define GENERIC_LINUX_BSP_INTERNAL_H_

#include "osapi.h"
#include "bsp-impl.h"
Expand All @@ -27,11 +27,11 @@
typedef struct
{
bool EnableTermControl; /**< Will be set "true" when invoked from a TTY device, false otherwise */
} OS_BSP_PcLinuxGlobalData_t;
} OS_BSP_GenericLinuxGlobalData_t;

/*
* Global Data object
*/
extern OS_BSP_PcLinuxGlobalData_t OS_BSP_PcLinuxGlobal;
extern OS_BSP_GenericLinuxGlobalData_t OS_BSP_GenericLinuxGlobal;

#endif /* _PCLINUX_BSP_INTERNAL_H_ */
#endif /* GENERIC_LINUX_BSP_INTERNAL_H_ */
14 changes: 14 additions & 0 deletions src/bsp/generic-vxworks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
######################################################################
#
# CMAKE build recipe for Generic VxWorks Board Support Package (BSP)
#
######################################################################

add_library(osal_generic-vxworks_impl OBJECT
src/bsp_start.c
src/bsp_console.c
)

# This BSP only works with "vxworks" OS layer.
# Confirming this reduces risk of accidental misconfiguration
set(OSAL_EXPECTED_OSTYPE "vxworks" PARENT_SCOPE)
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
##########################################################################
#
# Build options for "mcp750-vxworks" BSP
# Build options for "generic-vxworks" BSP
#
##########################################################################

# The "-u" switch is required to ensure that "ldppc" pulls in the OS_BSPMain entry point
# The "-u" switch is required to ensure that the linker pulls in the OS_BSPMain entry point
target_link_libraries(osal_bsp -uOS_BSPMain)
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <unistd.h>
#include <stdio.h>

#include "mcp750_bsp_internal.h"
#include "generic_vxworks_bsp_internal.h"
#include "bsp-impl.h"

/****************************************************************************************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <stdlib.h>
#include <string.h>

#include "mcp750_bsp_internal.h"
#include "generic_vxworks_bsp_internal.h"

/* ---------------------------------------------------------
OS_BSP_Shutdown_Impl()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/******************************************************************************
** File: mcp750_bsp_internal.h
** File: generic_vxworks_bsp_internal.h
**
**
** This is governed by the NASA Open Source Agreement and may be used,
Expand All @@ -11,17 +11,17 @@
**
**
** Purpose:
** Header file for internal data to the MCP750 BSP
** Header file for internal data to the VxWorks BSP
**
******************************************************************************/

#ifndef _MCP750_BSP_INTERNAL_H_
#define _MCP750_BSP_INTERNAL_H_
#ifndef GENERIC_VXWORKS_BSP_INTERNAL_H_
#define GENERIC_VXWORKS_BSP_INTERNAL_H_

/*
** OSAL includes
*/
#include "osapi.h"
#include "bsp-impl.h"

#endif /* _MCP750_BSP_INTERNAL_H_ */
#endif /* GENERIC_VXWORKS_BSP_INTERNAL_H_ */
27 changes: 0 additions & 27 deletions src/bsp/mcp750-vxworks/CMakeLists.txt

This file was deleted.

21 changes: 0 additions & 21 deletions src/bsp/mcp750-vxworks/src/bsp.mak

This file was deleted.

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 18 /**< @brief Revision number */
#define OS_REVISION 19 /**< @brief Revision number */
#define OS_MISSION_REV 0 /**< @brief Mission revision */

/**
Expand Down
69 changes: 47 additions & 22 deletions src/tests/idmap-api-test/idmap-api-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@
#include "utbsp.h"


uint32 task_id;
uint32 queue_id;
uint32 count_sem_id;
uint32 bin_sem_id;
uint32 mutex_id1;
uint32 mutex_id2;
uint32 mutex_id3;
uint32 time_base_id;

#define UT_EXIT_LOOP_MAX 100

/* *************************************** MAIN ************************************** */

typedef struct
Expand Down Expand Up @@ -80,38 +91,52 @@ void Test_Void_Fn(void)

} /* end Test_Void_Fn */

void TestIdMapApi_Setup(void)
{
uint32 loopcnt;
int32 status;
OS_task_prop_t taskprop;

/*
* Create all allowed objects
*/
status = OS_TaskCreate( &task_id, "Task", Test_Void_Fn, 0, 0, 0, 0);
UtAssert_True(status == OS_SUCCESS, "OS_TaskCreate() (%ld) == OS_SUCCESS", (long)status);
status = OS_QueueCreate( &queue_id, "Queue", 5, 5, 0);
UtAssert_True(status == OS_SUCCESS, "OS_QueueCreate() (%ld) == OS_SUCCESS", (long)status);
status = OS_CountSemCreate( &count_sem_id, "CountSem", 1, 0);
UtAssert_True(status == OS_SUCCESS, "OS_CountSemCreate() (%ld) == OS_SUCCESS", (long)status);
status = OS_BinSemCreate( &bin_sem_id, "BinSem", 1, 0);
UtAssert_True(status == OS_SUCCESS, "OS_BinSemCreate() (%ld) == OS_SUCCESS", (long)status);
status = OS_MutSemCreate( &mutex_id1, "Mutex1", 0);
UtAssert_True(status == OS_SUCCESS, "OS_MutSemCreate() (%ld) == OS_SUCCESS", (long)status);
status = OS_MutSemCreate( &mutex_id2, "Mutex2", 0);
UtAssert_True(status == OS_SUCCESS, "OS_MutSemCreate() (%ld) == OS_SUCCESS", (long)status);
status = OS_MutSemCreate( &mutex_id3, "Mutex3", 0);
UtAssert_True(status == OS_SUCCESS, "OS_MutSemCreate() (%ld) == OS_SUCCESS", (long)status);
status = OS_TimeBaseCreate( &time_base_id, "TimeBase", 0);
UtAssert_True(status == OS_SUCCESS, "OS_TimeBaseCreate() (%ld) == OS_SUCCESS", (long)status);

/* Looping delay in parent task to wait for child task to exit */
loopcnt = 0;
while ((OS_TaskGetInfo(task_id, &taskprop) == OS_SUCCESS) && (loopcnt < UT_EXIT_LOOP_MAX))
{
OS_TaskDelay(10);
loopcnt++;
}
UtAssert_True(loopcnt < UT_EXIT_LOOP_MAX, "Task exited after %ld iterations", (long)loopcnt);
}
/* *************************************** MAIN ************************************** */

void TestIdMapApi(void)
{
int32 expected;
int32 actual;
uint32 task_id;
uint32 queue_id;
uint32 count_sem_id;
uint32 bin_sem_id;
uint32 mutex_id1;
uint32 mutex_id2;
uint32 mutex_id3;
uint32 time_base_id;
uint32 TestArrayIndex;
uint32 TestMutex1Index;
uint32 TestMutex2Index;
Test_OS_ObjTypeCount_t Count;

/*
* Create all allowed objects
*/
OS_TaskCreate( &task_id, "Task", Test_Void_Fn, 0, 0, 0, 0);
OS_QueueCreate( &queue_id, "Queue", 5, 5, 0);
OS_CountSemCreate( &count_sem_id, "CountSem", 1, 0);
OS_BinSemCreate( &bin_sem_id, "BinSem", 1, 0);
OS_MutSemCreate( &mutex_id1, "Mutex1", 0);
OS_MutSemCreate( &mutex_id2, "Mutex2", 0);
OS_MutSemCreate( &mutex_id3, "Mutex3", 0);
OS_TimeBaseCreate( &time_base_id, "TimeBase", 0);

/*
* NOTE: The following objects were not created and tested:
* OS_OBJECT_TYPE_OS_STREAM
Expand Down Expand Up @@ -229,7 +254,7 @@ void TestIdMapApi(void)
OS_ForEachObject (0, &ObjTypeCounter, &Count);

/* Verify Outputs */
UtAssert_True(Count.TaskCount == 1, "OS_ForEachObject() TaskCount (%lu) == 1", (unsigned long)Count.TaskCount);
UtAssert_True(Count.TaskCount == 0, "OS_ForEachObject() TaskCount (%lu) == 0", (unsigned long)Count.TaskCount);
UtAssert_True(Count.QueueCount == 1, "OS_ForEachObject() QueueCount (%lu) == 1", (unsigned long)Count.QueueCount);
UtAssert_True(Count.CountSemCount == 1, "OS_ForEachObject() CountSemCount (%lu) == 1", (unsigned long)Count.CountSemCount);
UtAssert_True(Count.BinSemCount == 2, "OS_ForEachObject() BinSemCount (%lu) == 2", (unsigned long)Count.BinSemCount);
Expand Down Expand Up @@ -289,6 +314,6 @@ void UtTest_Setup(void)
/*
* Register the test setup and check routines in UT assert
*/
UtTest_Add(TestIdMapApi, NULL, NULL, "TestIdMapApi");
UtTest_Add(TestIdMapApi, TestIdMapApi_Setup, NULL, "TestIdMapApi");
}

Loading

0 comments on commit 07fd022

Please sign in to comment.