Skip to content

Commit

Permalink
Fix nasa#795, WIP added no group, bsd-sockets broken
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Feb 17, 2021
1 parent 349d90e commit 9eebc00
Show file tree
Hide file tree
Showing 4 changed files with 204 additions and 7 deletions.
62 changes: 62 additions & 0 deletions src/unit-test-coverage/portable/src/coveragetest-bsd-sockets.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer"
*
* Copyright (c) 2019 United States Government as represented by
* the Administrator of the National Aeronautics and Space Administration.
* All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* \brief Coverage test for no network implementation
* \ingroup portable
*/

#include "os-portable-coveragetest.h"
#include "os-shared-network.h"

void Test_OS_SocketOpen_Impl(void)
{
OSAPI_TEST_FUNCTION_RC(OS_SocketOpen_Impl, (NULL), OS_ERR_NOT_IMPLEMENTED);
}

/* ------------------- End of test cases --------------------------------------*/

/* Osapi_Test_Setup
*
* Purpose:
* Called by the unit test tool to set up the app prior to each test
*/
void Osapi_Test_Setup(void)
{
UT_ResetState(0);
}

/*
* Osapi_Test_Teardown
*
* Purpose:
* Called by the unit test tool to tear down the app after each test
*/
void Osapi_Test_Teardown(void) {}

/* UtTest_Setup
*
* Purpose:
* Registers the test cases to execute with the unit test tool
*/
void UtTest_Setup(void)
{
ADD_TEST(OS_SocketOpen_Impl);
}
63 changes: 63 additions & 0 deletions src/unit-test-coverage/portable/src/coveragetest-no-network.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer"
*
* Copyright (c) 2019 United States Government as represented by
* the Administrator of the National Aeronautics and Space Administration.
* All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* \brief Coverage test for no network implementation
* \ingroup portable
*/

#include "os-portable-coveragetest.h"
#include "os-shared-network.h"

void Test_No_Network(void)
{
OSAPI_TEST_FUNCTION_RC(OS_NetworkGetID_Impl, (NULL), OS_ERR_NOT_IMPLEMENTED);
OSAPI_TEST_FUNCTION_RC(OS_NetworkGetHostName_Impl, (NULL, 0), OS_ERR_NOT_IMPLEMENTED);
}

/* ------------------- End of test cases --------------------------------------*/

/* Osapi_Test_Setup
*
* Purpose:
* Called by the unit test tool to set up the app prior to each test
*/
void Osapi_Test_Setup(void)
{
UT_ResetState(0);
}

/*
* Osapi_Test_Teardown
*
* Purpose:
* Called by the unit test tool to tear down the app after each test
*/
void Osapi_Test_Teardown(void) {}

/* UtTest_Setup
*
* Purpose:
* Registers the test cases to execute with the unit test tool
*/
void UtTest_Setup(void)
{
ADD_TEST(No_Network);
}
22 changes: 15 additions & 7 deletions src/unit-test-coverage/portable/src/coveragetest-no-sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,27 @@
*/

/**
* \brief Coverage test for no socket impelementation"
* \brief Coverage test for no socket implementation
* \ingroup portable
*/

#include "os-portable-coveragetest.h"
#include "os-shared-sockets.h"

void Test_OS_SocketOpen_Impl(void)
void Test_No_Sockets(void)
{
/* Test Case For:
* int32 OS_ShellOutputToFile_Impl(uint32 stream_id, const char* Cmd)
*/
OSAPI_TEST_FUNCTION_RC(OS_SocketOpen_Impl, (0), OS_ERR_NOT_IMPLEMENTED);
OSAPI_TEST_FUNCTION_RC(OS_SocketOpen_Impl, (NULL), OS_ERR_NOT_IMPLEMENTED);
OSAPI_TEST_FUNCTION_RC(OS_SocketBind_Impl, (NULL, NULL), OS_ERR_NOT_IMPLEMENTED);
OSAPI_TEST_FUNCTION_RC(OS_SocketConnect_Impl, (NULL, NULL, 0), OS_ERR_NOT_IMPLEMENTED);
OSAPI_TEST_FUNCTION_RC(OS_SocketAccept_Impl, (NULL, NULL, NULL, 0), OS_ERR_NOT_IMPLEMENTED);
OSAPI_TEST_FUNCTION_RC(OS_SocketRecvFrom_Impl, (NULL, NULL, 0, NULL, 0), OS_ERR_NOT_IMPLEMENTED);
OSAPI_TEST_FUNCTION_RC(OS_SocketSendTo_Impl, (NULL, NULL, 0, NULL), OS_ERR_NOT_IMPLEMENTED);
OSAPI_TEST_FUNCTION_RC(OS_SocketGetInfo_Impl, (NULL, NULL), OS_SUCCESS);
OSAPI_TEST_FUNCTION_RC(OS_SocketAddrInit_Impl, (NULL, 0), OS_ERR_NOT_IMPLEMENTED);
OSAPI_TEST_FUNCTION_RC(OS_SocketAddrToString_Impl, (NULL, 0, NULL), OS_ERR_NOT_IMPLEMENTED);
OSAPI_TEST_FUNCTION_RC(OS_SocketAddrFromString_Impl, (NULL, NULL), OS_ERR_NOT_IMPLEMENTED);
OSAPI_TEST_FUNCTION_RC(OS_SocketAddrGetPort_Impl, (NULL, NULL), OS_ERR_NOT_IMPLEMENTED);
OSAPI_TEST_FUNCTION_RC(OS_SocketAddrSetPort_Impl, (NULL, 0), OS_ERR_NOT_IMPLEMENTED);
}

/* ------------------- End of test cases --------------------------------------*/
Expand Down Expand Up @@ -61,5 +69,5 @@ void Osapi_Test_Teardown(void) {}
*/
void UtTest_Setup(void)
{
ADD_TEST(OS_SocketOpen_Impl);
ADD_TEST(No_Sockets);
}
64 changes: 64 additions & 0 deletions src/unit-test-coverage/portable/src/coveragetest-no-symtab.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer"
*
* Copyright (c) 2019 United States Government as represented by
* the Administrator of the National Aeronautics and Space Administration.
* All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* \brief Coverage test for no symtab implementation
* \ingroup portable
*/

#include "os-portable-coveragetest.h"
#include "os-shared-module.h"

void Test_No_Symtab(void)
{
OSAPI_TEST_FUNCTION_RC(OS_GlobalSymbolLookup_Impl, (NULL, NULL), OS_ERR_NOT_IMPLEMENTED);
OSAPI_TEST_FUNCTION_RC(OS_ModuleSymbolLookup_Impl, (NULL, NULL, NULL), OS_ERR_NOT_IMPLEMENTED);
OSAPI_TEST_FUNCTION_RC(OS_SymbolTableDump_Impl, (NULL, 0), OS_ERR_NOT_IMPLEMENTED);
}

/* ------------------- End of test cases --------------------------------------*/

/* Osapi_Test_Setup
*
* Purpose:
* Called by the unit test tool to set up the app prior to each test
*/
void Osapi_Test_Setup(void)
{
UT_ResetState(0);
}

/*
* Osapi_Test_Teardown
*
* Purpose:
* Called by the unit test tool to tear down the app after each test
*/
void Osapi_Test_Teardown(void) {}

/* UtTest_Setup
*
* Purpose:
* Registers the test cases to execute with the unit test tool
*/
void UtTest_Setup(void)
{
ADD_TEST(No_Symtab);
}

0 comments on commit 9eebc00

Please sign in to comment.