Skip to content

Commit

Permalink
Merge branch 'jph-dev-eds' into jph-testmerge-20240415
Browse files Browse the repository at this point in the history
  • Loading branch information
jphickey committed Apr 15, 2024
2 parents 82a885b + 9448844 commit a2f9ac7
Show file tree
Hide file tree
Showing 108 changed files with 1,889 additions and 5,304 deletions.
24 changes: 2 additions & 22 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
Expand All @@ -19,26 +19,7 @@ AlwaysBreakBeforeMultilineStrings: false
BinPackArguments: true
BinPackParameters: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: false
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: true
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBraces: Allman
BreakBeforeTernaryOperators: true
BreakStringLiterals: true
ColumnLimit: 120
Expand All @@ -53,7 +34,6 @@ IncludeBlocks: Preserve
IncludeCategories: []
IncludeIsMainRegex: '$'
IndentCaseLabels: true
IndentExternBlock: NoIndent
IndentPPDirectives: None
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: true
Expand Down
5 changes: 3 additions & 2 deletions .github/codeql/jpl-misra.qls
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
- cpp/jsf/av-rule-168
# MISRA 6-2-2
- cpp/jsf/av-rule-202
# MISRA Rule 9-5-1
- cpp/jsf/av-rule-153
# JPL Rules
- /cpp/jpl-c/*/
# Exclude queries with too many results
Expand All @@ -28,3 +26,6 @@
# JPL 24
- cpp/jpl-c/multiple-stmts-per-line
- cpp/jpl-c/multiple-var-decls-per-line
# Excluded since cFS use unions judiciously
# MISRA Rule 9-5-1
- cpp/jsf/av-rule-153
25 changes: 25 additions & 0 deletions .github/scripts/cppcheck-merge.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" encoding="UTF-8"/>
<xsl:variable name="merge_items" select="document($merge_file)/results/errors/error" />

<!-- A default template that makes an XML output identical to the input -->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>

<!--
A specific template for the "errors" element, which includes:
all the "error" child elements from this element
all the "error" elements from the merged document
-->
<xsl:template match="results/errors">
<xsl:copy>
<xsl:apply-templates select="error" />
<xsl:apply-templates select="$merge_items" />
</xsl:copy>
</xsl:template>

</xsl:stylesheet>
17 changes: 17 additions & 0 deletions .github/scripts/cppcheck-xml2text.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" encoding="UTF-8"/>
<xsl:template match="/">## CppCheck <xsl:value-of select="//cppcheck/@version"/> Summary
<xsl:if test="count(//error) > 0">
| error | warning | style | performance | portability | information |
| --- | --- | --- | --- | --- | --- |
| <xsl:value-of select="count(//error[@severity='error'])"/> | <xsl:value-of select="count(//error[@severity='warning'])"/> | <xsl:value-of select="count(//error[@severity='style'])"/> | <xsl:value-of select="count(//error[@severity='performance'])"/> | <xsl:value-of select="count(//error[@severity='portability'])"/> | <xsl:value-of select="count(//error[@severity='information'])"/> |

| severity | location | error id | issue |
| --- | --- | --- | --- |
<xsl:for-each select="results//error">| <xsl:value-of select="@severity"/> | <xsl:value-of select="location/@file"/>:<xsl:value-of select="location/@line"/> | <xsl:value-of select="@id"/> | <xsl:value-of select="@msg"/> |
</xsl:for-each>
</xsl:if>
**<xsl:value-of select="count(//error)"/> error(s) reported**
</xsl:template>
</xsl:stylesheet>
69 changes: 69 additions & 0 deletions .github/scripts/create_ccb_agenda.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import subprocess
import json
import sys
import time
import os

# extract pull request data from GitHub
repos = ['cFS', 'cFE', 'osal', 'psp', 'sch_lab', 'ci_lab', 'to_lab', 'sample_app', 'sample_lib', 'elf2cfetbl', 'tblcrctool','cFS-GroundSystem', 'CF', 'CS', 'DS','FM', 'HK', 'HS', 'LC', 'MD', 'MM', 'SC']

for repo in repos:
subprocess.Popen('gh pr list --repo nasa/' + str(repo) + ' --search "draft:false" --json number,author,title,url,additions,deletions,labels | jq -c ' + '\'reduce range(0, length) as $index (.; (.[$index].author=.[$index].author.login | .[$index].number=(.[$index].number|"\'' + str(repo) + '\' PR #\(.)") )) | .[]\' ' + '>> temp.json', shell=True)

time.sleep(5)
subprocess.Popen('jq -s . temp.json > prs.json', shell=True)
time.sleep(5)

# load a list of pull requests as python dictionaries
with open ('prs.json') as prs_file:
prs = json.load(prs_file)

PrData = dict() # {author: [pr1, pr2, pr3, ...]}
AuthorPrChanges = dict() # {author: #TotalChanges}

for pr in prs:
ignore = False
for label in pr['labels']:
if label['name'] == 'CCB:Ignore' or label['name'] == 'CCB:Approved':
ignore = True
break
if ignore == False:
if pr['author'] not in PrData:
PrData[pr['author']] = [pr]
AuthorPrChanges[pr['author']] = pr['additions'] + pr['deletions']
else:
PrData[pr['author']].append(pr)
AuthorPrChanges[pr['author']] += pr['additions'] + pr['deletions']

# no prs to write, exit program
if len(PrData) == 0:
print("Failed to find relevant Pull Requests for the agenda. Exiting...\n")
sys.exit()

# re-order dict according to sum(additions, deletions) of each pr for each author
AuthorPrChanges = {k: v for k, v in sorted(AuthorPrChanges.items(), key=lambda item: item[1])}

# write to markdown
CCBfilename = "CCBAgenda.md"
with open(CCBfilename, 'w') as f:
f.write("## Items for Discussion\n\n")
for author in AuthorPrChanges.keys():
f.write("### @" + author + "\n\n")
for pr_auth in PrData[author]:
if (author == pr_auth['author']):
f.write("[" + pr_auth['number'] + "](" + pr_auth['url'].replace("pull", "issues") + ") " + pr_auth['title'] + "\n\n")

# close files
f.close()
prs_file.close()
time.sleep(5)
try:
os.remove("prs.json")
os.remove("temp.json")
except OSError:
pass

time.sleep(5)

if (os.stat(CCBfilename).st_size != 0):
print("CCB markdown has been successfully created")
60 changes: 30 additions & 30 deletions .github/workflows/build-cfs-deprecated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ defaults:
shell: bash

jobs:
#Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action.
#Checks 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
Expand All @@ -31,7 +31,7 @@ jobs:
concurrent_skipping: 'same_content'
skip_after_successful_duplicate: 'true'
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'

build-cfs-omit-deprecated-false:
name: "[Deprecated] Build"
needs: check-for-duplicates
Expand All @@ -45,36 +45,36 @@ jobs:

# Set the type of machine to run on
env:
BUILDTYPE: ${{ matrix.buildtype }}
BUILDTYPE: ${{ matrix.buildtype }}

steps:
- name: Cache Source and Build
id: cache-src-bld
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: /home/runner/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/*
key: deprecated-build-${{ github.run_number }}-${{ matrix.buildtype }}

- name: Checkout cFS
if: steps.cache-src-bld.outputs.cache-hit != 'true'
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: true

- name: Check versions
run: git submodule

- name: Copy Makefile
run: |
cp ./cfe/cmake/Makefile.sample Makefile
cp -r ./cfe/cmake/sample_defs sample_defs
- name: Prep Build
run: make prep
run: make prep

- name: Make
run: make install

tests-and-coverage-omit-deprecated-false:
name: "[Deprecated] Run Unit Tests and Check Coverage"
needs: build-cfs-omit-deprecated-false
Expand All @@ -93,14 +93,14 @@ jobs:
steps:
- name: Install Dependencies
run: sudo apt-get install lcov -y

- name: Cache Source and Deprecated Build
id: cache-src-bld
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: /home/runner/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/*
key: deprecated-build-${{ github.run_number }}-${{ matrix.buildtype }}
key: deprecated-build-${{ github.run_number }}-${{ matrix.buildtype }}

- name: Run Tests
run: make test

Expand All @@ -124,7 +124,7 @@ jobs:
steps:
- name: Cache Source and Deprecated Build
id: cache-src-bld
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: /home/runner/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/*
key: deprecated-build-${{ github.run_number }}-${{ matrix.buildtype }}
Expand All @@ -141,7 +141,7 @@ jobs:
working-directory: ./build/exe/cpu1/

- name: Archive cFS Startup Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: cFS-startup-log-omit-deprecate-false${{ matrix.buildtype }}
path: ./build/exe/cpu1/cFS_startup_cpu1.txt
Expand All @@ -162,16 +162,16 @@ jobs:
name: "[DEPRECATED] cFS Functional Tests"
runs-on: ubuntu-20.04
timeout-minutes: 15

strategy:
fail-fast: false
matrix:
buildtype: [debug, release]

steps:
steps:
- name: Cache Source and Deprecated Build
id: cache-src-bld
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: /home/runner/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/*
key: deprecated-build-${{ github.run_number }}-${{ matrix.buildtype }}
Expand All @@ -188,34 +188,34 @@ jobs:
../host/cmdUtil --pktid=0x1806 --cmdcode=14 --endian=LE --uint32=2
../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=0
while [[ ! -f cf/cfe_test.log ]]; do
temp=$(grep -c "BEGIN" cf/cfe_test.tmp)
counter=0
while [[ ! -f cf/cfe_test.log ]]; do
temp=$(grep -c "BEGIN" cf/cfe_test.tmp)
if [ $temp -eq $counter ]; then
echo "Test is frozen. Quiting"
break
fi
counter=$(grep -c "BEGIN" cf/cfe_test.tmp)
counter=$(grep -c "BEGIN" cf/cfe_test.tmp)
echo "Waiting for CFE Tests"
sleep 60
sleep 120
done
../host/cmdUtil --endian=LE --pktid=0x1806 --cmdcode=2 --half=0x0002
working-directory: ./build/exe/cpu1/

- name: Archive Functional Test Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: cFS-functional-test-log-omit-deprecate-false-${{ matrix.buildtype }}
path: ./build/exe/cpu1/cf/cfe_test.log

- name: Check for cFS Warnings
run: |
run: |
if [[ -z $(grep -i "SUMMARY.*FAIL::0.*TSF::0.*TTF::0" cf/cfe_test.log) ]]; then
echo "Must resolve Test Failures in cFS Test App before submitting a pull request"
echo ""
grep -i '\[ FAIL]\|\[ TSF]\|\[ TTF]' cf/cfe_test.log
exit -1
fi
working-directory: ./build/exe/cpu1/
working-directory: ./build/exe/cpu1/
12 changes: 6 additions & 6 deletions .github/workflows/build-cfs-rtems4.11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ defaults:
shell: bash

jobs:
#Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action.
#Checks 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
Expand All @@ -28,7 +28,7 @@ jobs:
concurrent_skipping: 'same_content'
skip_after_successful_duplicate: 'true'
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'

build-cfs:
#Continue if check-for-duplicates found no duplicates. Always runs for pull-requests.
needs: check-for-duplicates
Expand All @@ -51,7 +51,7 @@ jobs:
steps:
# Check out the cfs bundle
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: true

Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
steps:
# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: true

Expand All @@ -104,7 +104,7 @@ jobs:
# Setup the build system
- name: Make
run: |
run: |
make SIMULATION=i686-rtems4.11 prep
make install
Expand All @@ -124,7 +124,7 @@ jobs:
# Always archive test logs
- name: Archive cFS Test Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
# Runs even if previous steps have failed
if: always()
with:
Expand Down
Loading

0 comments on commit a2f9ac7

Please sign in to comment.