From fc13facd99c5baa15c9148f46ac2471f6c0ec0a1 Mon Sep 17 00:00:00 2001 From: Alex Campbell Date: Mon, 14 Jun 2021 11:10:10 -0400 Subject: [PATCH 1/4] Fix #1367, Add cfe functional tests to CI --- .github/workflows/functional-tests.yml | 106 +++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 .github/workflows/functional-tests.yml diff --git a/.github/workflows/functional-tests.yml b/.github/workflows/functional-tests.yml new file mode 100644 index 000000000..2daefc1d0 --- /dev/null +++ b/.github/workflows/functional-tests.yml @@ -0,0 +1,106 @@ +name: "Functional Test" + +on: + push: + pull_request: + +env: + SIMULATION: native + ENABLE_UNIT_TESTS: true + OMIT_DEPRECATED: true + BUILDTYPE: release + +jobs: + + #Check for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action. + check-for-duplicates: + runs-on: ubuntu-latest + # Map a step output to a job output + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@master + with: + concurrent_skipping: 'same_content' + skip_after_successful_duplicate: 'true' + do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' + + Local-Test-Build: + #Continue if check-for-duplicates found no duplicates. Always runs for pull-requests. + needs: check-for-duplicates + if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }} + runs-on: ubuntu-18.04 + timeout-minutes: 15 + + steps: + # Checks out a copy of your repository on the ubuntu-latest machine + - name: Checkout bundle + uses: actions/checkout@v2 + with: + repository: nasa/cFS + submodules: true + + - name: Checkout submodule + uses: actions/checkout@v2 + with: + path: cfe + + - name: Check versions + run: git submodule + + # Setup the build system + - name: Set up for build + run: | + cp ./cfe/cmake/Makefile.sample Makefile + cp -r ./cfe/cmake/sample_defs sample_defs + make prep + + # Setup the build system + - name: Make Install + run: make install + + - name: List cpu1 + run: ls build/exe/cpu1/ + + - name: Run cFS + run: | + ./core-cpu1 | tee cFS_startup_cpu1.txt & + sleep 10 + ../host/cmdUtil --pktid=0x1806 --cmdcode=4 --endian=LE --string="20:CFE_TEST_APP" --string="20:CFE_TestMain" --string="64:cfe_testcase" --uint32=16384 --uint8=0 --uint8=0 --uint16=100 & + + sleep 30 + counter=$(grep -c "CFE_TEST_APP" cFS_startup_cpu1.txt) & + + while [[ -z $(grep -i "SUMMARY" cFS_startup_cpu1.txt) ]]; do + echo "Waiting for CFE Tests" + sleep 60 + + temp=$(grep -c "CFE_TEST_APP" cFS_startup_cpu1.txt) & + + if [ $temp -eq $counter ]; then + echo "Test is frozen. Quiting" + break + fi + + counter=$(grep -c "CFE_TEST_APP" cFS_startup_cpu1.txt) & + done + + ../host/cmdUtil --endian=LE --pktid=0x1806 --cmdcode=2 --half=0x0002 + working-directory: ./build/exe/cpu1/ + + - name: Archive cFS Startup Artifacts + uses: actions/upload-artifact@v2 + with: + name: cFS-startup-log-deprecate-true-${{ matrix.buildtype }} + path: ./build/exe/cpu1/cFS_startup_cpu1.txt + + - name: Check for cFS Warnings + run: | + if [[ -z $(grep -i "SUMMARY.*FAIL::0.*TSF::0.*TTF::0" cFS_startup_cpu1.txt) ]]; then + echo "Must resolve Test Failures in cFS Test App before submitting a pull request" + echo "" + grep -i '\[ FAIL]\|\[ TSF]\|\[ TTF]' cFS_startup_cpu1.txt + exit -1 + fi + working-directory: ./build/exe/cpu1/ \ No newline at end of file From b8d3f865a9afe8961dbc1825f0a52659aefe9fdb Mon Sep 17 00:00:00 2001 From: Alex Campbell Date: Mon, 14 Jun 2021 11:17:15 -0400 Subject: [PATCH 2/4] Fix #1367, Changing info test to force failure. --- modules/cfe_testcase/src/es_info_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cfe_testcase/src/es_info_test.c b/modules/cfe_testcase/src/es_info_test.c index f251d5325..955626862 100644 --- a/modules/cfe_testcase/src/es_info_test.c +++ b/modules/cfe_testcase/src/es_info_test.c @@ -124,7 +124,7 @@ void TestAppInfo(void) UtAssert_INT32_EQ(CFE_ES_GetAppIDByName(&AppIdByName, INVALID_APP_NAME), CFE_ES_ERR_NAME_NOT_FOUND); UtAssert_ResourceID_Undefined(AppIdByName); UtAssert_INT32_EQ(CFE_ES_GetAppID(NULL), CFE_ES_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_ES_GetAppIDByName(NULL, TEST_EXPECTED_APP_NAME), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_GetAppIDByName(NULL, TEST_EXPECTED_APP_NAME), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_ES_GetAppName(AppNameBuf, CFE_ES_APPID_UNDEFINED, sizeof(AppNameBuf)), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_ES_GetAppName(NULL, TestAppId, sizeof(AppNameBuf)), CFE_ES_BAD_ARGUMENT); From df504c1b282aa4f9f1bf5289f70e2be18142ac8a Mon Sep 17 00:00:00 2001 From: Alex Campbell Date: Mon, 14 Jun 2021 11:22:24 -0400 Subject: [PATCH 3/4] Fix #1367, Adding delay to test timeout. --- modules/cfe_testcase/src/es_cds_test.c | 2 ++ modules/cfe_testcase/src/es_info_test.c | 2 +- modules/cfe_testcase/src/time_current_test.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/cfe_testcase/src/es_cds_test.c b/modules/cfe_testcase/src/es_cds_test.c index 6f2d1faa4..df619af91 100644 --- a/modules/cfe_testcase/src/es_cds_test.c +++ b/modules/cfe_testcase/src/es_cds_test.c @@ -56,6 +56,8 @@ void TestCDS(void) UtAssert_INT32_EQ(status, CFE_SUCCESS); } + OS_TaskDelay(30000); + UtAssert_INT32_EQ(CFE_ES_GetCDSBlockName(CDSNameBuf, CDSHandlePtr, sizeof(CDSNameBuf)), CFE_SUCCESS); UtAssert_StrCmp(CDSNameBuf, CDSName, "CFE_ES_GetCDSBlockName() = %s", CDSNameBuf); UtAssert_INT32_EQ(CFE_ES_GetCDSBlockIDByName(&IdByName, CDSNameBuf), CFE_SUCCESS); diff --git a/modules/cfe_testcase/src/es_info_test.c b/modules/cfe_testcase/src/es_info_test.c index 955626862..f251d5325 100644 --- a/modules/cfe_testcase/src/es_info_test.c +++ b/modules/cfe_testcase/src/es_info_test.c @@ -124,7 +124,7 @@ void TestAppInfo(void) UtAssert_INT32_EQ(CFE_ES_GetAppIDByName(&AppIdByName, INVALID_APP_NAME), CFE_ES_ERR_NAME_NOT_FOUND); UtAssert_ResourceID_Undefined(AppIdByName); UtAssert_INT32_EQ(CFE_ES_GetAppID(NULL), CFE_ES_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_ES_GetAppIDByName(NULL, TEST_EXPECTED_APP_NAME), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_GetAppIDByName(NULL, TEST_EXPECTED_APP_NAME), CFE_ES_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_ES_GetAppName(AppNameBuf, CFE_ES_APPID_UNDEFINED, sizeof(AppNameBuf)), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_ES_GetAppName(NULL, TestAppId, sizeof(AppNameBuf)), CFE_ES_BAD_ARGUMENT); diff --git a/modules/cfe_testcase/src/time_current_test.c b/modules/cfe_testcase/src/time_current_test.c index e37ec7fad..982594679 100644 --- a/modules/cfe_testcase/src/time_current_test.c +++ b/modules/cfe_testcase/src/time_current_test.c @@ -78,6 +78,7 @@ void TestGetTime(void) TAI = CFE_TIME_GetTAI(); UTC = CFE_TIME_GetUTC(); MET = CFE_TIME_GetMET(); + OS_TaskDelay(300000); METSeconds = CFE_TIME_GetMETseconds(); METSubSeconds = CFE_TIME_GetMETsubsecs(); STCF = CFE_TIME_GetSTCF(); From 4f1fe2feb9adb0cf83ab64999702683bf6398e4b Mon Sep 17 00:00:00 2001 From: Alex Campbell Date: Mon, 14 Jun 2021 11:29:32 -0400 Subject: [PATCH 4/4] Fix #1367, Fix forced failures. --- modules/cfe_testcase/src/es_cds_test.c | 2 -- modules/cfe_testcase/src/time_current_test.c | 1 - 2 files changed, 3 deletions(-) diff --git a/modules/cfe_testcase/src/es_cds_test.c b/modules/cfe_testcase/src/es_cds_test.c index df619af91..6f2d1faa4 100644 --- a/modules/cfe_testcase/src/es_cds_test.c +++ b/modules/cfe_testcase/src/es_cds_test.c @@ -56,8 +56,6 @@ void TestCDS(void) UtAssert_INT32_EQ(status, CFE_SUCCESS); } - OS_TaskDelay(30000); - UtAssert_INT32_EQ(CFE_ES_GetCDSBlockName(CDSNameBuf, CDSHandlePtr, sizeof(CDSNameBuf)), CFE_SUCCESS); UtAssert_StrCmp(CDSNameBuf, CDSName, "CFE_ES_GetCDSBlockName() = %s", CDSNameBuf); UtAssert_INT32_EQ(CFE_ES_GetCDSBlockIDByName(&IdByName, CDSNameBuf), CFE_SUCCESS); diff --git a/modules/cfe_testcase/src/time_current_test.c b/modules/cfe_testcase/src/time_current_test.c index 982594679..e37ec7fad 100644 --- a/modules/cfe_testcase/src/time_current_test.c +++ b/modules/cfe_testcase/src/time_current_test.c @@ -78,7 +78,6 @@ void TestGetTime(void) TAI = CFE_TIME_GetTAI(); UTC = CFE_TIME_GetUTC(); MET = CFE_TIME_GetMET(); - OS_TaskDelay(300000); METSeconds = CFE_TIME_GetMETseconds(); METSubSeconds = CFE_TIME_GetMETsubsecs(); STCF = CFE_TIME_GetSTCF();