-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop-cfs-handlers' into develop. Close #234.
**Description** The cFS backend currently generates code that would normally have to be adjusted by the user. The default cFS template assumes that there's only one error handler, and it's name is fixed to `split`. This is clearly sub-ideal: we want users to be able to generate code that they do not have to modify. The `cfs` command should be modified to accept a handlers file, and the cFS backend and template should be adjusted accordingly. **Type** - Feature: Improve capabilities of cFS backend. **Additional context** None. **Requester** - Ivan Perez. **Method to check presence of bug** Not applicable (not a bug). **Expected result** The `cfs` command accepts a handlers file as argument, and it is used in the cFS backend to customize the shape of the cFS application. The following Dockerfile checks that generating a cFS application with and without the feature proposed renders the same result, after which it prints the message "Success". There's a slight difference in the text published in the events (they now contain the name of the handler or trigger activated), so that different is disregarded. It requires an additional BASE_COMMIT variable pointing to a commit prior to merging this feature. ``` FROM ubuntu:focal ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update RUN apt-get install --yes \ curl g++ gcc git libgmp3-dev libz-dev make pkg-config RUN mkdir -p $HOME/.local/bin ENV PATH=$PATH:/root/.local/bin/ RUN curl https://downloads.haskell.org/~ghcup/0.1.17.7/x86_64-linux-ghcup-0.1.17.7 -o $HOME/.local/bin/ghcup RUN chmod a+x $HOME/.local/bin/ghcup ENV PATH=$PATH:/root/.ghcup/bin/ RUN ghcup install ghc 9.10 RUN ghcup install cabal 3.12 RUN ghcup set ghc 9.10.1 RUN cabal update SHELL ["/bin/bash", "-c"] CMD git clone $REPO \ && cd $NAME \ && git checkout $BASE_COMMIT \ && cabal install ogma-cli:ogma \ && ogma cfs --variable-file ogma-cli/examples/cfs-variables --variable-db ogma-cli/examples/cfs-variable-db --app-target-dir original \ && git checkout $COMMIT \ && cabal install --overwrite-policy=always ogma-cli:ogma \ && ogma cfs --variable-file ogma-cli/examples/cfs-variables --variable-db ogma-cli/examples/cfs-variable-db --app-target-dir updated --handlers-file ogma-cli/examples/cfs-handlers \ && sed -i -e 's/violation: split/violation/g' updated/fsw/src/copilot_cfs.c \ && diff -rq original updated \ && echo "Success" ``` Command (substitute variables based on new path after merge): ```sh $ docker run -e "REPO=https://github.com/NASA/ogma" -e "NAME=ogma" -e "BASE_COMMIT=943bcbd83d1bd2075482c7f2beeca62751559b50" -e "COMMIT=<HASH>" -it ogma-verify-234 ``` **Proposed solution** Modify `ogma-cli`'s `cfs` CLI command to accept a handlers file, and pass it on to the backend in `ogma-core`. Modify `ogma-core`'s cFS backend to accept a handlers file, read all the handlers listed inside, and pass their names to the template. Modify `ogma-core`'s cFS template to generate a handler for each of the handlers listed in the handlers file. Add a new example handlers file to the `ogma-cli/examples` directory. Update README to document new argument, new variable available to template, and remove limitations that no longer apply. **Further notes** None.
- Loading branch information
Showing
7 changed files
with
91 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
split |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters