Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tblCRCTool Integration candidate: 2021-02-02 #35

Merged
merged 7 commits into from
Feb 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: tools/tblCRCTool

- 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 tools/tblCRCTool/

- 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/tblCRCTool/workflows/Static%20Analysis/badge.svg)
![Format Check](https://github.com/nasa/tblCRCTool/workflows/Format%20Check/badge.svg)

# Core Flight System : Framework : Tool : Table CRC Generator

This repository contains NASA's Table CRC Generator Tool (tblCRCTool), which is a framework component of the Core Flight System.
Expand All @@ -6,6 +9,13 @@ This lab application is a ground utility to generate binary table CRCs for cFS.

## Version Notes

### Development Build: 1.2.0-rc1+dev19

- Changes CLI "help" option to use two dashes: `--help`
- Adds static analysis and format check to continuous integration workflow. Adds workflow status badges to ReadMe.
- Adds CodeQL Analysis to continuous integration workflow.
- See <https://github.com/nasa/tblCRCTool/pull/35>

### Development Build: 1.2.0-rc1+dev12

- Documentation: Add `Security.md` with instructions on reporting vulnerabilities
Expand Down
3 changes: 1 addition & 2 deletions cfe_ts_crc.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ uint32 CalculateCRC(void *DataPtr, uint32 DataLength, uint32 InputCRC)
}

return (Crc);

}

int main(int argc, char **argv)
Expand All @@ -112,7 +111,7 @@ int main(int argc, char **argv)
char buffer[100];

/* check for valid input */
if ((argc != 2) || (strncmp(argv[1], "-help", 100) == 0))
if ((argc != 2) || (strncmp(argv[1], "--help", 100) == 0))
{
printf("%s\n", CFE_TS_CRC_VERSION_STRING);
printf("\nUsage: cfe_ts_crc [filename]\n");
Expand Down
18 changes: 10 additions & 8 deletions cfe_ts_crc_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/*
* Development Build Macro Definitions
*/
#define CFE_TS_CRC_BUILD_NUMBER 12 /*!< @brief Number of commits since baseline */
#define CFE_TS_CRC_BUILD_NUMBER 19 /*!< @brief Number of commits since baseline */
#define CFE_TS_CRC_BUILD_BASELINE \
"v1.2.0+dev" /*!< @brief Development Build: git tag that is the base for the current */

Expand All @@ -40,9 +40,11 @@
*/
#define CFE_TS_CRC_MAJOR_VERSION 1 /*!< @brief ONLY APPLY for OFFICIAL releases. Major version number. */
#define CFE_TS_CRC_MINOR_VERSION 1 /*!< @brief ONLY APPLY for OFFICIAL releases. Minor version number. */
#define CFE_TS_CRC_REVISION 99 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision version number. A value of "99" indicates an unreleased development version. */
#define CFE_TS_CRC_REVISION \
99 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision version number. A value of "99" indicates an unreleased \
development version. */

#define CFE_TS_CRC_MISSION_REV 0 /*!< @brief ONLY USED by MISSION Implementations. Mission revision */
#define CFE_TS_CRC_MISSION_REV 0 /*!< @brief ONLY USED by MISSION Implementations. Mission revision */

/*
* Tools to construct version string
Expand All @@ -61,10 +63,10 @@
* @details Reports the current development build's baseline, number, and name. Also includes a note about the latest
* official version. @n See @ref cfsversions for format differences between development and release versions.
*/
#define CFE_TS_CRC_VERSION_STRING \
" cFE TS CRC calculator (tblCRCtool) \n" \
" DEVELOPMENT BUILD \n" \
" " CFE_TS_CRC_VERSION " \n" \
" Last Offical Release: tblCRCtool v3.1.0" /* For full support please use official release version */
#define CFE_TS_CRC_VERSION_STRING \
" cFE TS CRC calculator (tblCRCtool) \n" \
" DEVELOPMENT BUILD \n" \
" " CFE_TS_CRC_VERSION " \n" \
" Last Offical Release: tblCRCtool v3.1.0" /* For full support please use official release version */

#endif /* CFE_TS_CRC_VERSION_H */