ogma-cli 1.15.0 → 1.16.0
raw patch · 15 files changed
+110/−116 lines, 15 filesdep ~ogma-core
Dependency ranges changed: ogma-core
Files
- CHANGELOG.md +19/−0
- ogma-cli.cabal +2/−2
- src/CLI/CommandCFSApp.hs +13/−17
- src/CLI/CommandCStructs2Copilot.hs +2/−2
- src/CLI/CommandCStructs2MsgHandlers.hs +2/−2
- src/CLI/CommandDiagram.hs +5/−10
- src/CLI/CommandFPrimeApp.hs +17/−20
- src/CLI/CommandOverview.hs +2/−3
- src/CLI/CommandROSApp.hs +14/−17
- src/CLI/CommandReport.hs +1/−1
- src/CLI/CommandSearch.hs +2/−3
- src/CLI/CommandStandalone.hs +4/−6
- src/CLI/CommandTop.hs +1/−1
- src/Main.hs +3/−4
- tests/Main.hs +23/−28
CHANGELOG.md view
@@ -1,5 +1,24 @@ # Revision history for ogma-cli +## [1.16.0] - 2026-09-21++* Version bump (1.16.0) (#606).+* Remove unnecessary line breaks (#520).+* Update cFS examples to avoid MID collisions (#522).+* Add missing periods to Haddock comments (#524).+* Fix spelling of F Prime (#526).+* Fix target directory name in project file in Turtlesim example (#530).+* Add CI job to test ROS 2 backend using Turtlesim example (#534).+* Disable secure mode for package repo in Cabal config in CI jobs (#537).+* Address HLint suggestions (#540).+* Attempt to recover from failure during Haskell tool setup in CI jobs (#558).+* Make file paths in example project files relative to project path (#567).+* Add missing argument to `docker run` in Turtlesim tutorial (#571).+* Fix container name in call to `docker exec` in Turtlesim example (#573).+* Update package index before installing dependencies in CI jobs (#577).+* Update commands to use new input file format by default (#575).+* Fix help message associated with `ros` command option (#604).+ ## [1.15.0] - 2026-07-21 * Version bump (1.15.0) (#508).
ogma-cli.cabal view
@@ -19,7 +19,7 @@ build-type: Simple name: ogma-cli-version: 1.15.0+version: 1.16.0 homepage: https://github.com/nasa/ogma bug-reports: https://github.com/nasa/ogma/issues license: Apache-2.0@@ -147,7 +147,7 @@ , microstache >= 1.0 && < 1.1 , text >= 1.2.3.1 && < 2.2 - , ogma-core >= 1.15.0 && < 1.16+ , ogma-core >= 1.16.0 && < 1.17 hs-source-dirs: src
src/CLI/CommandCFSApp.hs view
@@ -144,7 +144,7 @@ -- * CLI --- | cFS command description+-- | cFS command description. commandDesc :: String commandDesc = "Generate a complete cFS/Copilot application" @@ -214,7 +214,7 @@ <> metavar "FORMAT_NAME" <> help strCFSAppFormatDesc <> showDefault- <> value "fcs"+ <> value "default" ) <*> strOption ( long "prop-format"@@ -250,36 +250,33 @@ strCFSAppProjectArgDesc :: String strCFSAppProjectArgDesc = "Project file" --- | Argument target directory to cFS app generation command+-- | Argument target directory to cFS app generation command. strCFSAppDirArgDesc :: String strCFSAppDirArgDesc = "Target directory" --- | Argument template directory to cFS app generation command+-- | Argument template directory to cFS app generation command. strCFSAppTemplateDirArgDesc :: String strCFSAppTemplateDirArgDesc = "Directory holding cFS application source template" -- | Argument expression to CFS app generation command. strCFSAppConditionExprArgDesc :: String-strCFSAppConditionExprArgDesc =- "Expression used as guard or trigger condition"+strCFSAppConditionExprArgDesc = "Expression used as guard or trigger condition" --- | Argument input file to CFS app generation command+-- | Argument input file to CFS app generation command. strCFSAppFileNameArgDesc :: String-strCFSAppFileNameArgDesc =- "File containing input specification"+strCFSAppFileNameArgDesc = "File containing input specification" --- | Argument variable list to cFS app generation command+-- | Argument variable list to cFS app generation command. strCFSAppVarListArgDesc :: String strCFSAppVarListArgDesc = "File containing list of cFS variables to make accessible" --- | Argument variable database to cFS app generation command+-- | Argument variable database to cFS app generation command. strCFSAppVarDBArgDesc :: String-strCFSAppVarDBArgDesc =- "File containing a DB of known cFS variables"+strCFSAppVarDBArgDesc = "File containing a DB of known cFS variables" --- | Argument handler list to cFS app generation command+-- | Argument handler list to cFS app generation command. strCFSAppHandlerListArgDesc :: String strCFSAppHandlerListArgDesc = "File containing list of Copilot handlers used in the specification"@@ -294,15 +291,14 @@ -- | External command to pre-process individual properties. strCFSAppPropViaDesc :: String-strCFSAppPropViaDesc =- "Command to pre-process individual properties"+strCFSAppPropViaDesc = "Command to pre-process individual properties" -- | Mode name flag description. strCFSAppDiagramModeDesc :: String strCFSAppDiagramModeDesc = "Mode of operation for diagrams (check, calculate, safeguard)" --- | Argument template variables to cFS app generation command+-- | Argument template variables to cFS app generation command. strCFSAppTemplateVarsArgDesc :: String strCFSAppTemplateVarsArgDesc = "JSON file containing additional variables to expand in template"
src/CLI/CommandCStructs2Copilot.hs view
@@ -15,7 +15,7 @@ -- License for the specific language governing permissions and limitations -- under the License. ----- | CLI interface to the CStructs2Copilot subcommand+-- | CLI interface to the CStructs2Copilot subcommand. module CLI.CommandCStructs2Copilot ( -- * Direct command access@@ -68,6 +68,6 @@ <> help strStructsInputFileArgDesc ) --- | Argument C header file to struct conversion command+-- | Argument C header file to struct conversion command. strStructsInputFileArgDesc :: String strStructsInputFileArgDesc = "C header file with struct definitions"
src/CLI/CommandCStructs2MsgHandlers.hs view
@@ -15,7 +15,7 @@ -- License for the specific language governing permissions and limitations -- under the License. ----- | CLI interface to the CStructs2Copilot subcommand+-- | CLI interface to the CStructs2Copilot subcommand. module CLI.CommandCStructs2MsgHandlers ( -- * Direct command access@@ -67,6 +67,6 @@ <> help strMsgHandlersInputFileArgDesc ) --- | Argument C header file to handler generation command+-- | Argument C header file to handler generation command. strMsgHandlersInputFileArgDesc :: String strMsgHandlersInputFileArgDesc = "C header file with struct definitions"
src/CLI/CommandDiagram.hs view
@@ -122,8 +122,7 @@ -- | Command description for CLI help. commandDesc :: String-commandDesc =- "Generate a monitor from state machine diagram"+commandDesc = "Generate a monitor from state machine diagram" -- | Subparser for the @diagram@ command, used to generate a Copilot -- specification from an input diagram file.@@ -216,21 +215,17 @@ -- | Target file name flag description. strDiagramTargetDesc :: String-strDiagramTargetDesc =- "Filename prefix for monitoring files in target language"+strDiagramTargetDesc = "Filename prefix for monitoring files in target language" -- | Mode name flag description. strDiagramModeDesc :: String-strDiagramModeDesc =- "Mode of operation (check, calculate, safeguard)"+strDiagramModeDesc = "Mode of operation (check, calculate, safeguard)" strDiagramInputVarDesc :: String-strDiagramInputVarDesc =- "Name of the input variable"+strDiagramInputVarDesc = "Name of the input variable" strDiagramStateVarDesc :: String-strDiagramStateVarDesc =- "Name of the state variable"+strDiagramStateVarDesc = "Name of the state variable" -- * Error codes
src/CLI/CommandFPrimeApp.hs view
@@ -47,7 +47,7 @@ -- * Command --- | Options needed to generate the FPrime component.+-- | Options needed to generate the F Prime component. data CommandOpts = CommandOpts { fprimeAppProject :: Maybe String , fprimeAppConditionExpr :: Maybe String@@ -63,7 +63,7 @@ , fprimeAppTemplateVars :: Maybe String } --- | Create <https://github.com/nasa/fprime FPrime> component that subscribe+-- | Create <https://github.com/nasa/fprime F Prime> component that subscribe -- to obtain necessary data from the bus and call Copilot when new data -- arrives. --@@ -113,7 +113,7 @@ fromMaybe (fprimeAppTarget c) (projectTargetDir project) , Command.FPrimeApp.commandTemplateDir =- maybe (fprimeAppTemplateDir c) Just (projectTemplateDir project)+ projectTemplateDir project <|> fprimeAppTemplateDir c , Command.FPrimeApp.commandVariables = projectVariableFiles project <|> fprimeAppVariables c@@ -142,11 +142,11 @@ -- * CLI --- | FPrime command description+-- | F Prime command description. commandDesc :: String commandDesc = "Generate a complete F' monitoring component" --- | Subparser for the @fprime@ command, used to generate an FPrime component+-- | Subparser for the @fprime@ command, used to generate an F Prime component -- connected to Copilot monitors. commandOptsParser :: Parser CommandOpts commandOptsParser = CommandOpts@@ -212,7 +212,7 @@ <> metavar "FORMAT_NAME" <> help strFPrimeAppFormatDesc <> showDefault- <> value "fcs"+ <> value "default" ) <*> strOption ( long "prop-format"@@ -237,40 +237,38 @@ ) ) --- | Argument project to FPrime app generation command.+-- | Argument project to F Prime app generation command. strFPrimeAppProjectArgDesc :: String strFPrimeAppProjectArgDesc = "Project file" --- | Argument target directory to FPrime component generation command+-- | Argument target directory to F Prime component generation command. strFPrimeAppDirArgDesc :: String strFPrimeAppDirArgDesc = "Target directory" --- | Argument template directory to FPrime component generation command+-- | Argument template directory to F Prime component generation command. strFPrimeAppTemplateDirArgDesc :: String strFPrimeAppTemplateDirArgDesc = "Directory holding F' component source template" --- | Argument expression to FPrime app generation command.+-- | Argument expression to F Prime app generation command. strFPrimeAppConditionExprArgDesc :: String strFPrimeAppConditionExprArgDesc = "Expression used as guard or trigger condition" --- | Argument input file to FPrime component generation command+-- | Argument input file to F Prime component generation command. strFPrimeAppFileNameArgDesc :: String-strFPrimeAppFileNameArgDesc =- "File containing input specification"+strFPrimeAppFileNameArgDesc = "File containing input specification" --- | Argument variable list to FPrime component generation command+-- | Argument variable list to F Prime component generation command. strFPrimeAppVarListArgDesc :: String strFPrimeAppVarListArgDesc = "File containing list of F' variables to make accessible" --- | Argument variable database to FPrime component generation command+-- | Argument variable database to F Prime component generation command. strFPrimeAppVarDBArgDesc :: String-strFPrimeAppVarDBArgDesc =- "File containing a DB of known F' variables"+strFPrimeAppVarDBArgDesc = "File containing a DB of known F' variables" --- | Argument handler list to FPrime component generation command+-- | Argument handler list to F Prime component generation command. strFPrimeAppHandlerListArgDesc :: String strFPrimeAppHandlerListArgDesc = "File containing list of Copilot handlers used in the specification"@@ -285,8 +283,7 @@ -- | External command to pre-process individual properties. strFPrimeAppPropViaDesc :: String-strFPrimeAppPropViaDesc =- "Command to pre-process individual properties"+strFPrimeAppPropViaDesc = "Command to pre-process individual properties" -- | Additional template variable file flag description. strFPrimeAppTemplateVarsArgDesc :: String
src/CLI/CommandOverview.hs view
@@ -211,7 +211,7 @@ <> metavar "FORMAT_NAME" <> help strOverviewFormatDesc <> showDefault- <> value "fcs"+ <> value "default" ) <*> strOption ( long "prop-format"@@ -247,8 +247,7 @@ -- | External command to pre-process individual properties. strOverviewPropViaDesc :: String-strOverviewPropViaDesc =- "Command to pre-process individual properties"+strOverviewPropViaDesc = "Command to pre-process individual properties" -- | Error code for when a project cannot be read. cannotReadProject :: ErrorCode
src/CLI/CommandROSApp.hs view
@@ -166,7 +166,7 @@ -- * CLI --- | ROS command description+-- | ROS command description. commandDesc :: String commandDesc = "Generate a ROS 2 monitoring package" @@ -236,7 +236,7 @@ <> metavar "FORMAT_NAME" <> help strROSAppFormatDesc <> showDefault- <> value "fcs"+ <> value "default" ) <*> strOption ( long "prop-format"@@ -270,7 +270,7 @@ ( long "testing-vars" <> metavar "variable_name" <> showDefault- <> help strROSAppHandlerListArgDesc+ <> help strROSAppVarsTestingListArgDesc ) ) @@ -278,11 +278,11 @@ strROSAppProjectArgDesc :: String strROSAppProjectArgDesc = "Project file" --- | Argument target directory to ROS app generation command+-- | Argument target directory to ROS app generation command. strROSAppDirArgDesc :: String strROSAppDirArgDesc = "Target directory" --- | Argument template directory to ROS app generation command+-- | Argument template directory to ROS app generation command. strROSAppTemplateDirArgDesc :: String strROSAppTemplateDirArgDesc = "Directory holding ROS application source template"@@ -291,22 +291,20 @@ strROSAppConditionExprArgDesc :: String strROSAppConditionExprArgDesc = "Expression used as guard or trigger condition" --- | Argument input file to ROS app generation command+-- | Argument input file to ROS app generation command. strROSAppFileNameArgDesc :: String-strROSAppFileNameArgDesc =- "File containing input specification"+strROSAppFileNameArgDesc = "File containing input specification" --- | Argument variable list to ROS app generation command+-- | Argument variable list to ROS app generation command. strROSAppVarListArgDesc :: String strROSAppVarListArgDesc = "File containing list of ROS variables to make accessible" --- | Argument variable database to ROS app generation command+-- | Argument variable database to ROS app generation command. strROSAppVarDBArgDesc :: String-strROSAppVarDBArgDesc =- "File containing a DB of known ROS variables"+strROSAppVarDBArgDesc = "File containing a DB of known ROS variables" --- | Argument handler list to ROS app generation command+-- | Argument handler list to ROS app generation command. strROSAppHandlerListArgDesc :: String strROSAppHandlerListArgDesc = "File containing list of Copilot handlers used in the specification"@@ -321,20 +319,19 @@ -- | External command to pre-process individual properties. strROSAppPropViaDesc :: String-strROSAppPropViaDesc =- "Command to pre-process individual properties"+strROSAppPropViaDesc = "Command to pre-process individual properties" -- | Additional template variable file flag description. strROSAppTemplateVarsArgDesc :: String strROSAppTemplateVarsArgDesc = "JSON file containing additional variables to expand in template" --- | Argument packages to tested list to ROS app generation command+-- | Argument packages to tested list to ROS app generation command. strROSAppROSNodesTestingListArgDesc :: String strROSAppROSNodesTestingListArgDesc = "Turn on ROS 2 package node during testing" --- | Argument variables to be tested list to ROS app generation command+-- | Argument variables to be tested list to ROS app generation command. strROSAppVarsTestingListArgDesc :: String strROSAppVarsTestingListArgDesc = "Limit random input generation to these variables"
src/CLI/CommandReport.hs view
@@ -180,7 +180,7 @@ <> metavar "FORMAT_NAME" <> help strReportFormatDesc <> showDefault- <> value "fcs"+ <> value "default" ) <*> strOption ( long "prop-format"
src/CLI/CommandSearch.hs view
@@ -195,7 +195,7 @@ <> metavar "FORMAT_NAME" <> help strSearchFormatDesc <> showDefault- <> value "fcs"+ <> value "default" ) <*> strOption ( long "prop-format"@@ -235,8 +235,7 @@ -- | External command to pre-process individual properties. strSearchPropViaDesc :: String-strSearchPropViaDesc =- "Command to pre-process individual properties"+strSearchPropViaDesc = "Command to pre-process individual properties" -- | Error code for when a project cannot be read. cannotReadProject :: ErrorCode
src/CLI/CommandStandalone.hs view
@@ -15,7 +15,7 @@ -- License for the specific language governing permissions and limitations -- under the License. ----- | CLI interface to the Standalone subcommand+-- | CLI interface to the Standalone subcommand. module CLI.CommandStandalone ( -- * Direct command access@@ -149,8 +149,7 @@ -- | Command description for CLI help. commandDesc :: String-commandDesc =- "Generate a standalone Copilot file from an input specification"+commandDesc = "Generate a standalone Copilot file from an input specification" -- | Subparser for the @standalone@ command, used to generate a Copilot -- specification from an input specification file.@@ -197,7 +196,7 @@ <> metavar "FORMAT_NAME" <> help strStandaloneFormatDesc <> showDefault- <> value "fcs"+ <> value "default" ) <*> strOption ( long "prop-format"@@ -276,8 +275,7 @@ -- | External command to pre-process individual properties. strStandalonePropViaDesc :: String-strStandalonePropViaDesc =- "Command to pre-process individual properties"+strStandalonePropViaDesc = "Command to pre-process individual properties" -- | Additional template variable file flag description. strStandaloneTemplateVarsArgDesc :: String
src/CLI/CommandTop.hs view
@@ -182,7 +182,7 @@ (CommandOptsROSApp <$> CLI.CommandROSApp.commandOptsParser) CLI.CommandROSApp.commandDesc --- | Modifier for the FPrime app expansion subcommand, linking the subcommand+-- | Modifier for the F Prime app expansion subcommand, linking the subcommand -- options and description to the command @fprime@ at top level. subcommandFPrimeApp :: Mod CommandFields CommandOpts subcommandFPrimeApp =
src/Main.hs view
@@ -39,7 +39,7 @@ -- * Generate Robot Operating System (ROS) applications for runtime monitoring -- using Copilot. ----- * Generate F' (FPrime) components for runtime monitoring using Copilot.+-- * Generate F' (F Prime) components for runtime monitoring using Copilot. -- -- More information can be obtained by calling ogma with the argument @--help@. module Main@@ -66,7 +66,6 @@ <> header strProgramSummary ) --- | Short program description+-- | Short program description. strProgramSummary :: String-strProgramSummary =- "ogma - an anything-to-Copilot application generator"+strProgramSummary = "ogma - an anything-to-Copilot application generator"
tests/Main.hs view
@@ -1,4 +1,4 @@--- | Test Ogma+-- | Test Ogma. module Main where import Data.List ( intercalate )@@ -11,10 +11,9 @@ -- | Run all unit tests on Ogma. main :: IO ()-main =- defaultMainWithOpts tests mempty+main = defaultMainWithOpts tests mempty --- | All unit tests for Ogma+-- | All unit tests for Ogma. tests :: [Test.Framework.Test] tests = [@@ -91,13 +90,7 @@ -> Bool -> IO () testCStructs2Copilot file success = do- (ec, _out, _err) <- readProcessWithExitCode "ogma" args ""-- -- True if success is expected and detected, or niether expected nor- -- detected.- let testPass = success == (ec == ExitSuccess)-- assertBool errorMsg testPass+ assertExecution "ogma" args success errorMsg where args = ["structs", "--input-file", file] errorMsg = "Result of processing file " ++ file ++ " failed"@@ -119,15 +112,9 @@ -> Bool -> IO () parseStandaloneFCS file success = do- (ec, _out, _err) <- readProcessWithExitCode "ogma" args ""-- -- True if success is expected and detected, or niether expected nor- -- detected.- let testPass = success == (ec == ExitSuccess)-- assertBool errorMsg testPass+ assertExecution "ogma" args success errorMsg where- args = ["standalone", "--input-file", file]+ args = ["standalone", "--input-file", file, "--input-format", "fcs"] errorMsg = "Parsing file " ++ file ++ " result unexpected." -- | Test standalone backend for FDB format and Lustre.@@ -146,8 +133,7 @@ parseStandaloneFDB :: FilePath -- ^ Path to an input file -> IO () parseStandaloneFDB file = do- (ec, _out, _err) <- readProcessWithExitCode "ogma" args ""- assertBool errorMsg (ec == ExitSuccess)+ assertExecution "ogma" args True errorMsg where args = [ "standalone", "--input-file", file, "--input-format", "fdb" , "--prop-format", "lustre"]@@ -170,14 +156,23 @@ -> Bool -> IO () runErrorCode args success = do- (ec, _out, _err) <- readProcessWithExitCode "ogma" args ""-- -- True if success is expected and detected, or niether expected nor- -- detected.- let testPass = success == (ec == ExitSuccess)-- assertBool errorMsg testPass+ assertExecution "ogma" args success errorMsg where errorMsg = "Testing ogma's CLI parser with arguments " ++ intercalate "," args ++ " failed"++-- | Run program and check result of execution against expectation.+assertExecution :: String -- ^ Program to run.+ -> [String] -- ^ Arguments.+ -> Bool -- ^ Expectation (sucess).+ -> String -- ^ Message if expectation is not met.+ -> IO ()+assertExecution program args success errorMsg = do+ (ec, _out, _err) <- readProcessWithExitCode program args ""++ -- True if success is expected and detected, or neither expected nor+ -- detected.+ let testPass = success == (ec == ExitSuccess)++ assertBool errorMsg testPass