Skip to content

Commit

Permalink
Merge pull request #1212 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
osal Integration Candidate: Caelum+dev2
  • Loading branch information
astrogeco committed Jan 21, 2022
2 parents 4cc6dbb + 6375bbf commit f75f67c
Show file tree
Hide file tree
Showing 22 changed files with 272 additions and 315 deletions.
110 changes: 7 additions & 103 deletions .github/workflows/codeql-cfe-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,107 +4,11 @@ on:
push:
pull_request:

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

jobs:
#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
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"]'

CodeQL-Security-Build:
needs: check-for-duplicates
if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }}
runs-on: ubuntu-18.04
timeout-minutes: 15

steps:
- name: Checkout bundle
uses: actions/checkout@v2
with:
repository: nasa/cFS
submodules: true

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

- name: Check versions
run: git submodule

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: c
config-file: nasa/cFS/.github/codeql/codeql-security.yml@main

- name: Set up for build
run: |
cp ./cfe/cmake/Makefile.sample Makefile
cp -r ./cfe/cmake/sample_defs sample_defs
make prep
- name: Build
run: make -j native/default_cpu1/osal/

- name: Run tests
run: (cd build/native/default_cpu1/osal && make test)

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

CodeQL-Coding-Standard-Build:
needs: check-for-duplicates
if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }}
runs-on: ubuntu-18.04
timeout-minutes: 15

steps:
- name: Checkout bundle
uses: actions/checkout@v2
with:
repository: nasa/cFS
submodules: true

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

- name: Check versions
run: git submodule

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: c
config-file: nasa/cFS/.github/codeql/codeql-coding-standard.yml@main

- name: Set up for build
run: |
cp ./cfe/cmake/Makefile.sample Makefile
cp -r ./cfe/cmake/sample_defs sample_defs
make prep
- name: Build
run: make -j native/default_cpu1/osal/

- name: Run tests
run: (cd build/native/default_cpu1/osal && make test)

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
codeql:
name: CodeQl Analysis
uses: nasa/cFS/.github/workflows/codeql-build.yml@main
with:
make-prep: 'make prep'
make: 'make -j native/default_cpu1/osal/'
tests: '(cd build/native/default_cpu1/osal && make test)'
84 changes: 7 additions & 77 deletions .github/workflows/codeql-osal-default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,81 +4,11 @@ on:
push:
pull_request:

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

jobs:

#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
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"]'

CodeQL-Security-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:
- name: Checkout submodule
uses: actions/checkout@v2

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: c
config-file: nasa/cFS/.github/codeql/codeql-security.yml@main

- name: Set up for build
run: |
cp Makefile.sample Makefile
make prep
- name: Build
run: make -j

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

CodeQL-Coding-Standard-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:
- name: Checkout submodule
uses: actions/checkout@v2

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: c
config-file: nasa/cFS/.github/codeql/codeql-coding-standard.yml@main

- name: Set up for build
run: |
cp Makefile.sample Makefile
make prep
- name: Build
run: make -j

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
codeql:
name: CodeQl Analysis
uses: nasa/cFS/.github/workflows/codeql-build.yml@main
with:
setup: 'cd osal && cp Makefile.sample Makefile'
make-prep: 'cd osal && make prep'
make: 'cd osal && make -j'
46 changes: 3 additions & 43 deletions .github/workflows/format-check.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,13 @@
name: Format Check

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

jobs:

static-analysis:
format-check:
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
uses: nasa/cFS/.github/workflows/format-check.yml@main
50 changes: 4 additions & 46 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,13 @@
name: Static Analysis

# Run this workflow every time a new commit pushed to your repository
# Run on all push and pull requests
on:
push:
branches:
- main
pull_request:

jobs:

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

strategy:
fail-fast: false
matrix:
cppcheck: [all, osal]

steps:

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

# Checks out a copy of the cfs bundle
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true

- name: Run bundle cppcheck
if: ${{matrix.cppcheck =='all'}}
run: cppcheck --force --inline-suppr . 2> ${{matrix.cppcheck}}_cppcheck_err.txt

# Run strict static analysis for embedded portions of osal
- name: osal strict cppcheck
if: ${{matrix.cppcheck =='osal'}}
run: |
cppcheck --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive ./src/bsp ./src/os 2> ./${{matrix.cppcheck}}_cppcheck_err.txt
- name: Archive Static Analysis Artifacts
uses: actions/upload-artifact@v2
with:
name: ${{matrix.cppcheck}}-cppcheck-err
path: ./*cppcheck_err.txt

- name: Check for errors
run: |
if [[ -s ${{matrix.cppcheck}}_cppcheck_err.txt ]];
then
cat ${{matrix.cppcheck}}_cppcheck_err.txt
exit -1
fi
uses: nasa/cFS/.github/workflows/static-analysis.yml@main
with:
strict-dir-list: './src/bsp ./src/os'
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ The autogenerated OSAL user's guide can be viewed at <https://github.com/nasa/cF

## Version History

### Development Build: v6.0.0-rc4+dev29

- Search global and local symbol tables
- Add missing space to UtAssert_STUB_COUNT
- Add UINT8 and UINT16 equivalents for UtAssert_UINT32_ macros
- correct warnings on gcc11
- Set output in OS_stat handler
- Reuse CodeQL, Static Analysis, Format Check
- See <https://github.com/nasa/osal/pull/1212> and <https://github.com/nasa/cFS/pull/410>
### Development Build: v6.0.0-rc4+dev15

- Add Duplicate Check to Local Unit Test
Expand Down
2 changes: 1 addition & 1 deletion src/os/inc/osapi-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
/*
* Development Build Macro Definitions
*/
#define OS_BUILD_NUMBER 15
#define OS_BUILD_NUMBER 29
#define OS_BUILD_BASELINE "v6.0.0-rc4"

/*
Expand Down
2 changes: 1 addition & 1 deletion src/os/portable/os-impl-no-symtab.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*
* See prototype for argument/return detail
*-----------------------------------------------------------------*/
int32 OS_GlobalSymbolLookup_Impl(cpuaddr *SymbolAddress, const char *SymbolName)
int32 OS_SymbolLookup_Impl(cpuaddr *SymbolAddress, const char *SymbolName)
{
return OS_ERR_NOT_IMPLEMENTED;
}
Expand Down
25 changes: 22 additions & 3 deletions src/os/portable/os-impl-posix-dl-symtab.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,37 @@ int32 OS_GenericSymbolLookup_Impl(void *dl_handle, cpuaddr *SymbolAddress, const

/*----------------------------------------------------------------
*
* Function: OS_GlobalSymbolLookup_Impl
* Function: OS_SymbolLookup_Impl
*
* Purpose: Implemented per internal OSAL API
* See prototype for argument/return detail
*
*-----------------------------------------------------------------*/
int32 OS_GlobalSymbolLookup_Impl(cpuaddr *SymbolAddress, const char *SymbolName)
int32 OS_SymbolLookup_Impl(cpuaddr *SymbolAddress, const char *SymbolName)
{
int32 status;
int32 status;
int32 local_status = OS_ERROR;
OS_object_iter_t iter;

/* First search global table */
status = OS_GenericSymbolLookup_Impl(OSAL_DLSYM_DEFAULT_HANDLE, SymbolAddress, SymbolName);

/* If not found iterate through module local symbols and break if found */
if (status != OS_SUCCESS)
{
OS_ObjectIdIterateActive(OS_OBJECT_TYPE_OS_MODULE, &iter);
while (OS_ObjectIdIteratorGetNext(&iter))
{
local_status = OS_ModuleSymbolLookup_Impl(&iter.token, SymbolAddress, SymbolName);
if (local_status == OS_SUCCESS)
{
status = local_status;
break;
}
}
OS_ObjectIdIteratorDestroy(&iter);
}

return status;

} /* end OS_SymbolLookup_Impl */
Expand Down
Loading

0 comments on commit f75f67c

Please sign in to comment.