forked from nasa/bplib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix nasa#121, initial implementation of coverage test
Create a "ut-stubs" and "ut-coverage" subdirectory under each of the submodules, and hook into the build system gated upon the setting of BPLIB_ENABLE_UNIT_TESTS. This is only the initial framework, most test cases are still not implemented and need to be added.
- Loading branch information
Showing
70 changed files
with
7,208 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
################################################################## | ||
# | ||
# coverage test build recipe | ||
# | ||
# This CMake file contains the recipe for building the coverage tests. | ||
# It is invoked from the parent directory when unit tests are enabled. | ||
# | ||
################################################################## | ||
|
||
add_library(utobj_bplib_cache OBJECT | ||
../src/v7_cache.c | ||
../src/v7_cache_custody.c | ||
../src/v7_cache_fsm.c | ||
) | ||
|
||
target_compile_definitions(utobj_bplib_cache PRIVATE | ||
$<TARGET_PROPERTY:bplib_cache,COMPILE_DEFINITIONS> | ||
$<TARGET_PROPERTY:ut_coverage_compile,INTERFACE_COMPILE_DEFINITIONS> | ||
) | ||
|
||
target_compile_options(utobj_bplib_cache PRIVATE | ||
$<TARGET_PROPERTY:bplib_cache,COMPILE_OPTIONS> | ||
$<TARGET_PROPERTY:ut_coverage_compile,INTERFACE_COMPILE_OPTIONS> | ||
) | ||
|
||
target_include_directories(utobj_bplib_cache PRIVATE | ||
$<TARGET_PROPERTY:bplib_cache,INCLUDE_DIRECTORIES> | ||
$<TARGET_PROPERTY:ut_coverage_compile,INTERFACE_INCLUDE_DIRECTORIES> | ||
) | ||
|
||
# Add executable | ||
add_executable(coverage-bplib_cache-testrunner | ||
test_bplib_cache_setup.c | ||
test_v7_cache.c | ||
test_v7_cache_custody.c | ||
test_v7_cache_fsm.c | ||
$<TARGET_OBJECTS:utobj_bplib_cache> | ||
) | ||
|
||
target_include_directories(coverage-bplib_cache-testrunner PRIVATE | ||
${CMAKE_CURRENT_SOURCE_DIR}/inc | ||
$<TARGET_PROPERTY:bplib_cache,INTERFACE_INCLUDE_DIRECTORIES> | ||
) | ||
|
||
target_link_libraries(coverage-bplib_cache-testrunner PUBLIC | ||
ut_coverage_link | ||
bplib_base_stubs | ||
bplib_mpool_stubs | ||
bplib_common_stubs | ||
bplib_os_stubs | ||
bplib_v7_stubs | ||
ut_assert | ||
) | ||
|
||
add_test(coverage-bplib_cache_testrunner bplib_cache-testrunner) | ||
|
||
# Install the executables to a staging area for test in cross environments | ||
if (INSTALL_TARGET_LIST) | ||
foreach(TGT ${INSTALL_TARGET_LIST}) | ||
install(TARGETS coverage-bplib_cache-testrunner DESTINATION ${TGT}/${UT_INSTALL_SUBDIR}) | ||
endforeach() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/************************************************************************ | ||
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” | ||
* | ||
* Copyright (c) 2020 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. | ||
************************************************************************/ | ||
|
||
#ifndef TEST_BPLIB_CACHE_H | ||
#define TEST_BPLIB_CACHE_H | ||
|
||
#include "utassert.h" | ||
#include "utstubs.h" | ||
#include "uttest.h" | ||
|
||
void TestBplibCacheCustody_Register(void); | ||
void TestBplibCacheFsm_Register(void); | ||
void TestBplibCache_Register(void); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/************************************************************************ | ||
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” | ||
* | ||
* Copyright (c) 2020 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. | ||
************************************************************************/ | ||
|
||
/* | ||
* Includes | ||
*/ | ||
#include "test_bplib_cache.h" | ||
|
||
void UtTest_Setup(void) | ||
{ | ||
TestBplibCacheCustody_Register(); | ||
TestBplibCacheFsm_Register(); | ||
TestBplibCache_Register(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/************************************************************************ | ||
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” | ||
* | ||
* Copyright (c) 2020 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. | ||
************************************************************************/ | ||
|
||
/* | ||
* Includes | ||
*/ | ||
#include "test_bplib_cache.h" | ||
|
||
void TestBplibCache_Register(void) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/************************************************************************ | ||
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” | ||
* | ||
* Copyright (c) 2020 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. | ||
************************************************************************/ | ||
|
||
/* | ||
* Includes | ||
*/ | ||
#include "test_bplib_cache.h" | ||
|
||
void TestBplibCacheCustody_Register(void) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/************************************************************************ | ||
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” | ||
* | ||
* Copyright (c) 2020 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. | ||
************************************************************************/ | ||
|
||
/* | ||
* Includes | ||
*/ | ||
#include "test_bplib_cache.h" | ||
|
||
void TestBplibCacheFsm_Register(void) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
################################################################## | ||
# | ||
# Bundle Protocol Library (BPLib) CMake build recipe | ||
# | ||
# This is for the "cache" stub functions | ||
# | ||
################################################################## | ||
|
||
add_library(bplib_cache_stubs STATIC | ||
v7_cache_stubs.c | ||
) | ||
|
||
target_include_directories(bplib_cache_stubs PUBLIC | ||
$<TARGET_PROPERTY:bplib_cache,INTERFACE_INCLUDE_DIRECTORIES> | ||
) | ||
|
||
target_link_libraries(bplib_cache_stubs PUBLIC | ||
ut_assert | ||
) |
Oops, something went wrong.