Skip to content

Commit

Permalink
Merge pull request #84 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
to_lab Integration candidate: 2021-02-02
  • Loading branch information
astrogeco authored Feb 16, 2021
2 parents 57cfa8b + e70e3bd commit 031de3d
Show file tree
Hide file tree
Showing 6 changed files with 172 additions and 17 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/codeql-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: "CodeQL Analysis"

on:
push:
branches:
- main
pull_request:

env:
SIMULATION: native
ENABLE_UNIT_TESTS: true
OMIT_DEPRECATED: true
BUILDTYPE: release

jobs:

CodeQL-Build:
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: apps/to_lab

- name: Check versions
run: git submodule

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: c
queries: +security-extended, security-and-quality

# 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
# Build the code
- name: Build
run: make to_lab

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
53 changes: 53 additions & 0 deletions .github/workflows/format-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Format Check

# Run on main push and pull requests
on:
push:
branches:
- main
pull_request:

jobs:

static-analysis:
name: Run format check
runs-on: ubuntu-18.04
timeout-minutes: 15

steps:

- name: Install format checker
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main'
sudo apt-get update && sudo apt-get install clang-format-10
- name: Checkout bundle
uses: actions/checkout@v2
with:
repository: nasa/cFS

- name: Checkout
uses: actions/checkout@v2
with:
path: repo

- name: Generate format differences
run: |
cd repo
find . -name "*.[ch]" -exec clang-format-10 -i -style=file {} +
git diff > $GITHUB_WORKSPACE/style_differences.txt
- name: Archive Static Analysis Artifacts
uses: actions/upload-artifact@v2
with:
name: style_differences
path: style_differences.txt

- name: Error on differences
run: |
if [[ -s style_differences.txt ]];
then
cat style_differences.txt
exit -1
fi
40 changes: 40 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Static Analysis

# Run on main push and pull requests
on:
push:
branches:
- main
pull_request:

jobs:

static-analysis:
name: Run cppcheck
runs-on: ubuntu-18.04
timeout-minutes: 15

steps:

- name: Install cppcheck
run: sudo apt-get install cppcheck -y

- name: Checkout code
uses: actions/checkout@v2

- name: Run general cppcheck
run: cppcheck --force --inline-suppr --quiet . 2> cppcheck_err.txt

- name: Archive Static Analysis Artifacts
uses: actions/upload-artifact@v2
with:
name: cppcheck-err
path: ./cppcheck_err.txt

- name: Check for errors
run: |
if [[ -s cppcheck_err.txt ]];
then
cat cppcheck_err.txt
exit -1
fi
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
![Static Analysis](https://github.com/nasa/to_lab/workflows/Static%20Analysis/badge.svg)
![Format Check](https://github.com/nasa/to_lab/workflows/Format%20Check/badge.svg)

# Core Flight System : Framework : App : Telemetry Output Lab

This repository contains NASA's Telemetry Output Lab (to_lab), which is a framework component of the Core Flight System.
Expand All @@ -10,6 +13,13 @@ To send telemtry to the "ground" or UDP/IP port, edit the subscription table in

## Version History

### Development Build: 2.4.0-rc1+dev32

- Removes end-of-function comments in `to_lab_app.c`
- Adds static analysis and code format check to continuous integration workflow. Updates workflow status badges in ReadMe
- Adds CodeQL analysis to continuous integration workflow
- See <https://github.com/nasa/to_lab/pull/84>

### Development Build: 2.4.0-rc1+dev21

- TO remains command-able after a "remove all subscriptions" command; the command now only removes all subscriptions to the Tlm_pipe
Expand Down
29 changes: 13 additions & 16 deletions fsw/src/to_lab_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ void TO_Lab_AppMain(void)
}

CFE_ES_ExitApp(RunStatus);

} /* End of TO_Lab_AppMain() */
}

/*
** TO delete callback function.
Expand Down Expand Up @@ -245,7 +244,7 @@ int32 TO_LAB_init(void)
TO_LAB_VERSION_STRING);

return CFE_SUCCESS;
} /* End of TO_LAB_init() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -270,7 +269,7 @@ int32 TO_LAB_EnableOutput(const TO_LAB_EnableOutputCmd_t *data)

++TO_LAB_Global.HkTlm.Payload.CommandCounter;
return CFE_SUCCESS;
} /* End of TO_LAB_EnableOutput() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -312,7 +311,7 @@ void TO_LAB_process_commands(void)
return;
}
}
} /* End of TO_process_commands() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -361,8 +360,7 @@ void TO_LAB_exec_local_command(CFE_SB_Buffer_t *SBBufPtr)
(unsigned int)CommandCode);
++TO_LAB_Global.HkTlm.Payload.CommandErrorCounter;
}

} /* End of TO_exec_local_command() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -386,7 +384,7 @@ int32 TO_LAB_ResetCounters(const TO_LAB_ResetCountersCmd_t *data)
TO_LAB_Global.HkTlm.Payload.CommandErrorCounter = 0;
TO_LAB_Global.HkTlm.Payload.CommandCounter = 0;
return CFE_SUCCESS;
} /* End of TO_LAB_ResetCounters() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -436,7 +434,7 @@ int32 TO_LAB_SendDataTypes(const TO_LAB_SendDataTypesCmd_t *data)

++TO_LAB_Global.HkTlm.Payload.CommandCounter;
return CFE_SUCCESS;
} /* End of TO_LAB_SendDataTypes() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -448,7 +446,7 @@ int32 TO_LAB_SendHousekeeping(const CFE_MSG_CommandHeader_t *data)
CFE_SB_TimeStampMsg(&TO_LAB_Global.HkTlm.TlmHeader.Msg);
CFE_SB_TransmitMsg(&TO_LAB_Global.HkTlm.TlmHeader.Msg, true);
return CFE_SUCCESS;
} /* End of TO_LAB_SendHousekeeping() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -467,8 +465,7 @@ void TO_LAB_openTLM(void)
}

/*---------------- Add static arp entries ----------------*/

} /* End of TO_open_TLM() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -492,7 +489,7 @@ int32 TO_LAB_AddPacket(const TO_LAB_AddPacketCmd_t *data)

++TO_LAB_Global.HkTlm.Payload.CommandCounter;
return CFE_SUCCESS;
} /* End of TO_AddPkt() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand All @@ -514,7 +511,7 @@ int32 TO_LAB_RemovePacket(const TO_LAB_RemovePacketCmd_t *data)
(unsigned int)CFE_SB_MsgIdToValue(pCmd->Stream));
++TO_LAB_Global.HkTlm.Payload.CommandCounter;
return CFE_SUCCESS;
} /* End of TO_LAB_RemovePacket() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -544,7 +541,7 @@ int32 TO_LAB_RemoveAll(const TO_LAB_RemoveAllCmd_t *data)

++TO_LAB_Global.HkTlm.Payload.CommandCounter;
return CFE_SUCCESS;
} /* End of TO_LAB_RemoveAll() */
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -593,7 +590,7 @@ void TO_LAB_forward_telemetry(void)
}
/* If CFE_SB_status != CFE_SUCCESS, then no packet was received from CFE_SB_ReceiveBuffer() */
} while (CFE_SB_status == CFE_SUCCESS);
} /* End of TO_forward_telemetry() */
}

/************************/
/* End of File Comment */
Expand Down
2 changes: 1 addition & 1 deletion fsw/src/to_lab_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/

/* Development Build Macro Definitions */
#define TO_LAB_BUILD_NUMBER 21 /*!< Development Build: Number of commits since baseline */
#define TO_LAB_BUILD_NUMBER 32 /*!< Development Build: Number of commits since baseline */
#define TO_LAB_BUILD_BASELINE \
"v2.4.0-rc1" /*!< Development Build: git tag that is the base for the current development */

Expand Down

0 comments on commit 031de3d

Please sign in to comment.