GithubHelp home page GithubHelp logo

sample_lib's Introduction

Static Analysis Format Check

Core Flight System : Framework : App : Sample Lib

This repository contains a sample library (sample_lib), which is a framework component of the Core Flight System.

This sample library is a non-flight example library implementation for the cFS Bundle. It is intended to be located in the apps/sample_lib subdirectory of a cFS Mission Tree. The Core Flight System is bundled at https://github.com/nasa/cFS (which includes sample_lib as a submodule), which includes build and execution instructions.

sample_lib implements SAMPLE_Function, as an example for how to build and link a library in cFS.

Known issues

As a lab library, extensive testing is not performed prior to release and only minimal functionality is included.

Getting Help

For best results, submit issues:questions or issues:help wanted requests at https://github.com/nasa/cFS.

Official cFS page: http://cfs.gsfc.nasa.gov

sample_lib's People

Contributors

arielsadamsnasa avatar astrogeco avatar avan989 avatar dzbaker avatar jphickey avatar lbleier-gsfc avatar skliper avatar thnkslprpt avatar yammajamma avatar zanzaben avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sample_lib's Issues

Replace direct ref to UT assert structure with macro

Describe the bug
A test in sample_lib is directly referencing the ArgPtr member inside the Context object from the hook call. Since the time this was initially implemented, the Ut Assert framework has improved, and now offers a UT_Hook_GetArgValueByName macro get this value.

Directly referencing the value is not a good design and is likely to break as Ut Assert continues to evolve.

Expected behavior
This should be updated to use the preferred macro, UT_Hook_GetArgValueByName, which is more future-proof and reflects current best practice/recommendations for new tests.

Code snips

if (Context->ArgCount > 0 && strcmp(Context->ArgPtr[0], "SAMPLE_LIB_Function called, buffer=\'%s\'\n") == 0)

System observed on:
Ubuntu 20.04

Additional context
The specific thing pointed to by ArgPtr depends on how the stub was implemented, and the macro abstracts this detail to give a consistent result to the caller. This is why it is important to use the macro.

Reporter Info
Joseph Hickey, Vantage Systems, Inc.

Reuse CodeQL, Format Checker, and Static Analysis Workflows

Is your feature request related to a problem? Please describe.
When needing to change workflows, one must create an issue and PR for each submodule. This feature would reduce duplication.

Describe the solution you'd like
To reuse workflows, the targeted workflow must include workflow_call and inputs as seen below.

on:
  push:
  pull_request:
  workflow_call:
    inputs:
      runs-on: 
        description: Platform to execute on
        type: string
        default: ubuntu-latest

Describe alternatives you've considered
Keep it as is.

Additional context
Tested in OSAL, OSAL cFE CodeQL Reuse Build: https://github.com/ArielSAdamsNASA/osal/runs/4023159610?check_suite_focus=true
Tested in OSAL, OSAL CodeQL Reuse Build: https://github.com/ArielSAdamsNASA/osal/actions/runs/1390702434
cFS CodeQL Reuse: https://github.com/ArielSAdamsNASA/cFS-JSF-Rules/actions/runs/1390561827

Requester Info
Ariel Adams, ASRC Federal

Rename files, functions, and variables to match LIBNAME_* pattern

Is your feature request related to a problem? Please describe.
Naming convention in SAMPLE_LIB is not entirely consistent - some names start with SAMPLE_Lib, others just SAMPLE_.

Describe the solution you'd like
All variables, functions, and other identifiers should use a SAMPLE_LIB_ prefix.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
See nasa/sample_app#77. When fixing that, noted some issues in here too.

Requester Info
Joseph Hickey, Vantage Systems, Inc.

Add Testing Tools to the Security Policy

Is your feature request related to a problem? Please describe.
Users are unaware of how cFS/sample_lib is tested. By providing this information, transparency is provided to the community which promotes trust.

Describe the solution you'd like
The security policy should inform users what tools are being used to test cFS/sample_lib while being cautious of liability issues. To do so, we can state explicitly that our software does not provide liability under the Apache license. The security policy should inform users that they may view the LGTM results. The policy would state that the alerts from LGTM may not be accurate, since they cannot be dismissed.

Add that security report should be emailed.

Additional context
References: https://github.com/thanos-io/thanos/security/policy

Requester Info
Ariel Adams, ASRC Federal

Remove explicit file name references in doxygen file comments to avoid warnings

Is your feature request related to a problem? Please describe.
File comment without a filename implies the comments apply to the current file. Adding the file name makes doxygen try to match that file. The issue is there's multiple files with the same name, so doxygen gets confused unless you add full path. Really it's just overhead since the point is to comment the current file.

Sample warning if you make doc from the bundle:

/home/jhageman/cFS/cFS-GitHub/osal/src/os/posix/src/os-impl-binsem.c:22: warning: the name `os-impl-binsem.c' supplied as the second argument in the \file statement matches the following input files:
   /home/jhageman/cFS/cFS-GitHub/osal/src/os/posix/src/os-impl-binsem.c
   /home/jhageman/cFS/cFS-GitHub/osal/src/os/rtems/src/os-impl-binsem.c
   /home/jhageman/cFS/cFS-GitHub/osal/src/os/vxworks/src/os-impl-binsem.c
Please use a more specific name by including a (larger) part of the path!

Describe the solution you'd like
Easiest to just remove the name since for every case the comment applies to the current file

Describe alternatives you've considered
None

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC

Redundant comments (/* end of function */, /* end if */ etc.)

Checklist

  • I reviewed the Contributing Guide.
  • I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.

Describe the bug
Copy of nasa/to_lab#68 and nasa/sample_app#111
There are quite a few redundant comments in the code, such as:

  • /* end of function */-type comments
  • /* end if */-type comments
  • function header comments which include the function name

Expected behavior
Remove redundant comments to reduce clutter and inconsistency in the code, and improve readability.

Reporter Info
@thnkslprpt

Fix non-compliant header guards

Is your feature request related to a problem? Please describe.
Leading _ is reserved:

#ifndef _sample_lib_h_
#define _sample_lib_h_

#endif /* _sample_lib_h_ */

#ifndef _sample_lib_internal_h_
#define _sample_lib_internal_h_

#endif /* _sample_lib_internal_h_ */

Describe the solution you'd like
Match cFS standard pattern:

#ifndef SAMPLE_LIB_VERSION_H
#define SAMPLE_LIB_VERSION_H

Describe alternatives you've considered
None

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC

CI updates - add static analysis and format in workflow

Is your feature request related to a problem? Please describe.
Travis-CI not transitioned to github actions

Describe the solution you'd like
Transition CI

Describe alternatives you've considered
None

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC

Add input and output parameters to SAMPLE_LIB_Function to show more advanced generic stubs/hooks

Is your feature request related to a problem? Please describe.
SAMPLE_LIB_Function takes no parameters, so can't show example of registering them and using a hook.

Describe the solution you'd like
Add parameters (both pass by value and reference), update stubs to use suggested pattern:
UT_Stub_RegisterContextGenericArg(UT_KEY(SAMPLE_LIB_Function), param);

Follow on add a hook (likely from sample_app), register and show use of UT_Hook_GetArgValueByName.

Describe alternatives you've considered
There are plenty of implementations in core already, but hard to tell what the "gold standard" is. Need to trade complexity/simplicity though...

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC

Add unit test example for sample_lib

Is your feature request related to a problem? Please describe.
The SAMPLE library does not implement any unit test. Actual CFE libraries would typically need to do this.

Describe the solution you'd like
A unit test should be implemented to provide a template for implementing a library unit test (code coverage) using the current framework.

Additional context
The unit test for an application (e.g. in sample_app, as in nasa/sample_app#21) is slightly different, as the application typically would not need to expose stubs but a library would. Therefore both sample_app and sample_lib should implement unit tests.

Requester Info
Joseph Hickey, Vantage Systems, Inc.

Format check workflow missing duplicate check, restricting to main push, job name doesn't match

Is your feature request related to a problem? Please describe.
Missing duplicate check, restricting to main, and named wrong:

on:
push:
branches:
- main
pull_request:
jobs:
static-analysis:

Describe the solution you'd like
Fix

Describe alternatives you've considered
None

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC

Update Versioning System

Is your feature request related to a problem? Please describe.
The current versioning system could benefit from incrementing the Build Baseline after each release candidate, setting the Revision to 0 (instead of 99), and replacing the Version String with the Build Baseline/Codename.

Describe the solution you'd like

  1. Build Baseline is incremented after each release candidate (it would be set to "equuleus-rc1" at the time of this issue)
  2. Mission Revision is set to to 00
  3. Addition of a Current Development Cycle Codename #define
  4. Version String is removed, and all references to it replaced with the Build Baseline/Codename

Describe alternatives you've considered
The current system. It has some shortcomings, however, in that the build baseline is incremented very infrequently (which confuses users).

Requester Info
Dylan Z. Baker/ NASA GSFC

Update build to work with interface libraries

Is your feature request related to a problem? Please describe.
As part of nasa/cFE#972 and PR nasa/cFE#1203 the directory structure of CFE is changing. The sample_lib build script was directly referencing certain CFE paths that will need an update after this merge.

Describe the solution you'd like
Utilize additional wrapper functions and interface libraries to facilitate the path change and avoid issues in the future.

Additional context
See also nasa/cFE#1207 to add wrapper functions that will help with the unit test aspect

Requester Info
Joseph Hickey, Vantage Systems, Inc.

Enhanced version reporting

Use CI_LAB_VERSION from cfecfs_version_info.h if available and report on NOOP and startup (along with classic version numbering)

Classic version numbering can then just be updated on release, vs for every commit.

Missing newline at end of sample_lib.c

Is your feature request related to a problem? Please describe.
Clang throws an error about the missing newline at the end of sample_lib.c

Describe the solution you'd like
Add a new line, they are pretty cheap these days.

Describe alternatives you've considered
None

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC

Static analysis workflow missing duplicate check, restricting to main push, remove --quiet

Is your feature request related to a problem? Please describe.
Missing duplicate check, overly restrictive to main push:

on:
push:
branches:
- main
pull_request:
jobs:
static-analysis:

also should remove --quiet flag so files processed will be listed:

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

Describe the solution you'd like
Fix

Describe alternatives you've considered
None

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC

Apply standard code style

Is your feature request related to a problem? Please describe.
Inconstant style

Describe the solution you'd like
See nasa/ci_lab#30 and nasa/ci_lab#28

Describe alternatives you've considered
N/A

Additional context
N/A

Requester Info
Jacob Hageman - NASA/GSFC

Add Contributing Guide

Is your feature request related to a problem? Please describe.
Add a contributing guide for the sample_lib repo.

Describe the solution you'd like
Create a contributing guide markdown file. In the guide, add a link to the cFS contributing guide.

Requester Info
Ariel Adams, ASRC Federal

Add a functional test example

Is your feature request related to a problem? Please describe.
APIs should have functional tests that verify implementation within operational context (full stack, not stubs). Coverage tests can not fully exercise intended functionality since they utilize stubs.

Describe the solution you'd like
Add example use of the cFE Functional test framework

Describe alternatives you've considered
None

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC

Refactor UT_SetForceFail

Describe the bug
UT_SetForceFail was refactored to UT_SetDefaultReturnValue for nasa/osal#559. It needs to have its name changed here as well.

Expected behavior
Change UT_SetForceFail to UT_SetDefaultReturnValue

Additional context
Part of nasa/osal#559

Reporter Info
Alex Campbell

Add Build name and Build number to version.h

Is your feature request related to a problem? Please describe.
Need a better way to describe versions during development

Describe the solution you'd like
Add Build name and Build number to version.h
As discussed, we will add a a build name string and a continuously incrementing build number to version.h

Additional context
See notes from CCB: https://github.com/nasa/cFS/wiki/Community-CCB-Agenda:-July-01-2020

Requester Info
Gerardo E. Cruz-Ortiz, NASA-GSFC

Unit tests need to link with UT_COVERAGE_COMPILE_FLAGS/UT_COVERAGE_LINK_FLAGS

Is your feature request related to a problem? Please describe.
nasa/osal#404 cleans up the compiler flag management, and as part of this it exports two variables, UT_COVERAGE_COMPILE_FLAGS and UT_COVERAGE_LINK_FLAGS, rather than a single UT_C_FLAGS value.

Describe the solution you'd like
The unit tests need to use these variables, not UT_C_FLAGS.

Additional context
Needs to be included with the nasa/osal#404 merge.

Requester Info
Joseph Hickey, Vantage Systems, Inc.

Fix doxygen warnings

Describe the bug
Warnings are generated when building the documentation.

To Reproduce
Steps to reproduce the behavior:

  1. Do make doc from the cFS directory
  2. Observe the warnings in cFS/build/doc/warnings.log

Expected behavior
No warnings should be generated

Reporter Info
Leor Bleier GSFC\582

Typos in documentation, print statements, and comments

Is your feature request related to a problem? Please describe.
Found multiple typos throughout the codebase

Describe the solution you'd like
Correct grammar and spelling errors

Describe alternatives you've considered
None

Additional context
Retroactive issue for #65

Coverage test not installed in correct directory

Describe the bug
Coverage test not installed in correct directory - see nasa/cFE#881

To Reproduce
Make unit tests, make install, observe unit test in build directory.

Expected behavior
Should go in target directory (build/exe/cpu1 for sample config)

Code snips

install(TARGETS ${TESTNAME}-testrunner DESTINATION ${TGTNAME}/${UT_INSTALL_SUBDIR})

System observed on:

  • Hardware: cFS Dev Server
  • OS: Ubuntu 18.04
  • Versions: bundle main

Additional context
None

Reporter Info
Jacob Hageman - NASA/GSFC

Implement Coding Standard Rules in CodeQ

Is your feature request related to a problem? Please describe.
CodeQL does not use JPL rules, which is used in the upcoming coding standard.

Describe the solution you'd like
Implement JPL rules for CodeQL. Continue using the security queries, but keep them separate from the JPL results. Can use two different workflows, one for the coding standard and one for the security queries.

Describe alternatives you've considered
Might be able to use one workflow, as long as the results can be easily identified as a coding standard issue or security issue.

Additional context
JPL queries are found here: https://github.com/github/codeql/tree/main/cpp/ql/src/JPL_C

Requester Info
Ariel Adams, ASRC Federal

Add at least one conditional for unit testing

Is your feature request related to a problem? Please describe.
In the process of providing useful examples for unit testing, the sample lib should contain
at least one "if" statement to demonstrate how the alternate paths can be exercised in UT.

Describe the solution you'd like
Add a call to a simple C library function during SAMPLE_LibInit, and have an alternate return code (not CFE_SUCCESS) as based off the result. Unit test can then force the alternate path to execute.

Describe alternatives you've considered
N/A

Additional context
This will add considerable value to the UT examples

Requester Info
Joseph Hickey, Vantage Systems, Inc.

Release 1.1.0 Prep

Is your feature request related to a problem? Please describe.
Updates for release:

  • Updated README
  • removed custom license document
  • Updated copyright release version cFE 6.6 -> 6.7

Requester Info
Jacob Hageman - NASA/GSFC

Apply latest copyright header

Is your feature request related to a problem? Please describe.
Updated copyright header

Describe the solution you'd like
Update

Describe alternatives you've considered
None

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC

Add CodeQL analysis to workflow

Is your feature request related to a problem? Please describe.
CodeQL analysis not implemented in submodules

Describe the solution you'd like
Add so alerts are generated on pull requests to submodules

Describe alternatives you've considered
None

Additional context
CodeQL is run at the bundle (nasa/cFS) level, but link to code in submodules doesn't work.

Requester Info
Jacob Hageman - NASA/GSFC

CodeQL Workflow Broken due to Name Change

Describe the bug

Merging nasa/cFS#413 broke the components' CodeQL workflow as expected.

Need to update the CodeQL workflows to match the patterns implemented in nasa/cFE#2035

To Reproduce

See failed workflows

Expected behavior

Workflow executes

Code snips
None

System observed on:
GitHub Actions

Additional context
Use uses: nasa/cFS/.github/workflows/codeql-reusable.yml@main

Reporter Info
Ariel Adams, ASRC Federal

Unit test doesn't get installed

Is your feature request related to a problem? Please describe.
Missing unit test from install directory

Describe the solution you'd like
Install

Describe alternatives you've considered
N/A

Additional context
Same as nasa/sample_app#81

Requester Info
Jacob Hageman - NASA/GSFC

Update Versioning System

Is your feature request related to a problem? Please describe.
The current versioning system could benefit from incrementing the Build Baseline after each release candidate, setting the Revision to 0 (instead of 99), and replacing the Version String with the Build Baseline/Codename.

Describe the solution you'd like

  1. Build Baseline is incremented after each release candidate (it would be set to "equuleus-rc1" at the time of this issue)
  2. Mission Revision is set to to 00
  3. Addition of a Current Development Cycle Codename #define
  4. Version String is removed, and all references to it replaced with the Build Baseline/Codename

Describe alternatives you've considered
The current system. It has some shortcomings, however, in that the build baseline is incremented very infrequently (which confuses users).

Requester Info
Dylan Z. Baker/ NASA GSFC

Implement a Security Policy

Describe the bug
Create a security policy for users on how to report security vulnerabilities.

Expected behavior
The security policy should instruct users on how to report security vulnerabilities and provide them additional contact information for questions and concerns.

Additional context
Additional sections that may be included:

  • What to expect security-wise such as what type of testing is done
  • Address privacy concerns
  • Supported versions
  • License
  • Known vulnerabilities

References to Public Security Policies:
https://github.com/thanos-io/thanos/security/policy
https://github.com/minhealthnz/nzcovidtracer-app/security/policy
https://github.com/odoo/odoo/security/policy

Reporter Info
Ariel Adams, ASRC Federal

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.